net.wotonomy.control
Class EOObjectStore

java.lang.Object
  extended by net.wotonomy.control.EOObjectStore
Direct Known Subclasses:
AbstractObjectStore, EOCooperatingObjectStore, EOEditingContext, EOObjectStoreCoordinator

public abstract class EOObjectStore
extends java.lang.Object

EOObjectStore defines an object repository that tracks object creations, deletions, and updates made by EOEditingContexts.

A concrete implementation would probably write these changes to some kind of persistent storage, like a database.

EOEditingContext is itself a subclass of EOObjectStore that requires an EOObjectStore parent for committing its changes. This means that EOEditingContexts can use other EOEditingContexts as their parent, but there still must exist an EOObjectStore as the root of the editing graph.

Version:
$Revision: 894 $
Author:
michael@mpowers.net, $Author: cgruber $

Field Summary
static java.lang.String DeletedKey
          Key for the user info of ObjectsChangedInStoreNotifications.
static java.lang.String InsertedKey
          Key for the user info of ObjectsChangedInStoreNotifications.
static java.lang.String InvalidatedAllObjectsInStoreNotification
          Key for the NSNotification posted when this object store is asked to invalidate all objects.
static java.lang.String InvalidatedKey
          Key for the user info of ObjectsChangedInStoreNotification.
static java.lang.String ObjectsChangedInStoreNotification
          Key for the NSNotification posted when this object store is changed.
static java.lang.String UpdatedKey
          Key for the user info of ObjectsChangedInStoreNotifications.
 
Constructor Summary
EOObjectStore()
          Default constructor is responsible for initializing internal state.
 
Method Summary
abstract  net.wotonomy.foundation.NSArray arrayFaultWithSourceGlobalID(EOGlobalID aGlobalID, java.lang.String aRelationship, EOEditingContext aContext)
          Returns a List of objects associated with the object with the specified id for the specified property relationship, or may return a placeholder array that will defer the fetch until accessed (an array fault).
 void editingContextDidForgetObjectWithGlobalID(EOEditingContext aContext, EOGlobalID aGlobalID)
          Called by editing contexts when they no longer need to track the specified id.
abstract  java.lang.Object faultForGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext)
          Returns the object for the specified id.
abstract  java.lang.Object faultForRawRow(java.util.Map aDictionary, java.lang.String anEntityName, EOEditingContext aContext)
          Returns a fault representing an object of the specified entity type with values from the specified dictionary.
abstract  void initializeObject(java.lang.Object eo, EOGlobalID aGlobalID, EOEditingContext aContext)
          Given a newly instantiated object, this method initializes its properties to values appropriate for the specified id.
abstract  void invalidateAllObjects()
          Remove all values from all objects in memory, turning them into faults, and posts an NSNotification that all objects have been invalidated.
abstract  void invalidateObjectsWithGlobalIDs(java.util.List aList)
          Removes values with the specified ids from memory, turning them into faults, and posts a notification that those objects have been invalidated.
abstract  boolean isObjectLockedWithGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext)
          Returns whether the object corresponding to the specified id is locked.
abstract  void lockObjectWithGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext)
          Locks the object corresponding to the specified id is locked.
abstract  net.wotonomy.foundation.NSArray objectsForSourceGlobalID(EOGlobalID aGlobalID, java.lang.String aRelationship, EOEditingContext aContext)
          Returns a List of objects associated with the object with the specified id for the specified property relationship.
abstract  net.wotonomy.foundation.NSArray objectsWithFetchSpecification(EOFetchSpecification aFetchSpec, EOEditingContext aContext)
          Returns a List of objects the meet the criteria of the supplied specification.
abstract  void refaultObject(java.lang.Object anObject, EOGlobalID aGlobalID, EOEditingContext aContext)
          Removes all values from the specified object, converting it into a fault for the specified id.
abstract  void saveChangesInEditingContext(EOEditingContext aContext)
          Writes all changes in the specified editing context to the respository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DeletedKey

public static final java.lang.String DeletedKey
Key for the user info of ObjectsChangedInStoreNotifications. The key should retrieve an array of deleted EOGlobalIDs.

See Also:
Constant Field Values

InsertedKey

public static final java.lang.String InsertedKey
Key for the user info of ObjectsChangedInStoreNotifications. The key should retrieve an array of inserted EOGlobalIDs.

See Also:
Constant Field Values

UpdatedKey

public static final java.lang.String UpdatedKey
Key for the user info of ObjectsChangedInStoreNotifications. The key should retrieve an array of updated EOGlobalIDs. EOEditingContexts should refault their copies of these objects.

See Also:
Constant Field Values

InvalidatedKey

public static final java.lang.String InvalidatedKey
Key for the user info of ObjectsChangedInStoreNotification. The key should retrieve an array of EOGlobalIDs.

See Also:
Constant Field Values

InvalidatedAllObjectsInStoreNotification

public static final java.lang.String InvalidatedAllObjectsInStoreNotification
Key for the NSNotification posted when this object store is asked to invalidate all objects. Object of the notification will be this object store, and user info will contain the InvalidatedKey.

See Also:
Constant Field Values

ObjectsChangedInStoreNotification

public static final java.lang.String ObjectsChangedInStoreNotification
Key for the NSNotification posted when this object store is changed. Object of the notification will be this object store, and user info will contain InsertedKey, UpdatedKey, DeletedKey, and InvalidatedKey.

See Also:
Constant Field Values
Constructor Detail

EOObjectStore

public EOObjectStore()
Default constructor is responsible for initializing internal state.

Method Detail

editingContextDidForgetObjectWithGlobalID

public void editingContextDidForgetObjectWithGlobalID(EOEditingContext aContext,
                                                      EOGlobalID aGlobalID)
Called by editing contexts when they no longer need to track the specified id. You will not need to call this method, but you use use it for a hint that the specified global id is not in use by that child editing context.


arrayFaultWithSourceGlobalID

public abstract net.wotonomy.foundation.NSArray arrayFaultWithSourceGlobalID(EOGlobalID aGlobalID,
                                                                             java.lang.String aRelationship,
                                                                             EOEditingContext aContext)
Returns a List of objects associated with the object with the specified id for the specified property relationship, or may return a placeholder array that will defer the fetch until accessed (an array fault). All objects must be registered the specified editing context. The specified relationship key must produce a result of type Collection for the source object or an exception is thrown.


faultForGlobalID

public abstract java.lang.Object faultForGlobalID(EOGlobalID aGlobalID,
                                                  EOEditingContext aContext)
Returns the object for the specified id. The returned object may be a fault. The object will be registered in the specified editing context.


faultForRawRow

public abstract java.lang.Object faultForRawRow(java.util.Map aDictionary,
                                                java.lang.String anEntityName,
                                                EOEditingContext aContext)
Returns a fault representing an object of the specified entity type with values from the specified dictionary. The fault should belong to the specified editing context.


initializeObject

public abstract void initializeObject(java.lang.Object eo,
                                      EOGlobalID aGlobalID,
                                      EOEditingContext aContext)
Given a newly instantiated object, this method initializes its properties to values appropriate for the specified id. The object should already belong to the specified editing context. This method is called to populate faults.


invalidateAllObjects

public abstract void invalidateAllObjects()
Remove all values from all objects in memory, turning them into faults, and posts an NSNotification that all objects have been invalidated. The notification should be named with the string constant InvalidatedAllObjectsInStoreNotification with this object store as the object and no user info.


invalidateObjectsWithGlobalIDs

public abstract void invalidateObjectsWithGlobalIDs(java.util.List aList)
Removes values with the specified ids from memory, turning them into faults, and posts a notification that those objects have been invalidated. The notification should be named with the string constant ObjectsChangedInStoreNotification with this object store as the object and user info containing a key named InvalidateKey that returns a List of the EOGlobalIDs of the invalidated objects.


isObjectLockedWithGlobalID

public abstract boolean isObjectLockedWithGlobalID(EOGlobalID aGlobalID,
                                                   EOEditingContext aContext)
Returns whether the object corresponding to the specified id is locked. The concept of object locking is implementation-specific.


lockObjectWithGlobalID

public abstract void lockObjectWithGlobalID(EOGlobalID aGlobalID,
                                            EOEditingContext aContext)
Locks the object corresponding to the specified id is locked. The concept of object locking is implementation-specific. The lock may be released when objects are invalidated or commited, but this behavior is not required.


objectsForSourceGlobalID

public abstract net.wotonomy.foundation.NSArray objectsForSourceGlobalID(EOGlobalID aGlobalID,
                                                                         java.lang.String aRelationship,
                                                                         EOEditingContext aContext)
Returns a List of objects associated with the object with the specified id for the specified property relationship. This method may not return an array fault because array faults call this method to fetch on demand. All objects must be registered the specified editing context. The specified relationship key must produce a result of type Collection for the source object or an exception is thrown.


objectsWithFetchSpecification

public abstract net.wotonomy.foundation.NSArray objectsWithFetchSpecification(EOFetchSpecification aFetchSpec,
                                                                              EOEditingContext aContext)
Returns a List of objects the meet the criteria of the supplied specification. Faults are not allowed in the array. Each object is registered with the specified editing context. If any object is already fetched in the specified context, it is not refetched and that object should be used in the array.


refaultObject

public abstract void refaultObject(java.lang.Object anObject,
                                   EOGlobalID aGlobalID,
                                   EOEditingContext aContext)
Removes all values from the specified object, converting it into a fault for the specified id. New or deleted objects should not be refaulted.


saveChangesInEditingContext

public abstract void saveChangesInEditingContext(EOEditingContext aContext)
Writes all changes in the specified editing context to the respository. The object store is expected to post a notification that should be named with the string constant ObjectsChangedInStoreNotification with this object store as the object and user info containing keys named UpdatedKey, InsertedKey, and DeletedKey that return Lists of the EOGlobalIDs of the corresponding objects.



Copyright © 2006 null. All Rights Reserved.