net.wotonomy.access
Class EODatabaseContext

java.lang.Object
  extended by net.wotonomy.control.EOObjectStore
      extended by net.wotonomy.control.EOCooperatingObjectStore
          extended by net.wotonomy.access.EODatabaseContext
All Implemented Interfaces:
net.wotonomy.foundation.NSLocking

public class EODatabaseContext
extends EOCooperatingObjectStore
implements net.wotonomy.foundation.NSLocking

Version:
$Revision: 894 $
Author:
ezamudio@nasoft.com, $Author: cgruber $

Field Summary
protected  net.wotonomy.foundation.NSMutableArray _channels
           
protected  EOAdaptorContext _context
           
protected  EOObjectStoreCoordinator _coordinator
           
protected  EOEditingContext _currEC
           
protected  EODatabase _database
           
protected  net.wotonomy.foundation.NSMutableArray _lockedObjects
           
protected  net.wotonomy.foundation.NSMutableDictionary _manySnaps
           
protected  net.wotonomy.foundation.NSMutableDictionary _simpleSnaps
           
protected  int _updateStrategy
           
 
Fields inherited from class net.wotonomy.control.EOObjectStore
DeletedKey, InsertedKey, InvalidatedAllObjectsInStoreNotification, InvalidatedKey, ObjectsChangedInStoreNotification, UpdatedKey
 
Fields inherited from interface net.wotonomy.foundation.NSLocking
OneCentury, OneDay, OneHour, OneMinute, OneSecond, OneWeek, OneYear
 
Constructor Summary
EODatabaseContext(EODatabase database)
           
 
Method Summary
 EOAdaptorContext adaptorContext()
           
 net.wotonomy.foundation.NSArray arrayFaultWithSourceGlobalID(EOGlobalID gid, java.lang.String relName, EOEditingContext ec)
          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).
 EODatabaseChannel availableChannel()
           
 void batchFetchRelationship(EORelationship rel, net.wotonomy.foundation.NSArray arr, EOEditingContext ec)
           
 void commitChanges()
           
static java.lang.Class contextClassToRegister()
           
 EOObjectStoreCoordinator coordinator()
           
 EODatabase database()
           
 void editingContextDidForgetObjectWithGlobalID(EOEditingContext ec, EOGlobalID gid)
          Called by editing contexts when they no longer need to track the specified id.
 java.lang.Object faultForGlobalID(EOGlobalID gid, EOEditingContext ec)
          Returns the object for the specified id.
 java.lang.Object faultForRawRow(java.util.Map row, java.lang.String entityName, EOEditingContext ec)
          Returns a fault representing an object of the specified entity type with values from the specified dictionary.
 void forgetSnapshotForGlobalID(EOGlobalID gid)
           
 void forgetSnapshotsForGlobalIDs(java.util.List gids)
           
 void handleDroppedConnection()
           
 boolean handlesFetchSpecification(EOFetchSpecification fspec)
           
 boolean hasBusyChannels()
           
 void initializeObject(java.lang.Object eo, EOGlobalID gid, EOEditingContext ec)
          Given a newly instantiated object, this method initializes its properties to values appropriate for the specified id.
 void invalidateAllObjects()
          Remove all values from all objects in memory, turning them into faults, and posts an NSNotification that all objects have been invalidated.
 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.
 boolean isObjectLockedWithGlobalID(EOGlobalID gid)
           
 boolean isObjectLockedWithGlobalID(EOGlobalID gid, EOEditingContext ec)
          Returns whether the object corresponding to the specified id is locked.
 void lock()
           
 void lockObjectWithGlobalID(EOGlobalID gid, EOEditingContext ec)
          Locks the object corresponding to the specified id is locked.
 net.wotonomy.foundation.NSArray objectsForSourceGlobalID(EOGlobalID gid, java.lang.String relationName, EOEditingContext ec)
          Returns a List of objects associated with the object with the specified id for the specified property relationship.
 net.wotonomy.foundation.NSArray objectsWithFetchSpecification(EOFetchSpecification fspec, EOEditingContext ec)
          Returns a List of objects the meet the criteria of the supplied specification.
 boolean ownsGlobalID(EOGlobalID gid)
           
 boolean ownsObject(EOEnterpriseObject eo)
           
 void performChanges()
           
 void prepareForSaveWithCoordinator(EOObjectStoreCoordinator coord, EOEditingContext ec)
           
 void recordChangesInEditingContext()
           
 void recordSnapshotForGlobalID(net.wotonomy.foundation.NSDictionary snap, EOGlobalID gid)
           
 void recordSnapshotForSourceGlobalID(net.wotonomy.foundation.NSArray gids, EOGlobalID gid, java.lang.String relationName)
           
 void recordSnapshots(net.wotonomy.foundation.NSDictionary snaps)
           
 void recordToManySnapshots(net.wotonomy.foundation.NSDictionary snaps)
           
 void recordUpdateForObject(EOEnterpriseObject eo, net.wotonomy.foundation.NSDictionary changes)
           
 void refaultObject(java.lang.Object obj, EOGlobalID gid, EOEditingContext ec)
          Removes all values from the specified object, converting it into a fault for the specified id.
 void registerChannel(EODatabaseChannel channel)
           
 net.wotonomy.foundation.NSArray registeredChannels()
           
 void rollbackChanges()
           
 void saveChangesInEditingContext(EOEditingContext ec)
          Writes all changes in the specified editing context to the respository.
