PATH  WebObjects 4.0 Documentation > EOAccess Reference



EODatabaseContext

Inherits From:
com.apple.yellow.eocontrol.EOCooperatingObjectStore :
com.apple.yellow.eocontrol.EOObjectStore :
NSObject

Inherits From:
com.apple.yellow.eoaccess


Class Description

An EODatabaseContext object is a com.apple.yellow.eocontrol.EOObjectStore (com.apple.client.eocontrol if you're using Siva) for accessing relational databases, creating and saving objects based on EOEntity definitions in an EOModel.

An EODatabaseContext represents a single connection to a database server, and it determines the updating and locking strategy used by its EODatabaseChannel objects. An EODatabaseContext has a corresponding EODatabase object. If the server supports multiple concurrent transactions, the EODatabase object may have several database contexts. If the server and adaptor support it, a database context may in turn have several database channels, which handle access to the data on the server.

For a more information, see "More about EODatabaseContext".


Method Types

Constructors
EODatabaseContext
Fetching objects
objectsWithFetchSpecification
objectsForSourceGlobalID
arrayFaultWithSourceGlobalID
faultForGlobalID
faultForRawRow
batchFetchRelationship
Accessing the adaptor context
adaptorContext
Accessing the database object
database
Accessing the coordinator
coordinator
Managing channels
availableChannel
registerChannel
registeredChannels
unregisterChannel
Accessing the delegate
setDelegate
delegate
Committing or discarding changes
invalidateAllObjects
invalidateObjectsWithGlobalIDs
rollbackChanges
saveChangesInEditingContext
commitChanges
performChanges
prepareForSaveWithCoordinator
recordUpdateForObject
recordChangesInEditingContext
refaultObject
Determining if the EODatabaseContext is responsible for a particular operation
ownsObject
ownsGlobalID
handlesFetchSpecification
Managing Snapshots
forgetSnapshotForGlobalID
forgetSnapshotsForGlobalIDs
localSnapshotForGlobalID
recordSnapshotForGlobalID
recordSnapshots
snapshotForGlobalID
recordSnapshotForSourceGlobalID
snapshotForSourceGlobalID
localSnapshotForSourceGlobalID
recordToManySnapshots
Initializing objects
initializeObject
Obtaining an EODatabaseContext
registeredDatabaseContextForModel
Locking objects
setUpdateStrategy
updateStrategy
registerLockedObjectWithGlobalID
isObjectLockedWithGlobalID
forgetAllLocks
forgetLocksForObjectsWithGlobalIDs
lockObjectWithGlobalID
Returning information about objects
valuesForKeys
Setting the context class
contextClassToRegister
setContextClassToRegister
Checking connection status
hasBusyChannels
Other
forceConnectionWithModel
lock
unlock

Constructors


EODatabaseContext

public EODatabaseContext()

public EODatabaseContext(EODatabase aDatabase)

Creates and returns a new EODatabaseContext. Typically, you don't need to programmatically create database contexts. Rather, they are created automatically by the control layer. See "Creating and Using an EODatabaseContext" for more information.

aDatabase is assigned to the new database as the EODatabase object with which the new context works. The new database context creates an EOAdaptorContext with which to communicate with the database server. Throws an exception if the underlying adaptor context can't create a corresponding adaptor channel.

See also: database



contextClassToRegister

public static java.lang.Class contextClassToRegister()

Returns the class that is registered with an EOObjectStoreCoordinator when the coordinator broadcasts an EOCooperatingObjectStoreNeeded notification. By default this is EODatabaseContext, but you can use setContextClassToRegister to specify your own subclass of EODatabaseContext.

When an EOObjectStoreCoordinator sends an EOCooperatingObjectStoreNeeded notification for an EOEntity in the default model group, if contextClassToRegister is non-null (and it should be-it makes no sense to set contextClassToRegister to null), an instance of the that class is created, the EOModel for the EOEntity is registered, and the context class is registered with the requesting EOObjectStoreCoordinator.


forceConnectionWithModel

public static EODatabaseContext forceConnectionWithModel(EOModel aModel,
NSDictionary overrides,
com.apple.yellow.eocontrol.EOEditingContext anEditingContext)

Forces the stack of objects in the EOAccess layer to be instantiated, if necessary, and then makes a connection to the database. If there is an existing connection for amodel, it is first closed and then reconnected. The new connection dictionary is effectively made up of the model's connection dictionary, overlaid with overrides. All compatible models in the model's group also are associated with the new connection (so they share the same adaptor). Returns the EODatabaseContext associated with the model for anEditingContext.


registeredDatabaseContextForModel

public static EODatabaseContext registeredDatabaseContextForModel(EOModel aModel, com.apple.yellow.eocontrol.EOEditingContext anEditingContext)

Finds the com.apple.yellow.eocontrol.EOObjectStoreCoordinator for anEditingContext and checks to see if it already contains an EODatabaseContext cooperating store for aModel. If it does, it returns that EODatabaseContext. Otherwise it instantiates a new EODatabaseContext, adds it to the EOObjectStoreCoordinator, and returns the EODatabaseContext.


setContextClassToRegister

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

Sets to contextClass the "contextClassToRegister." For more discussion of this topic, see the method description for contextClassToRegister.


Instance Methods


adaptorContext

public EOAdaptorContext adaptorContext()

Returns the EOAdaptorContext used by the EODatabaseContext for communication with the database server.


arrayFaultWithSourceGlobalID

public NSArray arrayFaultWithSourceGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID, java.lang.String name, com.apple.yellow.eocontrol.EOEditingContext anEditingContext);

