|
Project Wonder 5.0 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectcom.webobjects.eocontrol.EOObjectStore
com.webobjects.eocontrol.EOEditingContext
er.extensions.eof.ERXEC
public class ERXEC
Subclass of EOEditingContext that has every
public method overridden to support automatic lock/unlock handling for you.
This is very useful, as it is potentially very dangerous to rely on EOFs automatic
lock handling - it will invariably lead into deadlocks. As you will need to use
this class and its subclasses exclusively as your ECs, it also contains a factory
instances. The Factory also sets a default delegate for you and is used
everywhere in ERExtensions and ERDirectToWeb. The Factory is actually an
interface and you would create a new EC by using:
ERXEC.newEditingContext() You can also install your own
Factory classes. It is recommended to subclass ERXEC.DefaultFactory and
override _createEditingContext()
| Nested Class Summary | |
|---|---|
static class |
ERXEC._DenyMergeDelegate
Temp EC delegate that prevents merging of changes to objects that already have changes. |
static class |
ERXEC.DefaultFactory
Default implementation of the Factory interface. |
static interface |
ERXEC.Delegate
Extensions for the EOEditingContext.Delegate interface. |
static class |
ERXEC.DumpLocksSignalHandler
OpenEditingContextLockSignalHandler provides a signal handler that prints out open editing context locks. |
static interface |
ERXEC.Factory
|
| Nested classes/interfaces inherited from class com.webobjects.eocontrol.EOEditingContext |
|---|
com.webobjects.eocontrol.EOEditingContext._EventLoggingEnabler, com.webobjects.eocontrol.EOEditingContext.EditingContextEvent, com.webobjects.eocontrol.EOEditingContext.Editor, com.webobjects.eocontrol.EOEditingContext.MessageHandler |
| Nested classes/interfaces inherited from interface com.webobjects.eocontrol.EOKeyValueArchiving |
|---|
com.webobjects.eocontrol.EOKeyValueArchiving._NullValueSupport, com.webobjects.eocontrol.EOKeyValueArchiving._NumberSupport, com.webobjects.eocontrol.EOKeyValueArchiving._TimestampSupport, com.webobjects.eocontrol.EOKeyValueArchiving.Awaking, com.webobjects.eocontrol.EOKeyValueArchiving.FinishInitialization, com.webobjects.eocontrol.EOKeyValueArchiving.Support |
| Field Summary | |
|---|---|
static boolean |
_shouldLockOnLockObjectStore
Technically, the OSC is public API and as such should also get auto-locked. |
protected static java.util.Map<ERXEC,java.lang.String> |
activeEditingContexts
|
static java.lang.String |
EditingContextDidCreateNotification
Name of the notification that is posted after editing context is created. |
static java.lang.String |
EditingContextDidRevertChanges
Name of the notification that is posted when an editing context is reverted. |
static java.lang.String |
EditingContextFailedToSaveChanges
Name of the notification that is posted when an editing context has failed to save changes. |
static java.lang.String |
EditingContextWillSaveChangesNotification
Name of the notification that is posted before an editing context is saved. |
protected static ERXEC.Factory |
factory
holds a reference to the factory used to create editing contexts |
static org.apache.log4j.Logger |
lockLogger
Logs a message when set to DEBUG and an EC is locked/unlocked. |
static org.apache.log4j.Logger |
lockTrace
Logs a message with trace when set to DEBUG if autoLocking is enabled and an EC is used without a lock. |
static org.apache.log4j.Logger |
log
general logging |
| Fields inherited from class com.webobjects.eocontrol.EOEditingContext |
|---|
_CLASS, _EditingContextDidChangeSharedEditingContextNotification, _EditingContextEditorHasChangesNotification, _IsEventLoggingEnabled, EditingContextDidSaveChangesNotification, EditingContextFlushChangesRunLoopOrdering, ObjectsChangedInEditingContextNotification |
| Fields inherited from class com.webobjects.eocontrol.EOObjectStore |
|---|
_doAssertLock, _doAssertLockInitialized, _wasDisposed, DeletedKey, InsertedKey, InvalidatedAllObjectsInStoreNotification, InvalidatedKey, ObjectsChangedInStoreNotification, UpdatedKey |
| Fields inherited from interface com.webobjects.foundation.NSLocking |
|---|
OneCentury, OneDay, OneHour, OneMinute, OneSecond, OneWeek, OneYear |
| Constructor Summary | |
|---|---|
ERXEC()
|
|
ERXEC(com.webobjects.eocontrol.EOObjectStore os)
|
|
| Method Summary | |
|---|---|
protected void |
_checkOpenLockTraces()
|
protected void |
_initWithParentObjectStore(com.webobjects.eocontrol.EOObjectStore parent)
|
void |
_objectsChangedInStore(com.webobjects.foundation.NSNotification nsnotification)
Overridden so add a bugfix from Lenny Marks |
void |
_processObjectStoreChanges(com.webobjects.foundation.NSDictionary info)
Quick and experimental hack to hook into the merge-changes system. |
protected void |
_saveChanges()
|
com.webobjects.foundation.NSArray |
arrayFaultWithSourceGlobalID(com.webobjects.eocontrol.EOGlobalID eoglobalid,
java.lang.String s,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
|
protected boolean |
autoLock(java.lang.String method)
Utility to actually emit the log messages and do the locking, based on the result of useAutoLock(). |
protected void |
autoUnlock(boolean wasAutoLocked)
Utility to unlock the EC is it was locked in the previous invocation. |
boolean |
coalesceAutoLocks()
If you just use autolocking, you will end up churning locks constantly. |
com.webobjects.foundation.NSDictionary |
committedSnapshotForObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
|
java.lang.Exception |
creationTrace()
If traceOpenEditingContextLocks is true, returns the stack trace from when this EC was created |
com.webobjects.foundation.NSDictionary |
currentEventSnapshotForObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
|
static boolean |
defaultAutomaticLockUnlock()
Returns the value of the er.extensions.ERXEC.defaultAutomaticLockUnlock property, which
turns on auto-locking by default. |
static boolean |
defaultCoalesceAutoLocks()
Returns the value of the er.extensions.ERXEC.defaultCoalesceAutoLocks property, which
turns on coalescing auto-locks, meaning that the EC gets locked once and unlocked at the end of the RR loop. |
com.webobjects.foundation.NSArray |
deletedObjects()
|
void |
deleteObject(com.webobjects.eocontrol.EOEnterpriseObject eo)
Overridden to support autoLocking and to call mightDelete() on subclasses of ERXEnterpriseObject. |
void |
deleteObjects(com.webobjects.foundation.NSArray objects)
Utility to delete a bunch of objects. |
protected void |
didSaveChanges(com.webobjects.foundation.NSArray insertedObjects,
com.webobjects.foundation.NSArray updatedObjects,
com.webobjects.foundation.NSArray deletedObjects)
|
void |
dispose()
|
void |
editingContextDidForgetObjectWithGlobalID(com.webobjects.eocontrol.EOEditingContext eoeditingcontext,
com.webobjects.eocontrol.EOGlobalID eoglobalid)
|
static ERXEC.Factory |
factory()
Gets the factory used to create editing contexts |
com.webobjects.eocontrol.EOEnterpriseObject |
faultForGlobalID(com.webobjects.eocontrol.EOGlobalID eoglobalid,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
|
void |
finalize()
|
void |
forgetObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
|
com.webobjects.eocontrol.EOGlobalID |
globalIDForObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
|
boolean |
hasChanges()
|
void |
initializeObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject,
com.webobjects.eocontrol.EOGlobalID eoglobalid,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
|
com.webobjects.foundation.NSArray |
insertedObjects()
|
void |
insertObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
|
void |
insertObjectWithGlobalID(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject,
com.webobjects.eocontrol.EOGlobalID eoglobalid)
|
void |
invalidateAllObjects()
|
void |
invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray nsarray)
|
java.lang.Object |
invokeRemoteMethod(com.webobjects.eocontrol.EOEditingContext eoeditingcontext,
com.webobjects.eocontrol.EOGlobalID eoglobalid,
java.lang.String s,
java.lang.Class[] aclass,
java.lang.Object[] aobj)
|
boolean |
isAutoLocked()
Returns whether we did autolock this instance. |
void |
lock()
Overridden to emit log messages and push this instance to the locked editing contexts in this thread. |
void |
lockObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
|
void |
lockObjectStore()
|
static boolean |
markOpenLocks()
Returns the value of the er.extensions.ERXEC.markOpenLocks
property, which turns on marking of locks. |
static com.webobjects.eocontrol.EOEditingContext |
newEditingContext()
Factory method to create a new editing context. |
static com.webobjects.eocontrol.EOEditingContext |
newEditingContext(boolean validation)
Factory method to create a new editing context with validation disabled. |
static com.webobjects.eocontrol.EOEditingContext |
newEditingContext(com.webobjects.eocontrol.EOObjectStore objectStore)
Creates a new editing context with the specified object store as the parent object store. |
static com.webobjects.eocontrol.EOEditingContext |
newEditingContext(com.webobjects.eocontrol.EOObjectStore parent,
boolean validationEnabled)
Creates a new editing context with the specified object store as the parent object store and with validation turned on or off depending on the flag passed in. |
static com.webobjects.eocontrol.EOEditingContext |
newTolerantEditingContext()
|
static com.webobjects.eocontrol.EOEditingContext |
newTolerantEditingContext(com.webobjects.eocontrol.EOObjectStore osc)
|
static com.webobjects.eocontrol.EOEditingContext |
newTolerantEditingContext(com.webobjects.eocontrol.EOObjectStore parent,
boolean retry,
boolean merge)
Factory method to create a new tolerant editing context. |
com.webobjects.eocontrol.EOEnterpriseObject |
objectForGlobalID(com.webobjects.eocontrol.EOGlobalID eoglobalid)
|
com.webobjects.foundation.NSArray |
objectsForSourceGlobalID(com.webobjects.eocontrol.EOGlobalID eoglobalid,
java.lang.String s,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
|
com.webobjects.foundation.NSArray |
objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification fs,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
|
void |
objectWillChange(java.lang.Object obj)
|
com.webobjects.foundation.NSDictionary<java.lang.Thread,com.webobjects.foundation.NSMutableArray<java.lang.Exception>> |
openLockTraces()
If traceOpenEditingContextLocks is true, returns the stack trace from when this EC was locked |
static java.lang.String |
outstandingLockDescription()
Returns a string describing outstanding locks for the created ECs |
static void |
popLockedContextForCurrentThread(com.webobjects.eocontrol.EOEditingContext ec)
Pops the given EC from the array of contexts to unlock. |
void |
processRecentChanges()
|
static void |
pushLockedContextForCurrentThread(com.webobjects.eocontrol.EOEditingContext ec)
Pushes the given EC to the array of locked ECs in the current thread. |
void |
recordObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject,
com.webobjects.eocontrol.EOGlobalID eoglobalid)
|
void |
redo()
|
void |
refaultAllObjects()
|
void |
refaultObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
|
void |
refaultObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject,
com.webobjects.eocontrol.EOGlobalID eoglobalid,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
Overridden to support autoLocking and to flush the cache of all ERXEnterpriseObjects. |
void |
refreshObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
|
com.webobjects.foundation.NSArray |
registeredObjects()
|
static void |
registerOpenEditingContextLockSignalHandler()
Register the OpenEditingContextLockSignalHandler signal handle on the HUP signal. |
static void |
registerOpenEditingContextLockSignalHandler(java.lang.String signalName)
Register the OpenEditingContextLockSignalHandler signal handle on the named signal. |
void |
reset()
|
void |
revert()
Overridden to support autoLocking and will/did revert delegate methods. |
static boolean |
safeLocking()
Returns the value of the er.extensions.ERXEC.safeLocking property, which is the
new catch-all setting that turns on all of the recommended locking settings. |
void |
saveChanges()
Smarter version of normal saveChanges() method. |
void |
saveChanges(java.lang.Object obj)
Deprecated. |
void |
saveChangesInEditingContext(com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
|
void |
saveChangesTolerantly()
|
void |
saveChangesTolerantly(boolean doesRetry)
|
void |
saveChangesTolerantly(boolean doesRetry,
boolean mergesChanges)
Saves changes and tries to recover from optimistic locking exceptions by refaulting the object in question, optionally merging the changed values and optionally retrying the save. |
static void |
saveChangesTolerantly(com.webobjects.eocontrol.EOEditingContext ec)
|
static void |
saveChangesTolerantly(com.webobjects.eocontrol.EOEditingContext ec,
boolean doesRetry,
boolean mergesChanges)
|
void |
setCoalesceAutoLocks(boolean value)
Sets whether or not coalescing auto locks should be enabled. |
void |
setDelegate(java.lang.Object d)
Sets the delegate for this context. |
static void |
setFactory(ERXEC.Factory aFactory)
Sets the default editing context factory |
static void |
setMarkOpenLocks(boolean value)
Sets whether or not open editing context lock marking is enabled. |
void |
setOptions(boolean recoversFromException,
boolean doesRetry,
boolean mergesChanges)
Set the options for the saveChanges() operation. |
void |
setSharedEditingContext(com.webobjects.eocontrol.EOSharedEditingContext eosharededitingcontext)
|
static void |
setTraceOpenLocks(boolean value)
Sets whether or not open editing context lock tracing is enabled. |
void |
setUseAutoLock(boolean value)
Sets whether to use autoLocking on this EC. |
static void |
setUseUnlocker(boolean value)
|
static boolean |
traceOpenLocks()
Returns the value of the er.extensions.ERXEC.traceOpenLocks
property, which turns on tracing of locks. |
void |
undo()
|
void |
unlock()
Overridden to emit log messages and pull this instance from the locked editing contexts in this thread. |
static void |
unlockAllContextsForCurrentThread()
Unlocks all remaining locked contexts in the current thread. |
void |
unlockObjectStore()
|
com.webobjects.foundation.NSArray |
updatedObjects()
|
boolean |
useAutoLock()
Decides on a per-EC-level if autoLocking should be used. |
static boolean |
useUnlocker()
Returns the value of the er.extensions.ERXEC.useUnlocker property, which
turns on unlocking at the end of the RR loop. |
protected void |
willSaveChanges(com.webobjects.foundation.NSArray insertedObjects,
com.webobjects.foundation.NSArray updatedObjects,
com.webobjects.foundation.NSArray deletedObjects)
|
| Methods inherited from class com.webobjects.eocontrol.EOEditingContext |
|---|
_clearChangedThisTransaction, _clearOriginalSnapshotAndInitializeRec, _clearOriginalSnapshotForObject, _defaultEditingContextNowInitialized, _defaultSharedEditingContextWasInitialized, _editorHasChanges, _EOAssertSafeMultiThreadedAccess, _EOAssertSafeMultiThreadedAccess, _EOAssertSafeMultiThreadedReadAccess, _globalIDChanged, _globalIDsForObjects, _insertObjectWithGlobalID, _invalidatedAllObjectsInStore, _invalidateObjectsDuringSave, _noop, _objectBasedChangeInfoForGIDInfo, _objectsInitializedInSharedContext, _processEndOfEventNotification, _processGlobalIDChanges, _processInitializedObjectsInSharedContext, _processNotificationQueue, _processRecentChanges, _resetAllChanges, _resetAllChanges, _retainCountForObjectWithGlobalID, _undoDelete, _undoManagerCheckpoint, _undoUpdate, addEditor, decodeWithKeyValueUnarchiver, defaultFetchTimestampLag, defaultParentObjectStore, delegate, editors, editorsHaveChanges, encodeObjectWithCoder, encodeWithKeyValueArchiver, faultForRawRow, faultForRawRow, fetchTimestamp, initObjectWithCoder, instancesRetainRegisteredObjects, invalidatesObjectsWhenFinalized, isObjectLockedWithGlobalID, lockObjectWithGlobalID, locksObjectsBeforeFirstModification, messageHandler, objectsWithFetchSpecification, parentObjectStore, propagatesDeletesAtEndOfEvent, readResolve, refaultObjects, refetch, refreshAllObjects, removeEditor, retainsRegisteredObjects, rootObjectStore, setDefaultFetchTimestampLag, setDefaultParentObjectStore, setFetchTimestamp, setInstancesRetainRegisteredObjects, setInvalidatesObjectsWhenFinalized, setLocksObjectsBeforeFirstModification, setMessageHandler, setPropagatesDeletesAtEndOfEvent, setRetainsRegisteredObjects, setStopsValidationAfterFirstError, setSubstitutionEditingContext, setUndoManager, setUsesContextRelativeEncoding, sharedEditingContext, stopsValidationAfterFirstError, substitutionEditingContext, tryLock, tryToSaveChanges, undoManager, usesContextRelativeEncoding |
| Methods inherited from class com.webobjects.eocontrol.EOObjectStore |
|---|
_checkAssertLock, _resetAssertLock, _suppressAssertLock |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final org.apache.log4j.Logger log
public static final org.apache.log4j.Logger lockLogger
lockTrace is also set to DEBUG.
public static final org.apache.log4j.Logger lockTrace
lockLogger if it is also set to DEBUG.
public static final java.lang.String EditingContextDidCreateNotification
public static final java.lang.String EditingContextWillSaveChangesNotification
public static final java.lang.String EditingContextDidRevertChanges
public static final java.lang.String EditingContextFailedToSaveChanges
public static boolean _shouldLockOnLockObjectStore
protected static java.util.Map<ERXEC,java.lang.String> activeEditingContexts
protected static ERXEC.Factory factory
| Constructor Detail |
|---|
public ERXEC()
public ERXEC(com.webobjects.eocontrol.EOObjectStore os)
| Method Detail |
|---|
public static boolean safeLocking()
er.extensions.ERXEC.safeLocking property, which is the
new catch-all setting that turns on all of the recommended locking settings.
public static boolean defaultAutomaticLockUnlock()
er.extensions.ERXEC.defaultAutomaticLockUnlock property, which
turns on auto-locking by default. Also returns true if safeLocking is true.
public static boolean defaultCoalesceAutoLocks()
er.extensions.ERXEC.defaultCoalesceAutoLocks property, which
turns on coalescing auto-locks, meaning that the EC gets locked once and unlocked at the end of the RR loop.
Also returns true if safeLocking is true.
public static boolean useUnlocker()
er.extensions.ERXEC.useUnlocker property, which
turns on unlocking at the end of the RR loop.
Also returns true if safeLocking is true.
public static void setUseUnlocker(boolean value)
public static boolean traceOpenLocks()
er.extensions.ERXEC.traceOpenLocks
property, which turns on tracing of locks. You can see the trace either by
kill -HUP, by the
ERXDirectAction/showOpenEditingContextLockTraces action or
by setting your App's statistic store to ERXStatisticStore.
public static boolean markOpenLocks()
er.extensions.ERXEC.markOpenLocks
property, which turns on marking of locks. You can see the threads that hold the lock either by
kill -HUP, by the
ERXDirectAction/showOpenEditingContextLockTraces action or
by setting your App's statistic store to ERXStatisticStore.
Also returns true if traceOpenLocks is true.
public static void setTraceOpenLocks(boolean value)
public static void setMarkOpenLocks(boolean value)
public static void pushLockedContextForCurrentThread(com.webobjects.eocontrol.EOEditingContext ec)
ec - locked EOEditingContextpublic static void popLockedContextForCurrentThread(com.webobjects.eocontrol.EOEditingContext ec)
ec - unlocked EOEditingContextpublic static void unlockAllContextsForCurrentThread()
protected void _initWithParentObjectStore(com.webobjects.eocontrol.EOObjectStore parent)
_initWithParentObjectStore in class com.webobjects.eocontrol.EOEditingContextpublic void deleteObjects(com.webobjects.foundation.NSArray objects)
public boolean useAutoLock()
public void setUseAutoLock(boolean value)
public boolean coalesceAutoLocks()
public void setCoalesceAutoLocks(boolean value)
public java.lang.Exception creationTrace()
public com.webobjects.foundation.NSDictionary<java.lang.Thread,com.webobjects.foundation.NSMutableArray<java.lang.Exception>> openLockTraces()
public void lock()
lock in interface com.webobjects.foundation.NSLockinglock in class com.webobjects.eocontrol.EOEditingContextpublic void unlock()
unlock in interface com.webobjects.foundation.NSLockingunlock in class com.webobjects.eocontrol.EOEditingContextprotected boolean autoLock(java.lang.String method)
useAutoLock().
method - method name which to prepend to log message
protected void autoUnlock(boolean wasAutoLocked)
wasAutoLocked - true if the EC was autolockedpublic boolean isAutoLocked()
protected void _checkOpenLockTraces()
public void dispose()
dispose in interface com.webobjects.foundation.NSDisposabledispose in class com.webobjects.eocontrol.EOEditingContext
public void finalize()
throws java.lang.Throwable
finalize in class com.webobjects.eocontrol.EOEditingContextjava.lang.Throwablepublic void lockObjectStore()
lockObjectStore in class com.webobjects.eocontrol.EOEditingContextpublic void unlockObjectStore()
unlockObjectStore in class com.webobjects.eocontrol.EOEditingContextpublic void reset()
reset in class com.webobjects.eocontrol.EOEditingContext
public void recordObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject,
com.webobjects.eocontrol.EOGlobalID eoglobalid)
recordObject in class com.webobjects.eocontrol.EOEditingContextpublic void forgetObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
forgetObject in class com.webobjects.eocontrol.EOEditingContextpublic void processRecentChanges()
processRecentChanges in class com.webobjects.eocontrol.EOEditingContextpublic com.webobjects.foundation.NSArray updatedObjects()
updatedObjects in class com.webobjects.eocontrol.EOEditingContextpublic com.webobjects.foundation.NSArray registeredObjects()
registeredObjects in class com.webobjects.eocontrol.EOEditingContextpublic com.webobjects.foundation.NSArray insertedObjects()
insertedObjects in class com.webobjects.eocontrol.EOEditingContextpublic com.webobjects.foundation.NSArray deletedObjects()
deletedObjects in class com.webobjects.eocontrol.EOEditingContextpublic void setSharedEditingContext(com.webobjects.eocontrol.EOSharedEditingContext eosharededitingcontext)
setSharedEditingContext in class com.webobjects.eocontrol.EOEditingContextpublic com.webobjects.eocontrol.EOEnterpriseObject objectForGlobalID(com.webobjects.eocontrol.EOGlobalID eoglobalid)
objectForGlobalID in class com.webobjects.eocontrol.EOEditingContextpublic com.webobjects.eocontrol.EOGlobalID globalIDForObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
globalIDForObject in class com.webobjects.eocontrol.EOEditingContextpublic com.webobjects.foundation.NSDictionary committedSnapshotForObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
committedSnapshotForObject in class com.webobjects.eocontrol.EOEditingContextpublic com.webobjects.foundation.NSDictionary currentEventSnapshotForObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
currentEventSnapshotForObject in class com.webobjects.eocontrol.EOEditingContextpublic void objectWillChange(java.lang.Object obj)
objectWillChange in interface com.webobjects.eocontrol.EOObservingobjectWillChange in class com.webobjects.eocontrol.EOEditingContext
public void insertObjectWithGlobalID(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject,
com.webobjects.eocontrol.EOGlobalID eoglobalid)
insertObjectWithGlobalID in class com.webobjects.eocontrol.EOEditingContextpublic void insertObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
insertObject in class com.webobjects.eocontrol.EOEditingContextpublic void deleteObject(com.webobjects.eocontrol.EOEnterpriseObject eo)
deleteObject in class com.webobjects.eocontrol.EOEditingContextpublic boolean hasChanges()
hasChanges in class com.webobjects.eocontrol.EOEditingContext
protected void willSaveChanges(com.webobjects.foundation.NSArray insertedObjects,
com.webobjects.foundation.NSArray updatedObjects,
com.webobjects.foundation.NSArray deletedObjects)
protected void didSaveChanges(com.webobjects.foundation.NSArray insertedObjects,
com.webobjects.foundation.NSArray updatedObjects,
com.webobjects.foundation.NSArray deletedObjects)
public void saveChanges()
saveChanges() method. Overridden
to support autoLocking and a bugfix from Lenny Marks, calls up Will/Did
methods on ERXEnterpriseObjects and corrects issues with
flushCaches() needing to be called on objects in the
parent context when committing the child context to the parent. If the
editing context is a child of the object-store coordinator---that is,
it's not a nested context---this method behaves exactly the same as
EOEditingContext.saveChanges(). Otherwise, this method
looks over the changed objects in ec (updatedObjects(),
insertedObjects() and deletedObjects()).
The changed objects lists are filtered for instances of
ERXGenericRecord. The order of operations then becomes:
processRecentChanges() on the child context to
propagate changes.
flushCaches() on each corresponding EO in the parent
context.
saveChanges() on the child, committing the child
changes to the parent editing context.
flushCaches() on each corresponding EO in the parent
context.
The order of operations is a bit peculiar: flush deletes, save, flush inserts and updates. This is done because deletes must be flushed because there may be dependent computed state that needs to be reset. But following the delete being committed, the relationships to other objects cannot be relied upon so it isn't reliable to call flushCaches after the commit. It's not entirely correct to flush the deletes like this, but it's the best we can do.
This works around an issue in EOF that we don't get a merge notification
when a child EC saves to its parent. Because there's no merge
notification, flushCaches() isn't called by the EC
delegate and we're essentially screwed vis-a-vis resetting computed
state.
This method assumes that the ec is locked before this
method is invoked, but this method will take the lock on the parent
editing context if the ec is a nested context before and
after the save in order to get the objects and to flush caches on them.
saveChanges in class com.webobjects.eocontrol.EOEditingContext
public void saveChangesTolerantly(boolean doesRetry,
boolean mergesChanges)
doesRetry - when true, saves again after resolving. when false, throws the
optimistic locking after resolvingmergesChanges - public void saveChangesTolerantly()
public void saveChangesTolerantly(boolean doesRetry)
public void setOptions(boolean recoversFromException,
boolean doesRetry,
boolean mergesChanges)
recoversFromException - doesRetry - mergesChanges - protected void _saveChanges()
public com.webobjects.eocontrol.EOEnterpriseObject faultForGlobalID(com.webobjects.eocontrol.EOGlobalID eoglobalid,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
faultForGlobalID in class com.webobjects.eocontrol.EOEditingContext
public com.webobjects.foundation.NSArray arrayFaultWithSourceGlobalID(com.webobjects.eocontrol.EOGlobalID eoglobalid,
java.lang.String s,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
arrayFaultWithSourceGlobalID in class com.webobjects.eocontrol.EOEditingContext
public void initializeObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject,
com.webobjects.eocontrol.EOGlobalID eoglobalid,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
initializeObject in class com.webobjects.eocontrol.EOEditingContext
public void editingContextDidForgetObjectWithGlobalID(com.webobjects.eocontrol.EOEditingContext eoeditingcontext,
com.webobjects.eocontrol.EOGlobalID eoglobalid)
editingContextDidForgetObjectWithGlobalID in class com.webobjects.eocontrol.EOEditingContext
public com.webobjects.foundation.NSArray objectsForSourceGlobalID(com.webobjects.eocontrol.EOGlobalID eoglobalid,
java.lang.String s,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
objectsForSourceGlobalID in class com.webobjects.eocontrol.EOEditingContextpublic void refaultObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
refaultObject in class com.webobjects.eocontrol.EOEditingContext
public void refaultObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject,
com.webobjects.eocontrol.EOGlobalID eoglobalid,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
refaultObject in class com.webobjects.eocontrol.EOEditingContext
public com.webobjects.foundation.NSArray objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification fs,
com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
objectsWithFetchSpecification in class com.webobjects.eocontrol.EOEditingContextpublic void saveChangesInEditingContext(com.webobjects.eocontrol.EOEditingContext eoeditingcontext)
saveChangesInEditingContext in class com.webobjects.eocontrol.EOEditingContextpublic void refaultAllObjects()
refaultAllObjects in class com.webobjects.eocontrol.EOEditingContextpublic void invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray nsarray)
invalidateObjectsWithGlobalIDs in class com.webobjects.eocontrol.EOEditingContextpublic void invalidateAllObjects()
invalidateAllObjects in class com.webobjects.eocontrol.EOEditingContextpublic void lockObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
lockObject in class com.webobjects.eocontrol.EOEditingContextpublic void revert()
revert in class com.webobjects.eocontrol.EOEditingContextpublic void saveChanges(java.lang.Object obj)
saveChanges in class com.webobjects.eocontrol.EOEditingContextpublic void refreshObject(com.webobjects.eocontrol.EOEnterpriseObject eoenterpriseobject)
refreshObject in class com.webobjects.eocontrol.EOEditingContextpublic void undo()
undo in class com.webobjects.eocontrol.EOEditingContextpublic void redo()
redo in class com.webobjects.eocontrol.EOEditingContext
public java.lang.Object invokeRemoteMethod(com.webobjects.eocontrol.EOEditingContext eoeditingcontext,
com.webobjects.eocontrol.EOGlobalID eoglobalid,
java.lang.String s,
java.lang.Class[] aclass,
java.lang.Object[] aobj)
invokeRemoteMethod in class com.webobjects.eocontrol.EOEditingContextpublic void _objectsChangedInStore(com.webobjects.foundation.NSNotification nsnotification)
_objectsChangedInStore in class com.webobjects.eocontrol.EOEditingContextpublic void _processObjectStoreChanges(com.webobjects.foundation.NSDictionary info)
_processObjectStoreChanges in class com.webobjects.eocontrol.EOEditingContextpublic void setDelegate(java.lang.Object d)
setDelegate in class com.webobjects.eocontrol.EOEditingContextpublic static ERXEC.Factory factory()
public static void setFactory(ERXEC.Factory aFactory)
aFactory - factory used to create editing contextspublic static com.webobjects.eocontrol.EOEditingContext newEditingContext()
public static com.webobjects.eocontrol.EOEditingContext newTolerantEditingContext(com.webobjects.eocontrol.EOObjectStore parent,
boolean retry,
boolean merge)
public static com.webobjects.eocontrol.EOEditingContext newTolerantEditingContext()
public static com.webobjects.eocontrol.EOEditingContext newTolerantEditingContext(com.webobjects.eocontrol.EOObjectStore osc)
public static void saveChangesTolerantly(com.webobjects.eocontrol.EOEditingContext ec,
boolean doesRetry,
boolean mergesChanges)
public static void saveChangesTolerantly(com.webobjects.eocontrol.EOEditingContext ec)
public static com.webobjects.eocontrol.EOEditingContext newEditingContext(com.webobjects.eocontrol.EOObjectStore parent,
boolean validationEnabled)
EOEditingContext is
a subclass of EOObjectStore so passing in another editing context to this
method is completely kosher.
parent - object store for the newly created editing context.validationEnabled - determines if the editing context should perform validation
public static com.webobjects.eocontrol.EOEditingContext newEditingContext(boolean validation)
validation - flag that determines if validation should or should not be
enabled.
public static com.webobjects.eocontrol.EOEditingContext newEditingContext(com.webobjects.eocontrol.EOObjectStore objectStore)
EOEditingContext is
a subclass of EOObjectStore so passing in another editing context to this
method is completely kosher.
objectStore - parent object store for the newly created editing context.
public static void registerOpenEditingContextLockSignalHandler()
public static void registerOpenEditingContextLockSignalHandler(java.lang.String signalName)
signalName - the name of the signal to handlepublic static java.lang.String outstandingLockDescription()
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||