static void setContextClassToRegister(java.lang.Class contextClass)
           
 void setUpdateStrategy(int strategy)
           
 net.wotonomy.foundation.NSDictionary snapshotForGlobalID(EOGlobalID gid)
           
 net.wotonomy.foundation.NSArray snapshotForSourceGlobalID(EOGlobalID gid, java.lang.String name)
           
 void unlock()
           
 void unregisterChannel(EODatabaseChannel channel)
           
 int updateStrategy()
           
 net.wotonomy.foundation.NSDictionary valuesForKeys(net.wotonomy.foundation.NSArray keys, EOEnterpriseObject eo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_database

protected EODatabase _database

_context

protected EOAdaptorContext _context

_channels

protected net.wotonomy.foundation.NSMutableArray _channels

_lockedObjects

protected net.wotonomy.foundation.NSMutableArray _lockedObjects

_simpleSnaps

protected net.wotonomy.foundation.NSMutableDictionary _simpleSnaps

_manySnaps

protected net.wotonomy.foundation.NSMutableDictionary _manySnaps

_coordinator

protected EOObjectStoreCoordinator _coordinator

_currEC

protected EOEditingContext _currEC

_updateStrategy

protected int _updateStrategy
Constructor Detail

EODatabaseContext

public EODatabaseContext(EODatabase database)
Method Detail

adaptorContext

public EOAdaptorContext adaptorContext()

database

public EODatabase database()

availableChannel

public EODatabaseChannel availableChannel()

batchFetchRelationship

public void batchFetchRelationship(EORelationship rel,
                                   net.wotonomy.foundation.NSArray arr,
                                   EOEditingContext ec)

setContextClassToRegister

public static void setContextClassToRegister(java.lang.Class contextClass)

contextClassToRegister

public static java.lang.Class contextClassToRegister()

coordinator

public EOObjectStoreCoordinator coordinator()

editingContextDidForgetObjectWithGlobalID

public void editingContextDidForgetObjectWithGlobalID(EOEditingContext ec,
                                                      EOGlobalID gid)
Description copied from class: EOObjectStore
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.

Overrides:
editingContextDidForgetObjectWithGlobalID in class EOObjectStore

handleDroppedConnection

public void handleDroppedConnection()

ownsGlobalID

public boolean ownsGlobalID(EOGlobalID gid)
Specified by:
ownsGlobalID in class EOCooperatingObjectStore

ownsObject

public boolean ownsObject(EOEnterpriseObject eo)
Specified by:
ownsObject in class EOCooperatingObjectStore

handlesFetchSpecification

public boolean handlesFetchSpecification(EOFetchSpecification fspec)
Specified by:
handlesFetchSpecification in class EOCooperatingObjectStore

hasBusyChannels

public boolean hasBusyChannels()

prepareForSaveWithCoordinator

public void prepareForSaveWithCoordinator(EOObjectStoreCoordinator coord,
                                          EOEditingContext ec)
Specified by:
prepareForSaveWithCoordinator in class EOCooperatingObjectStore

recordChangesInEditingContext

public void recordChangesInEditingContext()
Specified by:
recordChangesInEditingContext in class EOCooperatingObjectStore

recordUpdateForObject

public void recordUpdateForObject(EOEnterpriseObject eo,
                                  net.wotonomy.foundation.NSDictionary changes)
Specified by:
recordUpdateForObject in class EOCooperatingObjectStore

recordSnapshotForGlobalID

public void recordSnapshotForGlobalID(net.wotonomy.foundation.NSDictionary snap,
                                      EOGlobalID gid)

recordSnapshotForSourceGlobalID

public void recordSnapshotForSourceGlobalID(net.wotonomy.foundation.NSArray gids,
                                            EOGlobalID gid,
                                            java.lang.String relationName)

recordSnapshots

public void recordSnapshots(net.wotonomy.foundation.NSDictionary snaps)

recordToManySnapshots

public void recordToManySnapshots(net.wotonomy.foundation.NSDictionary snaps)

performChanges

public void performChanges()
Specified by:
performChanges in class EOCooperatingObjectStore

commitChanges

public void commitChanges()
Specified by:
commitChanges in class EOCooperatingObjectStore

rollbackChanges

public void rollbackChanges()
Specified by:
rollbackChanges in class EOCooperatingObjectStore

valuesForKeys

public net.wotonomy.foundation.NSDictionary valuesForKeys(net.wotonomy.foundation.NSArray keys,
                                                          EOEnterpriseObject eo)
Specified by:
valuesForKeys in class EOCooperatingObjectStore

lock

public void lock()
Specified by:
lock in interface net.wotonomy.foundation.NSLocking
Specified by:
lock in class EOCooperatingObjectStore

unlock

public void unlock()
Specified by:
unlock in interface net.wotonomy.foundation.NSLocking
Specified by:
unlock in class EOCooperatingObjectStore

arrayFaultWithSourceGlobalID

public net.wotonomy.foundation.NSArray arrayFaultWithSourceGlobalID(EOGlobalID gid,
                                                                    java.lang.String relName,
                                                                    EOEditingContext ec)
Description copied from class: EOObjectStore
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.

Specified by:
arrayFaultWithSourceGlobalID in class EOObjectStore

faultForGlobalID

public java.lang.Object faultForGlobalID(EOGlobalID gid,
                                         EOEditingContext ec)
Description copied from class: EOObjectStore
Returns the object for the specified id. The returned object may be a fault. The object will be registered in the specified editing context.

Specified by:
faultForGlobalID in class EOObjectStore

faultForRawRow

public java.lang.Object faultForRawRow(java.util.Map row,
                                       java.lang.String entityName,
                                       EOEditingContext ec)
Description copied from class: EOObjectStore
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.

Specified by:
faultForRawRow in class EOObjectStore

forgetSnapshotForGlobalID

public void forgetSnapshotForGlobalID(EOGlobalID gid)

forgetSnapshotsForGlobalIDs

public void forgetSnapshotsForGlobalIDs(java.util.List gids)

initializeObject

public void initializeObject(java.lang.Object eo,
                             EOGlobalID gid,
                             EOEditingContext ec)
Description copied from class: EOObjectStore
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.

Specified by:
initializeObject in class EOObjectStore

invalidateAllObjects

public void invalidateAllObjects()
Description copied from class: EOObjectStore
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.

Specified by:
invalidateAllObjects in class EOObjectStore

invalidateObjectsWithGlobalIDs

public void invalidateObjectsWithGlobalIDs(java.util.List aList)
Description copied from class: EOObjectStore
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.

Specified by:
invalidateObjectsWithGlobalIDs in class EOObjectStore

isObjectLockedWithGlobalID

public boolean isObjectLockedWithGlobalID(EOGlobalID gid,
                                          EOEditingContext ec)
Description copied from class: EOObjectStore
Returns whether the object corresponding to the specified id is locked. The concept of object locking is implementation-specific.

Specified by:
isObjectLockedWithGlobalID in class EOObjectStore

isObjectLockedWithGlobalID

public boolean isObjectLockedWithGlobalID(EOGlobalID gid)

lockObjectWithGlobalID

public void lockObjectWithGlobalID(EOGlobalID gid,
                                   EOEditingContext ec)
Description copied from class: EOObjectStore
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.

Specified by:
lockObjectWithGlobalID in class EOObjectStore

objectsForSourceGlobalID

public net.wotonomy.foundation.NSArray objectsForSourceGlobalID(EOGlobalID gid,
                                                                java.lang.String relationName,
                                                                EOEditingContext ec)
Description copied from class: EOObjectStore
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.

Specified by:
objectsForSourceGlobalID in class EOObjectStore

objectsWithFetchSpecification

public net.wotonomy.foundation.NSArray objectsWithFetchSpecification(EOFetchSpecification fspec,
                                                                     EOEditingContext ec)
Description copied from class: EOObjectStore
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.

Specified by:
objectsWithFetchSpecification in class EOObjectStore

refaultObject

public void refaultObject(java.lang.Object obj,
                          EOGlobalID gid,
                          EOEditingContext ec)
Description copied from class: EOObjectStore
Removes all values from the specified object, converting it into a fault for the specified id. New or deleted objects should not be refaulted.

Specified by:
refaultObject in class EOObjectStore

saveChangesInEditingContext

public void saveChangesInEditingContext(EOEditingContext ec)
Description copied from class: EOObjectStore
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.

Specified by:
saveChangesInEditingContext in class EOObjectStore

registerChannel

public void registerChannel(EODatabaseChannel channel)

unregisterChannel

public void unregisterChannel(EODatabaseChannel channel)

registeredChannels

public net.wotonomy.foundation.NSArray registeredChannels()

snapshotForGlobalID

public net.wotonomy.foundation.NSDictionary snapshotForGlobalID(EOGlobalID gid)

snapshotForSourceGlobalID

public net.wotonomy.foundation.NSArray snapshotForSourceGlobalID(EOGlobalID gid,
                                                                 java.lang.String name)

setUpdateStrategy

public void setUpdateStrategy(int strategy)

updateStrategy

public int updateStrategy()


Copyright © 2006 null. All Rights Reserved.