Overrides the inherited implementation to create a to-many fault for anEditingContext. name must correspond to an EORelationship in the EOEntity for the specified globalID.

See also: faultForGlobalID


availableChannel

public EODatabaseChannel availableChannel()

Returns an EODatabaseChannel that's registered with the receiver and that isn't busy. If the method can't find a channel that meets these criteria, it posts an EODatabaseChannelNeededNotification in the hopes that someone will provide a new channel. After posting the notification, the receiver checks its list of channels again. If there are still no available channels, the receiver creates an EODatabaseChannel itself. However, if the list is not empty and there are no available channels, the method returns null.

See also: registerChannel, registeredChannels, unregisterChannel


batchFetchRelationship

public void batchFetchRelationship(EORelationship relationship, NSArray objects, com.apple.yellow.eocontrol.EOEditingContext anEditingContext)

Clear all the faults for the relationship of anEditingContext's objects and performs a single, efficient, fetch (at most two fetches, if the relationship is many-to-many). This method provides a way to fetch the same relationship for multiple objects. For example, given an array of Employee objects, this method can fetch all of their departments with one round trip to the server, rather than asking the server for each of the employee's departments individually.


commitChanges

public void commitChanges()

Overrides the inherited implementation to instruct the adaptor to commit the transaction. If the commit is successful, any primary and foreign key changes are written back to the saved objects, database locks are released, and an EOObjectsChangedInStoreNotification (defined in com.apple.yellow.eocontrol.EOObjectStore) is posted describing the committed changes. Raises an exception if the adaptor is unable to commit the transaction; the error message indicates the nature of the problem. You should never need to invoke this method directly.

See also: performChanges, rollbackChanges


coordinator

public com.apple.yellow.eocontrol.EOObjectStoreCoordinator coordinator()

Returns the receiver's com.apple.yellow.eocontrol.EOObjectStoreCoordinator or null if there is none. This method is only valid during a save operation.


database

public EODatabase database()

Returns the receiver's EODatabase.

See also: "Constructors"


delegate

public java.lang.Object delegate()

Returns the receiver's delegate.

See also: setDelegate


faultForGlobalID

public java.lang.Object faultForGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID, com.apple.yellow.eocontrol.EOEditingContext anEditingContext)

Overrides the inherited implementation to create a to-one fault for the object identified by globalID and register it in anEditingContext.

