home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / EOObjectStore.h < prev    next >
Encoding:
Text File  |  1996-09-11  |  5.6 KB  |  114 lines

  1. // EOObjectStore.h
  2. // Copyright (c) 1995, NeXT Software, Inc. All rights reserved.
  3. //
  4. // EOObjectStore defines a abstract class for objects that act as an
  5. // "intelligent" source and sink of objects for an EOEditingContext.
  6. // An EOObjectStore is responsible for constructing and registering
  7. // objects, servicing object faults, and committing changes made in an
  8. // EOEditingContext.
  9. //
  10. // An EOObjectStore works with an EOGlobalID object, which provides
  11. // objects with a universal identifier and is the key used for uniquing.
  12. // An EOGlobalID uniquely identifies objects within a single
  13. // EOEditingContext, as well as across EOEditingContexts (both within an
  14. // application and across application instances). See EOGlobalID.h for
  15. // more information.
  16. //
  17. // An EOObjectStore also works with an EOFault object. An EOFault represents
  18. // a object (or a collection of objects) that haven't yet been fetched
  19. // from their external object store. For more information, see EOFault.h.
  20. //
  21. // If you're subclassing EOObjectStore, you must implement all methods.
  22. // The default implementations raise.
  23. // Some of the subclasses of EOObjectStore are EOEditingContext (for use
  24. // in nested EOEditingContexts) and EOObjectStoreCoordinator (for coordinating
  25. // multiple EOObjectStores).
  26. //
  27. #import <Foundation/Foundation.h>
  28. #import <EOControl/EODefines.h>
  29.  
  30. @class EOEditingContext;
  31. @class EOGlobalID;
  32. @class EOFetchSpecification;
  33.  
  34.  
  35. @interface EOObjectStore : NSObject
  36.  
  37. - (id)faultForGlobalID:(EOGlobalID *)globalID editingContext:(EOEditingContext *)context;
  38.     // Create a to-one fault and register it in the editing context.
  39.     // Could return a already existing object
  40.  
  41. - (NSArray *)arrayFaultWithSourceGlobalID:(EOGlobalID *)globalID relationshipName:(NSString *)name editingContext:(EOEditingContext *)context;
  42.     // Create a to-many fault
  43.  
  44. - (void)initializeObject:(id)object withGlobalID:(EOGlobalID *)globalID
  45.           editingContext:(EOEditingContext *)context;
  46.     // instructs the ObjectStore to initialize the given instance by filling
  47.     // it with its properties (via takeValue:forKey:)
  48.  
  49. - (NSArray *)objectsForSourceGlobalID:(EOGlobalID *)globalID relationshipName:(NSString *)name editingContext:(EOEditingContext *)context;
  50.     // This method is used to fire a to-many fault.
  51.  
  52. - (void)refaultObject:object withGlobalID:(EOGlobalID *)globalID editingContext:(EOEditingContext *)context;
  53.     // Turn an Enterprise Object back into a fault. This method should be used with caution.
  54.     // Refaulting an object does not remove the object snapshot from the undo stack. Objects
  55.     // that have been inserted or deleted should be not refaulted.
  56.  
  57. - (void)saveChangesInEditingContext:(EOEditingContext *)context;
  58.     // Sent by an EditingContext to its ObjectStore to commit changes.
  59.     // The receiver calls back to the EditingContext to get list of
  60.     // changes to save. Commits changes in a single transaction.
  61.     // Raises an exception if an error occurs.
  62.     // After this method returns, any locks held by the objectStore are released.
  63.  
  64. - (NSArray *)objectsWithFetchSpecification:(EOFetchSpecification *)fetchSpecification editingContext:(EOEditingContext *)context;
  65.     // The base method to fetch an array of objects into the given context.
  66.     // Raises an exception if an error occurs.
  67.  
  68. - (BOOL)isObjectLockedWithGlobalID:(EOGlobalID *)gid editingContext:(EOEditingContext *)context;
  69.     // Returns YES if object has been locked by object store if the object is newly
  70.     // created and has not yet been saved by it's object store.
  71.  
  72. - (void)lockObjectWithGlobalID:(EOGlobalID *)gid editingContext:(EOEditingContext *)context;
  73.     // Places a persistent lock on the object in it's underlying data store. Raises
  74.     // if an error occurs.
  75.  
  76. - (void)invalidateAllObjects;
  77. - (void)invalidateObjectsWithGlobalIDs:(NSArray *)globalIDs;
  78.     // This method signals the object store that the object(s) should no longer
  79.     // be considered valid and that they should be refaulted. This message is
  80.     // propagated to any underlying object store resulting in a refetch the next
  81.     // time the objects are accessed.
  82.     // Any children objectStores are notified that the objects are no longer valid.
  83.     // When the one of these methods is applied to an EOCoordinatingObjectStore or
  84.     // an EOCooperatingObjectStore, it causes the objectStore to resync the object(s)
  85.     // with the underlying database.
  86. @end
  87.  
  88.  
  89. // Notifications
  90. //     EOObjectsChangedInStoreNotification is broadcast whenever changes are
  91. //     made in an object store.  When an EditingContext receives this notification
  92. //     from its parentObjectStore, it merges in all changed values into its copies
  93. //     of the objects.
  94. //     object = sending store
  95. //     userInfo = {
  96. //                    updated = (array of GlobalIDs for changed objects);
  97. //                    deleted = (array of GlobalIDs for deleted objects);
  98. //                    inserted = (array of GlobalIDs for inserted objects);
  99. //                    invalidated = (array of GlobalIDs for invalidated objects);
  100. //     }
  101. //     Invalidated objects are those for which the cached view can should no longer
  102. //     be trusted.  Invalidated objects should be refaulted so that they are refetched
  103. //     when next examined.
  104. EOCONTROL_EXTERN NSString *EOObjectsChangedInStoreNotification;
  105.  
  106. //     EOInvalidatedAllObjectsInStoreNotification is broadcast whenever the
  107. //     object is invalidating all its objects. When an EditingContext receives this
  108. //     notification from its parent objectStore it will clear its inserted/updated/deleted
  109. //     lists and reset its undo stack.
  110. //
  111. EOCONTROL_EXTERN NSString *EOInvalidatedAllObjectsInStoreNotification;
  112.  
  113.  
  114.