PATH |
Inherits from: EOObjectStore
Implements: NSDisposable
Package: com.webobjects.eocontrol
EOObjectStoreCoordinator is a part of the control layer's object storage abstraction. An EOObjectStoreCoordinator object acts as a single object store by directing one or more EOCooperatingObjectStores in managing objects from distinct data repositories.
For more general information on the object storage abstraction, see "Object Storage Abstraction" (page 23) in the introduction to the EOControl Framework.
EOObjectStoreCoordinator overrides the following EOObjectStore methods:
With the exception of saveChangesInEditingContext, EOObjectStoreCoordinator's implementation of these methods simply forwards the message to an EOCooperatingObjectStore or stores. The message invalidateAllObjects is forwarded to all of a coordinator's cooperating stores. The rest of the messages are forwarded to the appropriate store based on which store responds true to the messages ownsGlobalID, ownsObject, and handlesFetchSpecification (which message is used depends on the context). The EOObjectStore methods listed above aren't documented in this class specification (except for saveChangesInEditingContext)-for descriptions of them, see the EOObjectStore and EODatabaseContext (EOAccess) class specifications
For the method saveChangesInEditingContext, the coordinator guides its cooperating stores through a multi-pass save protocol in which each cooperating store saves its own changes and forwards remaining changes to the other of the coordinator's stores. For example, if in its recordChangesInEditingContext method one cooperating store notices the removal of an object from an "owning" relationship but that object belongs to another cooperating store, it informs the other store by sending the coordinator a forwardUpdateForObject message. For a more details, see the method description for saveChangesInEditingContext.
Although it manages objects from multiple repositories, EOObjectStoreCoordinator doesn't absolutely guarantee consistent updates when saving changes across object stores. If your application requires guaranteed distributed transactions, you can either provide your own solution by creating a subclass of EOObjectStoreCoordinator that integrates with a TP monitor, use a database server with built-in distributed transaction support, or design your application to write to only one object store per save operation (though it may read from multiple object stores). For more discussion of this subject, see the method description for saveChangesInEditingContext.
EOObjectStoreCoordinator defines String constants for the notifications it posts. For more information, see the section "Notifications" (page 296).
Constructors EOObjectStoreCoordinator Setting the default coordinator setDefaultCoordinator defaultCoordinator Managing EOCooperatingObjectStores addCooperatingObjectStore removeCooperatingObjectStore cooperatingObjectStores Saving changes saveChangesInEditingContext Communication between EOCooperatingObjectStores forwardUpdateForObject valuesForKeys Returning EOCooperatingObjectStores objectStoreForGlobalID objectStoreForFetchSpecification objectStoreForObject Getting the userInfo dictionary userInfo setUserInfo
public EOObjectStoreCoordinator()
public static Object defaultCoordinator()
public static void setDefaultCoordinator(EOObjectStoreCoordinator coordinator)
public void addCooperatingObjectStore(EOCooperatingObjectStore store)
See Also: removeCooperatingObjectStore, cooperatingObjectStores
public NSArray arrayFaultWithSourceGlobalID( EOGlobalID anEOGlobalID, String aString, EOEditingContext anEOEditingContext)
public NSArray cooperatingObjectStores()
See Also: addCooperatingObjectStore, removeCooperatingObjectStore
public void dispose()
public void editingContextDidForgetObjectWithGlobalID( EOEditingContext anEOEditingContext, EOGlobalID anEOGlobalID)
public EOEnterpriseObject faultForGlobalID( EOGlobalID anEOGlobalID, EOEditingContext anEOEditingContext)
public EOEnterpriseObject faultForRawRow( NSDictionary aNSDictionary, String aString, EOEditingContext anEOEditingContext)
public void forwardUpdateForObject( EOEnterpriseObject object, NSDictionary changes)
This method first locates the EOCooperatingObjectStore that's responsible for applying changes, and then it sends the store the message recordUpdateForObject.
public void initializeObject( EOEnterpriseObject anEOEnterpriseObject, EOGlobalID anEOGlobalID, EOEditingContext anEOEditingContext)
public void invalidateAllObjects()
public void invalidateObjectsWithGlobalIDs(NSArray aNSArray)
public boolean isObjectLockedWithGlobalID( EOGlobalID anEOGlobalID, EOEditingContext anEOEditingContext)
public void lockObjectWithGlobalID( EOGlobalID anEOGlobalID, EOEditingContext anEOEditingContext)
public NSArray objectsForSourceGlobalID( EOGlobalID anEOGlobalID, String aString, EOEditingContext anEOEditingContext)
public NSArray objectsWithFetchSpecification( EOFetchSpecification anEOFetchSpecification, EOEditingContext anEOEditingContext)
public void refaultObject( EOEnterpriseObject anEOEnterpriseObject, EOGlobalID anEOGlobalID, EOEditingContext anEOEditingContext)
public EOCooperatingObjectStore objectStoreForFetchSpecification(EOFetchSpecification fetchSpecification)
See Also: objectStoreForGlobalID, objectStoreForObject
public EOCooperatingObjectStore objectStoreForGlobalID(EOGlobalID globalID)
See Also: objectStoreForFetchSpecification, objectStoreForObject
public EOCooperatingObjectStore objectStoreForObject(Object object)
See Also: objectStoreForFetchSpecification, objectStoreForGlobalID
public NSArray objectsForSourceGlobalID( EOGlobalID anEOGlobalID, String aString, EOEditingContext anEOEditingContext)
public NSArray objectsWithFetchSpecification( EOFetchSpecification anEOFetchSpecification, EOEditingContext anEOEditingContext)
public void refaultObject( EOEnterpriseObject anEOEnterpriseObject, EOGlobalID anEOGlobalID, EOEditingContext anEOEditingContext)
public void removeCooperatingObjectStore(EOCooperatingObjectStore store)
See Also: addCooperatingObjectStore, cooperatingObjectStores
public void saveChangesInEditingContext(EOEditingContext anEditingContext)
This method raises an exception if an error occurs.
public void setUserInfo(NSDictionary dictionary)
See Also: userInfo
public NSDictionary userInfo()
See Also: setUserInfo
public NSDictionary valuesForKeys( NSArray keys, Object object)
The following notifications are declared and posted by EOObjectStoreCoordinator.
public static final String CooperatingObjectStoreWasAdded
When an EOObjectStoreCoordinator receives an addCooperatingObjectStore message and adds an EOCooperatingObjectStore to its list, it posts CooperatingObjectStoreWasAdded
to notify observers.
Notification Object | The EOObjectStoreCoordinator |
userInfo Dictionary | None |
public static final String CooperatingObjectStoreWasRemoved
CooperatingObjectStoreWasRemoved
to notify observers.Notification Object | The EOObjectStoreCoordinator |
userInfo Dictionary | None |
public static final String CooperatingObjectStoreNeeded
Key | Value |
globalID | globalID for the operation |
fetchSpecification | fetch specification for the operation |
object | object for the operation |
© 2001 Apple Computer, Inc. (Last Published April 19, 2001)