See also: arrayFaultWithSourceGlobalID


faultForRawRow

public java.lang.Object faultForRawRow(java.lang.Object row,
java.lang.String entityName,
com.apple.yellow.eocontrol.EOEditingContext editingContext)

Returns a fault for a raw row. row is the raw data, typically in the form of an NSDictionary. entityName is the name of the appropriate entity for the EO you want to create (as a fault). editingContext is the EOEditingContext in which to create the fault


forgetAllLocks

public void forgetAllLocks()

Clears all of the receiver's locks. Doesn't cause the locks to be forgotten in the server, only in the receiver. This method is useful when something has happened to cause the server to forget the locks and the receiver needs to be synced up. This method is invoked whenever a transaction is committed or rolled back.

See also: registerLockedObjectWithGlobalID, isObjectLockedWithGlobalID, forgetLocksForObjectsWithGlobalIDs, lockObjectWithGlobalID, lockObject (com.apple.yellow.eocontrol.EOEditingContext)


forgetLocksForObjectsWithGlobalIDs

public void forgetLocksForObjectsWithGlobalIDs(NSArray anImmutableVector)

Clears the locks made for the enterprise objects identified by each of the com.apple.yellow.eocontrol.EOGlobalIDs in globalIDs. Doesn't cause the locks to be forgotten in the server, only in the receiver.

See also: registerLockedObjectWithGlobalID, isObjectLockedWithGlobalID, forgetAllLocks, lockObjectWithGlobalID, lockObject (com.apple.yellow.eocontrol.EOEditingContext)


forgetSnapshotForGlobalID

public void forgetSnapshotForGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID)

Deletes the snapshot made for the enterprise object identified by globalID.

See also: recordSnapshotForGlobalID, localSnapshotForGlobalID, recordSnapshots, snapshotForGlobalID, forgetSnapshotsForGlobalIDs


forgetSnapshotsForGlobalIDs

public void forgetSnapshotsForGlobalIDs(NSArray globalIDs)

Deletes the snapshots made for the enterprise objects identified by globalIDs, an array of com.apple.yellow.eocontrol.EOGlobalID objects.

See also: recordSnapshotForGlobalID, localSnapshotForGlobalID, recordSnapshots, snapshotForGlobalID


handlesFetchSpecification

public boolean handlesFetchSpecification(
com.apple.yellow.eocontrol.EOFetchSpecification fetchSpecification)

Overrides the inherited implementation to return true if the receiver is responsible for fetching the objects described by the entity name in fetchSpecification.

See also: ownsObject, ownsGlobalID


hasBusyChannels

public boolean hasBusyChannels()

Returns true if the receiver's EOAdaptorContext has channels that have outstanding operations (that is, have a fetch in progress), false otherwise.


initializeObject

public void initializeObject(java.lang.Object object, com.apple.yellow.eocontrol.EOGlobalID globalID, com.apple.yellow.eocontrol.EOEditingContext anEditingContext);

Overrides the inherited implementation initialize object for anEditingContext by filling it with properties based on row data fetched from the adaptor. The snapshot for globalID is looked up and those attributes in the snapshot that are marked as class properties in the EOEntity are assigned to object. For relationship class properties, faults are constructed and assigned to the object.


invalidateAllObjects

public void invalidateAllObjects();

Overrides the inherited implementation to discard all snapshots in the receiver's EODatabase, forget all locks, and post an EOInvalidatedAllObjectsInStoreNotification, as well as an EOObjectsChangedInStoreNotification with the invalidated global IDs in the userInfo dictionary. Both of these notifications are defined in com.apple.yellow.eocontrol.EOObjectStore. This method works by invoking invalidateObjectsWithGlobalIDs for all of the snapshots in the receiver's EODatabase.


invalidateObjectsWithGlobalIDs

public void invalidateObjectsWithGlobalIDs(NSArray globalIDs)

