|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eocontrol.EOObjectStore com.webobjects.eocontrol.EOEditingContext er.extensions.ERXEC
Subclass that has every public method overridden to support automatic
lock/unlock handling for you. This is very useful, as is 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 class to create
editing contexts. The Factory also sets a default delegate for you and is used everywhere in
ERExtensions and ERDirectToWeb.
The Factory is actually and 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.DefaultFactory
Default implementation of the Factory interface. |
static interface |
ERXEC.Factory
|
Nested classes inherited from class com.webobjects.eocontrol.EOEditingContext |
EOEditingContext._EventLoggingEnabler, EOEditingContext.Delegate, EOEditingContext.EditingContextEvent, EOEditingContext.Editor, EOEditingContext.MessageHandler |
Nested classes inherited from class com.webobjects.eocontrol.EOKeyValueArchiving |
EOKeyValueArchiving._NullValueSupport, EOKeyValueArchiving._NumberSupport, EOKeyValueArchiving._TimestampSupport, EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support |
Field Summary | |
static String |
EditingContextDidCreateNotification
name of the notification that is posted after editing context is created. |
protected static ERXEC.Factory |
factory
holds a reference to the factory used to create editing contexts |
static ERXLogger |
lockLogger
logs a message when set to DEBUG, autoLocking is enabled and an EC is used without a lock. |
static ERXLogger |
lockLoggerTrace
logs a message with a stack trace when set to DEBUG and an EC is locked/unlocked. |
static ERXLogger |
lockTrace
logs a message when set to DEBUG and an EC is locked/unlocked. |
static ERXLogger |
log
general logging |
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()
default constructor |
|
ERXEC(EOObjectStore os)
alternative constructor |
Method Summary | |
NSArray |
arrayFaultWithSourceGlobalID(EOGlobalID eoglobalid,
String s,
EOEditingContext eoeditingcontext)
Overriden to support autoLocking. |
protected boolean |
autoLock(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. |
NSDictionary |
committedSnapshotForObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
NSDictionary |
currentEventSnapshotForObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
static boolean |
defaultAutomaticLockUnlock()
|
NSArray |
deletedObjects()
Overriden to support autoLocking. |
void |
deleteObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
void |
deleteObjects(NSArray objects)
Utility to delete a bunch of objects. |
void |
editingContextDidForgetObjectWithGlobalID(EOEditingContext eoeditingcontext,
EOGlobalID eoglobalid)
Overriden to support autoLocking. |
static ERXEC.Factory |
factory()
Gets the factory used to create editing contexts |
EOEnterpriseObject |
faultForGlobalID(EOGlobalID eoglobalid,
EOEditingContext eoeditingcontext)
Overriden to support autoLocking. |
void |
finalize()
Overriden to support automatic autoLocking. |
void |
forgetObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
EOGlobalID |
globalIDForObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
boolean |
hasChanges()
Overriden to support autoLocking. |
void |
initializeObject(EOEnterpriseObject eoenterpriseobject,
EOGlobalID eoglobalid,
EOEditingContext eoeditingcontext)
Overriden to support autoLocking. |
NSArray |
insertedObjects()
Overriden to support autoLocking. |
void |
insertObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
void |
insertObjectWithGlobalID(EOEnterpriseObject eoenterpriseobject,
EOGlobalID eoglobalid)
Overriden to support autoLocking. |
void |
invalidateAllObjects()
Overriden to support autoLocking. |
void |
invalidateObjectsWithGlobalIDs(NSArray nsarray)
Overriden to support autoLocking. |
Object |
invokeRemoteMethod(EOEditingContext eoeditingcontext,
EOGlobalID eoglobalid,
String s,
Class[] aclass,
Object[] aobj)
Overriden to support autoLocking. |
boolean |
isAutoLocked()
Returns whether we did autolock this instance. |
void |
lock()
Overridden to emmit log messages and push this instance to the locked editing contexts in this thread. |
int |
lockCount()
Returns the number of outstanding locks. |
void |
lockObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
static EOEditingContext |
newEditingContext()
Factory method to create a new editing context. |
static EOEditingContext |
newEditingContext(boolean validation)
Factory method to create a new editing context with validation disabled. |
static EOEditingContext |
newEditingContext(EOObjectStore objectStore)
Creates a new editing context with the specified object store as the parent object store. |
static EOEditingContext |
newEditingContext(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. |
EOEnterpriseObject |
objectForGlobalID(EOGlobalID eoglobalid)
Overriden to support autoLocking. |
NSArray |
objectsForSourceGlobalID(EOGlobalID eoglobalid,
String s,
EOEditingContext eoeditingcontext)
Overriden to support autoLocking. |
NSArray |
objectsWithFetchSpecification(EOFetchSpecification eofetchspecification,
EOEditingContext eoeditingcontext)
Overriden to support autoLocking. |
void |
objectWillChange(Object obj)
Overriden to support autoLocking. |
static void |
popLockedContextForCurrentThread(EOEditingContext ec)
Pops the given EC from the array of contexts to unlock. |
void |
processRecentChanges()
Overriden to support autoLocking. |
static void |
pushLockedContextForCurrentThread(EOEditingContext ec)
Pushes the given EC to the array of locked ECs in the current thread. |
void |
recordObject(EOEnterpriseObject eoenterpriseobject,
EOGlobalID eoglobalid)
Overriden to support autoLocking. |
void |
redo()
Overriden to support autoLocking. |
void |
refaultAllObjects()
Overriden to support autoLocking. |
void |
refaultObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
void |
refaultObject(EOEnterpriseObject eoenterpriseobject,
EOGlobalID eoglobalid,
EOEditingContext eoeditingcontext)
Overriden to support autoLocking. |
void |
refreshObject(EOEnterpriseObject eoenterpriseobject)
Overriden to support autoLocking. |
NSArray |
registeredObjects()
Overriden to support autoLocking. |
void |
reset()
Overriden to support automatic autoLocking. |
void |
revert()
Overriden to support autoLocking. |
void |
saveChanges()
Overriden to support autoLocking. |
void |
saveChanges(Object obj)
Overriden to support autoLocking. |
void |
saveChangesInEditingContext(EOEditingContext eoeditingcontext)
Overriden to support autoLocking. |
void |
setDelegate(Object d)
Sets the delegate for this context. |
static void |
setFactory(ERXEC.Factory aFactory)
Sets the default editing context factory |
void |
setSharedEditingContext(EOSharedEditingContext eosharededitingcontext)
Overriden to support autoLocking. |
void |
setUseAutoLock(boolean value)
Sets whether to use autoLocking on this EC. |
static void |
setUseUnlocker(boolean value)
|
void |
undo()
Overriden to support autoLocking. |
void |
unlock()
Overridden to emmit 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. |
NSArray |
updatedObjects()
Overriden to support autoLocking. |
boolean |
useAutoLock()
Decides on a per-EC-level if autoLocking should be used. |
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 ERXLogger log
public static final ERXLogger lockLogger
public static final ERXLogger lockLoggerTrace
public static final ERXLogger lockTrace
public static final String EditingContextDidCreateNotification
protected static ERXEC.Factory factory
Constructor Detail |
public ERXEC()
public ERXEC(EOObjectStore os)
Method Detail |
public static void setUseUnlocker(boolean value)
public static void pushLockedContextForCurrentThread(EOEditingContext ec)
ec
- locked EOEditingContextpublic static void popLockedContextForCurrentThread(EOEditingContext ec)
ec
- unlocked EOEditingContextpublic static void unlockAllContextsForCurrentThread()
public static boolean defaultAutomaticLockUnlock()
public void deleteObjects(NSArray objects)
public boolean useAutoLock()
public void setUseAutoLock(boolean value)
public int lockCount()
public void lock()
public void unlock()
protected boolean autoLock(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()
public void finalize() throws Throwable
Throwable
public void reset()
public void recordObject(EOEnterpriseObject eoenterpriseobject, EOGlobalID eoglobalid)
public void forgetObject(EOEnterpriseObject eoenterpriseobject)
public void processRecentChanges()
public NSArray updatedObjects()
public NSArray registeredObjects()
public NSArray insertedObjects()
public NSArray deletedObjects()
public void setSharedEditingContext(EOSharedEditingContext eosharededitingcontext)
public EOEnterpriseObject objectForGlobalID(EOGlobalID eoglobalid)
public EOGlobalID globalIDForObject(EOEnterpriseObject eoenterpriseobject)
public NSDictionary committedSnapshotForObject(EOEnterpriseObject eoenterpriseobject)
public NSDictionary currentEventSnapshotForObject(EOEnterpriseObject eoenterpriseobject)
public void objectWillChange(Object obj)
public void insertObjectWithGlobalID(EOEnterpriseObject eoenterpriseobject, EOGlobalID eoglobalid)
public void insertObject(EOEnterpriseObject eoenterpriseobject)
public void deleteObject(EOEnterpriseObject eoenterpriseobject)
public boolean hasChanges()
public void saveChanges()
public EOEnterpriseObject faultForGlobalID(EOGlobalID eoglobalid, EOEditingContext eoeditingcontext)
public NSArray arrayFaultWithSourceGlobalID(EOGlobalID eoglobalid, String s, EOEditingContext eoeditingcontext)
public void initializeObject(EOEnterpriseObject eoenterpriseobject, EOGlobalID eoglobalid, EOEditingContext eoeditingcontext)
public void editingContextDidForgetObjectWithGlobalID(EOEditingContext eoeditingcontext, EOGlobalID eoglobalid)
public NSArray objectsForSourceGlobalID(EOGlobalID eoglobalid, String s, EOEditingContext eoeditingcontext)
public void refaultObject(EOEnterpriseObject eoenterpriseobject)
public void refaultObject(EOEnterpriseObject eoenterpriseobject, EOGlobalID eoglobalid, EOEditingContext eoeditingcontext)
public NSArray objectsWithFetchSpecification(EOFetchSpecification eofetchspecification, EOEditingContext eoeditingcontext)
public void saveChangesInEditingContext(EOEditingContext eoeditingcontext)
public void refaultAllObjects()
public void invalidateObjectsWithGlobalIDs(NSArray nsarray)
public void invalidateAllObjects()
public void lockObject(EOEnterpriseObject eoenterpriseobject)
public void revert()
public void saveChanges(Object obj)
public void refreshObject(EOEnterpriseObject eoenterpriseobject)
public void undo()
public void redo()
public Object invokeRemoteMethod(EOEditingContext eoeditingcontext, EOGlobalID eoglobalid, String s, Class[] aclass, Object[] aobj)
public void setDelegate(Object d)
public static ERXEC.Factory factory()
public static void setFactory(ERXEC.Factory aFactory)
public static EOEditingContext newEditingContext()
public static EOEditingContext newEditingContext(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 EOEditingContext newEditingContext(boolean validation)
validation
- flag that determines if validation
should or should not be enabled.
public static EOEditingContext newEditingContext(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.
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |