home *** CD-ROM | disk | FTP | other *** search
- // EOObjectStore.h
- // Copyright (c) 1995, NeXT Software, Inc. All rights reserved.
- //
- // EOObjectStore defines a abstract class for objects that act as an
- // "intelligent" source and sink of objects for an EOEditingContext.
- // An EOObjectStore is responsible for constructing and registering
- // objects, servicing object faults, and committing changes made in an
- // EOEditingContext.
- //
- // An EOObjectStore works with an EOGlobalID object, which provides
- // objects with a universal identifier and is the key used for uniquing.
- // An EOGlobalID uniquely identifies objects within a single
- // EOEditingContext, as well as across EOEditingContexts (both within an
- // application and across application instances). See EOGlobalID.h for
- // more information.
- //
- // An EOObjectStore also works with an EOFault object. An EOFault represents
- // a object (or a collection of objects) that haven't yet been fetched
- // from their external object store. For more information, see EOFault.h.
- //
- // If you're subclassing EOObjectStore, you must implement all methods.
- // The default implementations raise.
- // Some of the subclasses of EOObjectStore are EOEditingContext (for use
- // in nested EOEditingContexts) and EOObjectStoreCoordinator (for coordinating
- // multiple EOObjectStores).
- //
- #import <Foundation/Foundation.h>
- #import <EOControl/EODefines.h>
-
- @class EOEditingContext;
- @class EOGlobalID;
- @class EOFetchSpecification;
-
-
- @interface EOObjectStore : NSObject
-
- - (id)faultForGlobalID:(EOGlobalID *)globalID editingContext:(EOEditingContext *)context;
- // Create a to-one fault and register it in the editing context.
- // Could return a already existing object
-
- - (NSArray *)arrayFaultWithSourceGlobalID:(EOGlobalID *)globalID relationshipName:(NSString *)name editingContext:(EOEditingContext *)context;
- // Create a to-many fault
-
- - (void)initializeObject:(id)object withGlobalID:(EOGlobalID *)globalID
- editingContext:(EOEditingContext *)context;
- // instructs the ObjectStore to initialize the given instance by filling
- // it with its properties (via takeValue:forKey:)
-
- - (NSArray *)objectsForSourceGlobalID:(EOGlobalID *)globalID relationshipName:(NSString *)name editingContext:(EOEditingContext *)context;
- // This method is used to fire a to-many fault.
-
- - (void)refaultObject:object withGlobalID:(EOGlobalID *)globalID editingContext:(EOEditingContext *)context;
- // Turn an Enterprise Object back into a fault. This method should be used with caution.
- // Refaulting an object does not remove the object snapshot from the undo stack. Objects
- // that have been inserted or deleted should be not refaulted.
-
- - (void)saveChangesInEditingContext:(EOEditingContext *)context;
- // Sent by an EditingContext to its ObjectStore to commit changes.
- // The receiver calls back to the EditingContext to get list of
- // changes to save. Commits changes in a single transaction.
- // Raises an exception if an error occurs.
- // After this method returns, any locks held by the objectStore are released.
-
- - (NSArray *)objectsWithFetchSpecification:(EOFetchSpecification *)fetchSpecification editingContext:(EOEditingContext *)context;
- // The base method to fetch an array of objects into the given context.
- // Raises an exception if an error occurs.
-
- - (BOOL)isObjectLockedWithGlobalID:(EOGlobalID *)gid editingContext:(EOEditingContext *)context;
- // Returns YES if object has been locked by object store if the object is newly
- // created and has not yet been saved by it's object store.
-
- - (void)lockObjectWithGlobalID:(EOGlobalID *)gid editingContext:(EOEditingContext *)context;
- // Places a persistent lock on the object in it's underlying data store. Raises
- // if an error occurs.
-
- - (void)invalidateAllObjects;
- - (void)invalidateObjectsWithGlobalIDs:(NSArray *)globalIDs;
- // This method signals the object store that the object(s) should no longer
- // be considered valid and that they should be refaulted. This message is
- // propagated to any underlying object store resulting in a refetch the next
- // time the objects are accessed.
- // Any children objectStores are notified that the objects are no longer valid.
- // When the one of these methods is applied to an EOCoordinatingObjectStore or
- // an EOCooperatingObjectStore, it causes the objectStore to resync the object(s)
- // with the underlying database.
- @end
-
-
- // Notifications
- // EOObjectsChangedInStoreNotification is broadcast whenever changes are
- // made in an object store. When an EditingContext receives this notification
- // from its parentObjectStore, it merges in all changed values into its copies
- // of the objects.
- // object = sending store
- // userInfo = {
- // updated = (array of GlobalIDs for changed objects);
- // deleted = (array of GlobalIDs for deleted objects);
- // inserted = (array of GlobalIDs for inserted objects);
- // invalidated = (array of GlobalIDs for invalidated objects);
- // }
- // Invalidated objects are those for which the cached view can should no longer
- // be trusted. Invalidated objects should be refaulted so that they are refetched
- // when next examined.
- EOCONTROL_EXTERN NSString *EOObjectsChangedInStoreNotification;
-
- // EOInvalidatedAllObjectsInStoreNotification is broadcast whenever the
- // object is invalidating all its objects. When an EditingContext receives this
- // notification from its parent objectStore it will clear its inserted/updated/deleted
- // lists and reset its undo stack.
- //
- EOCONTROL_EXTERN NSString *EOInvalidatedAllObjectsInStoreNotification;
-
-
-