Overrides the inherited implementation to discard the snapshots for the objects identified by the com.apple.yellow.eocontrol.EOGlobalIDs in globalIDs and broadcasts an EOObjectsChangedInStoreNotification (defined in com.apple.yellow.eocontrol.EOObjectStore), which causes the com.apple.yellow.eocontrol.EOEditingContext containing objects fetched from the receiver to refault those objects. The result is that these objects will be refetched from the database the next time they're accessed.


isObjectLockedWithGlobalID

public boolean isObjectLockedWithGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID)

Returns true if the enterprise object identified by globalID is locked, false otherwise.

See also: registerLockedObjectWithGlobalID, forgetAllLocks, forgetLocksForObjectsWithGlobalIDs, lockObjectWithGlobalID, lockObject (com.apple.yellow.eocontrol.EOEditingContext)

isObjectLockedWithGlobalID public boolean isObjectLockedWithGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID,
com.apple.yellow.eocontrol.EOEditingContext anEditingContext)

Overrides the EOObjectStore method isObjectLockedWithGlobalID:editingContext: to return true if the database row corresponding to globalID has been locked in an open transaction held by the receiver.

See also: registerLockedObjectWithGlobalID, isObjectLockedWithGlobalID, forgetAllLocks, forgetLocksForObjectsWithGlobalIDs, lockObjectWithGlobalID,
lockObject (EOEditingContext)


localSnapshotForGlobalID

public NSDictionary localSnapshotForGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID)

Returns the snapshot for the object identified by globalID, if there is one; else returns null. Only searches locally (in the transaction scope), not in the EODatabase.

See also: recordSnapshotForGlobalID, forgetSnapshotForGlobalID, recordSnapshots, snapshotForGlobalID


localSnapshotForSourceGlobalID

public NSArray localSnapshotForSourceGlobalID(
com.apple.yellow.eocontrol.EOGlobalID globalID,
java.lang.String name)

Returns an array that is the snapshot for the objects at the destination of the to-many relationship named name, which is a property of the object identified by globalID. The returned array contains the globalIDs of the destination objects. If there is no snapshot, returns null. Only searches locally (in the transaction scope), not in the EODatabase.

See also: recordSnapshotForSourceGlobalID, snapshotForSourceGlobalID


lock

public void lock()

Used internally to protect access to the receiver in a multi-threaded environment. Do not confuse this with any methods which work with the database locking mechanism.

See also: unlock


lockObjectWithGlobalID

public void lockObjectWithGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID, com.apple.yellow.eocontrol.EOEditingContext anEditingContext);

Overrides the inherited implementation to attempt to lock the database row corresponding to globalID in the underlying database server, on behalf of anEditingContext. If a transaction is not already open at the time of the lock request, the transaction is begun and is held open until either commitChanges or invalidateAllObjects is invoked. At that point all locks are released. Raises an exception if unable to obtain the lock.

See also: registerLockedObjectWithGlobalID, isObjectLockedWithGlobalID, forgetAllLocks, forgetLocksForObjectsWithGlobalIDs, lockObject (com.apple.yellow.eocontrol.EOEditingContext)


objectsForSourceGlobalID

public NSArray objectsForSourceGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID, java.lang.String name, com.apple.yellow.eocontrol.EOEditingContext anEditingContext);

Overrides the inherited implementation to service a to-many fault. The snapshot for the source object identified by globalID is located and the EORelationship named name is used to construct a qualifier from that snapshot. This qualifier is then used to fetch the requested objects into anEditingContext using the method objectsWithFetchSpecification.


objectsWithFetchSpecification

public NSArray objectsWithFetchSpecification(com.apple.yellow.eocontrol.EOFetchSpecification fetchSpecification, com.apple.yellow.eocontrol.EOEditingContext anEditingContext);

Overrides the inherited implementation to fetch objects from an external store into anEditingContext. The receiver obtains an available EODatabaseChannel and issues a fetch with fetchSpecification. If one of these objects is already present in memory, by default this method doesn't overwrite its values with the new values from the database (you can change this behavior; see the setRefreshesRefetchedObjects method in the com.apple.yellow.eocontrol.EOFetchSpecification class specification).

You can fine-tune the fetching behavior by adding hints to fetchSpecification's hints dictionary. For this purpose, EODatabaseContext defines the following keys (java.lang.Strings):

Constant Corresponding value in the hints dictionary
EOCustomQueryExpressionHintKey A java.lang.String specifying raw SQL with which to perform the fetch. There is no way to pass down parameters with this hint.
EOStoredProcedureNameHintKey A java.lang.String specifying a name for a stored procedure in the model that should be used rather than building the SQL statement. The stored procedure must query the the exact same attributes in the same order as EOF would query if generating the SELECT expression dynamically. If this key is supplied, other aspects of the EOFetchSpecification such as isDeep, qualifier, and sortOrderings are ignored (in that sense, this key is more of a directive than a hint). There is no way to pass down parameters with this hint.

The class description contains additional information on using these hints. See "Using a Custom Query."

You can also use this method to implement "on-demand" locking by using a fetchSpecification that includes locking. For more discussion of this subject, see "Updating And Locking Strategies" in the class description.

Raises an exception if an error occurs; the error message indicates the nature of the problem.

See also: objectsWithFetchSpecification (com.apple.yellow.eocontrol.EOEditingContext)


ownsGlobalID

public boolean ownsGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID)

Overrides the inherited implementation to return true if the receiver is responsible for fetching and saving the object identified by globalID, false otherwise. The receiver is determined to be responsible if globalID is a subclass of com.apple.yellow.eocontrol.EOKeyGlobalID and globalID has an entity from one of the receiver's EODatabase's EOModels.

See also: handlesFetchSpecification, ownsObject


ownsObject

public boolean ownsObject(java.lang.Object object)

Overrides the inherited implementation to return true if the receiver is responsible for fetching and saving object, false otherwise. The receiver is determined to be responsible if the entity corresponding to object is in one of the receiver's EODatabase's EOModels.

See also: ownsGlobalID, handlesFetchSpecification


performChanges

public void performChanges()

Overrides the inherited implementation to construct EOAdaptorOperations from the EODatabaseOperations produced during recordChangesInEditingContext and recordUpdateForObject. Invokes the delegate method databaseContextWillOrderAdaptorOperationsFromDatabaseOperations to give the delegate an opportunity to construct alternative EOAdaptorOperations from the EODatabaseOperations. Then invokes the delegate method databaseContext:willPerformAdaptorOperations:adaptorChannel: to let the delegate substitute its own array of EOAdaptorOperations. Gives the EOAdaptorOperations to an available EOAdaptorChannel for execution. If the save succeeds, updates the snapshots in the receiver to reflect the new state of the server. You should never need to invoke this method directly.

This method raises an exception if the adaptor is unable to perform the operations.

See also: commitChanges, rollbackChanges


prepareForSaveWithCoordinator

public void prepareForSaveWithCoordinator(com.apple.yellow.eocontrol.EOObjectStoreCoordinator anObjectStoreCoordinator, com.apple.yellow.eocontrol.EOEditingContext anEditingContext)

Overrides the inherited implementation to do whatever is necessary to prepare to save changes. If needed, generates primary keys for any new objects in anEditingContext that are owned by the receiver. This method is invoked before the object graph is analyzed and foreign key assignments are performed. You should never need to invoke this method directly.


recordChangesInEditingContext

public void recordChangesInEditingContext()

Overrides the inherited implementation to construct a list of EODatabaseOperations for all changes to objects in the com.apple.yellow.eocontrol.EOEditingContext that are owned by the receiver. Forwards any relationship changes discovered but not owned by the receiver to the com.apple.yellow.eocontrol.EOObjectStoreCoordinator. This method is typically invoked in the course of an com.apple.yellow.eocontrol.EOObjectStoreCoordinator saving changes through its saveChangesInEditingContext method. It's invoked after prepareForSaveWithCoordinator and before performChanges. You should never need to invoke this method directly.


recordSnapshotForGlobalID

public void recordSnapshotForGlobalID(NSDictionary aSnapshot, com.apple.yellow.eocontrol.EOGlobalID aGlobalID)

Records aSnapshot under globalID. This method only records snapshots locally (in the transaction scope). If you want to record snapshots globally, use the corresponding EODatabase method.

See also: forgetSnapshotForGlobalID, localSnapshotForGlobalID, recordSnapshots, snapshotForGlobalID


recordSnapshotForSourceGlobalID

public void recordSnapshotForSourceGlobalID(NSArray globalIDs,
com.apple.yellow.eocontrol.EOGlobalID globalID,
java.lang.String name)

For the object identified by globalID, records an NSArray of globalIDs for the to-many relationship named name. These globalIDs identify the objects at the destination of the relationship. This method only records snapshots locally (in the transaction scope). If you want to record snapshots globally, use the corresponding EODatabase method.

See also: snapshotForSourceGlobalID, localSnapshotForSourceGlobalID, recordToManySnapshots


recordSnapshots

public void recordSnapshots(NSDictionary snapshots)

Records the objects in snapshots, a dictionary of snapshots. The snapshots; keys are GlobalIDs and its values are the corresponding snapshots represented as NSDicationaries. This method only records snapshots locally (in the transaction scope). If you want to record snapshots globally, use the corresponding EODatabase method.

See also: recordSnapshotForGlobalID, localSnapshotForGlobalID, forgetSnapshotForGlobalID, snapshotForGlobalID


recordToManySnapshots

public void recordToManySnapshots(NSDictionary snapshots)

Records the objects in snapshots. snapshots should be an NSDictionary of NSDictionaries, in which the top-level dictionary has as its key the globaID of the enterprise object for which to-many relationships are being recorded. The key's value is a dictionary whose keys are the names of the Enterprise Object's to-many relationships. Each of these keys in turn has as its value an array of globalIDs that identify the objects at the destination of the relationship.

This method only records snapshots locally (in the transaction scope). If you want to record snapshots globally, use the corresponding EODatabase method.

See also: recordSnapshotForSourceGlobalID, snapshotForSourceGlobalID, localSnapshotForSourceGlobalID


recordUpdateForObject

public void recordUpdateForObject(java.lang.Object object, NSDictionary changes)

Overrides the inherited implementation to communicate to the receiver that changes from another com.apple.yellow.eocontrol.EOCooperatingObjectStore (through the com.apple.yellow.eocontrol.EOObjectStoreCoordinator) need to be made to an object in the receiver. For example, an insert of an object in a relationship property might require changing a foreign key property in an object owned by another cooperating store. This method can be invoked any time after prepareForSaveWithCoordinator and before performChanges.


refaultObject

public void refaultObject(java.lang.Object object, com.apple.yellow.eocontrol.EOGlobalID globalID, com.apple.yellow.eocontrol.EOEditingContext anEditingContext);

Overrides the inherited implementation to refault the enterprise object object identified by globalID in anEditingContext. Newly-inserted objects should not be refaulted, since they can't be refetched from the external store. If you attempt to do this, an exception will be raised. Don't refault to-many relationship arrays, just recreate them.

This method should be used with caution since refaulting an object doesn't remove the object snapshot from the undo stack, after which the object snapshot may not refer to the proper object..


registerChannel

public void registerChannel(EODatabaseChannel channel)

Registers channel, which means that it adds it to the pool of available channels used to service fetch and fault requests. You use this method if you need to perform more than one fetch simultaneously.

See also: availableChannel, registeredChannels, unregisterChannel


registeredChannels

public NSArray registeredChannels()

Returns all of the EODatabaseChannels that have been registered for use with the receiver.

See also: registerChannel, availableChannel, unregisterChannel


registerLockedObjectWithGlobalID

public void registerLockedObjectWithGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID)

Registers as a locked object the enterprise object identified by globalID. This method is used internally to keep track of objects corresponding to rows that are locked in the database.

See also: forgetAllLocks, isObjectLockedWithGlobalID, forgetLocksForObjectsWithGlobalIDs, lockObjectWithGlobalID, lockObject (com.apple.yellow.eocontrol.EOEditingContext)


rollbackChanges

public void rollbackChanges()

Overrides the inherited implementation to instruct the adaptor to roll back the transaction. Rolls back any changed snapshots, and releases all locks.

See also: performChanges, commitChanges


saveChangesInEditingContext

public void saveChangesInEditingContext(com.apple.yellow.eocontrol.EOEditingContext anEditingContext);

Overrides the inherited implementation to save the changes made in anEditingContext. This message is sent by an com.apple.yellow.eocontrol.EOEditingContext to its com.apple.yellow.eocontrol.EOObjectStore to commit changes. Normally an editing context doesn't send this message to an EODatabaseContext, but to an com.apple.yellow.eocontrol.EOObjectStoreCoordinator. Raises an exception if an error occurs; the error message indicates the nature of the problem.


setDelegate

public void setDelegate(java.lang.Object delegate)

Sets the receiver's delegate to delegate, and propagates the delegate to all of the receiver's EODatabaseChannels. EODatabaseChannels share the delegate of their EODatabaseContext.

See also: delegate


setUpdateStrategy

public void setUpdateStrategy(int strategy)

Sets the update strategy used by the EODatabaseContext to strategy. See "Updating And Locking Strategies" in the class description for information on the update strategies:

Raises an exception if the receiver has any transactions in progress or if you try to set strategy to EOUpdateWithPessimisticLocking and the receiver's EODatabase already has snapshots.

See also: updateStrategy


snapshotForGlobalID

public NSDictionary snapshotForGlobalID(com.apple.yellow.eocontrol.EOGlobalID globalID)

Returns the snapshot for the object identified by globalID, if there is one; else returns null. Searches first locally (in the transaction scope) and then in the EODatabase.

See also: recordSnapshotForGlobalID, localSnapshotForGlobalID, forgetSnapshotForGlobalID, recordSnapshots


snapshotForSourceGlobalID

public NSArray snapshotForSourceGlobalID(
com.apple.yellow.eocontrol.EOGlobalID globalID,
java.lang.String name)

Returns a snapshot that consists of an array of global IDs. These global IDs identify the objects at the destination of the to-many relationship named name, which is a property of the object identified by globalID. If there is no snapshot, returns null.

See also: recordSnapshotForSourceGlobalID, localSnapshotForSourceGlobalID, recordToManySnapshots


unlock

public void unlock()

Used internally to release the lock that protects access to the receiver in a multi-threaded environment.

See also: lock


unregisterChannel

public void unregisterChannel(EODatabaseChannel channel)

Unregisters the EODatabaseChannel channel, which means that it removes it from the pool of available channels used for database communication (for example, to service fetch and fault requests).

See also: registerChannel, registeredChannels, availableChannel


updateStrategy

public int updateStrategy()

Returns the update strategy used by the receiver, one of:

The default strategy is EOUpdateWithOptimisticLocking. See the class description for information on update strategies.

See also: setUpdateStrategy


valuesForKeys

public NSDictionary valuesForKeys(NSArray keys, java.lang.Object object)

Overrides the inherited implementation to return values for the specified keys from the snapshot of object. The returned values are used primarily by another EODatabaseContext to extract foreign key properties for objects owned by the receiver.


Notifications


EODatabaseChannelNeededNotification

This notification is broadcast whenever an EODatabaseContext is asked to perform an object store operation and it doesn't have an available EODatabaseChannel. Subscribers can create a new channel and add it to the EODatabaseContext at this time.

Notification Object The EODatabaseContext.
userInfo Dictionary None.





Copyright © 1998, Apple Computer, Inc. All rights reserved.