Inherits From:
Inherits From:
com.apple.yellow.eoaccess
Class Description
An EODatabase object represents a single database server. It contains an EOAdaptor which is capable of communicating with the server, a list of EOModels that describe the server's schema, a list of EODatabaseContexts that are connected to the server, and a set of snapshots representing the state of all objects stored in the server.
For more information, see "More about EODatabase".
next.eo.EODatabase
(EOAdaptor anAdaptor)
public next.eo.EODatabase
(EOModel aModel)
Creates and returns a new EODatabase object. If anAdaptor is provided, it specifies the new EODatabase's adaptor. If aModel is provided, the constructor creates an instance of the EOAdaptor named in aModel and assigns that EOAdaptor object as the new EODatabase's adaptor.
Typically, you don't need to programmatically create EODatabase objects. Rather, they are created automatically by the control layer. See the class description for more information. If you do need to create an EODatabase programmatically, you should never associate more than one EODatabase with a given EOAdaptor. In general, provide aModel instead of anAdaptor, which automatically selects the adaptor.
See also:
addModel
, adaptor
, adaptorName
(EOModel)
Instance Methods
adaptor
public EOAdaptor adaptor
()
Returns the EOAdaptor used by the receiver for communication with the database server. Your application can interact directly with the EOAdaptor, but should avoid altering its state (for example, by starting a transaction with one of its adaptor contexts).
See also: "Constructors"
addModel
public void addModel
(EOModel aModel)
Adds aModel to the receiver's list of EOModels. This allows EODatabases to load entities and their properties only as they're needed, by dividing them among separate EOModels. aModel must use the same EOAdaptor as the receiver and use the same connection dictionary as the receiver's other EOModels.
See also:
addModelIfCompatible
, models
, removeModel
addModelIfCompatible
public boolean addModelIfCompatible
(EOModel aModel)
Adds aModel to the receiver's list of EOModels, checking first to see whether it's compatible with those other EOModels. Returns true
if aModel is already in the list or if it's successfully added. Returns false
if aModel's adaptor name differs from that of the receivers or if the receiver's adaptor
returns false
to a canServiceModel:
message.
See also:
addModel
, models
, removeModel
entityForObject
public EOEntity entityForObject
(java.lang.Object anObject)
Returns the EOEntity from one of the receiver's Models that's mapped to anObject, or null
if there is no such EOEntity. This method works by sending entityForObject:
messages to each of the receiver's EOModels and returning the first one found.
See also:
entityNamed
entityNamed
public EOEntity entityNamed
(java.lang.String entityName)
Returns the EOEntity from one of the receiver's Models that's named entityName, or null
if there is no such EOEntity. This method works by sending entityNamed:
messages to each of the receiver's EOModels and returning the first one found.
See also:
entityForObject
forgetAllSnapshots
public void forgetAllSnapshots
Clears all of the receiver's snapshots and posts an ObjectsChangedInStoreNotification (defined in the EOControl framework's EOObjectStore class) describing the invalidated object. For a description of snapshots and their role in an application, see the class description.
See also:
forgetSnapshotForGlobalID
, forgetSnapshotsForGlobalIDs
, recordSnapshot:forGlobalID:
,
recordSnapshots
, recordSnapshotForSourceGlobalIDpublic void
recordSnapshotForSourceGlobalID(NSArray globalIDs,
com.apple.yellow.eocontrol.EOGlobalID globalID, java.lang.String name)
,
recordToManySnapshotspublic void recordToManySnapshots(NSDictionary snapshots)
forgetSnapshotForGlobalID
public void forgetSnapshotForGlobalID
(com.apple.yellow.eocontrol.EOGlobalID globalID)
Clears the snapshot made for the enterprise object identified by globalID and posts an ObjectsChangedInStoreNotification (defined in the EOControl framework's EOObjectStore class) describing the invalidated object. For a description of snapshots and their role in an application, see the class description.
See also:
forgetSnapshotsForGlobalIDs
, forgetAllSnapshots
, recordSnapshot:forGlobalID:
forgetSnapshotsForGlobalIDs
public void forgetSnapshotsForGlobalIDs
(NSArray globalIDs)
Clears the snapshots made for the enterprise objects identified by each of the EOGlobalIDs in globalIDs and posts an ObjectsChangedInStoreNotification (defined in the EOControl framework's EOObjectStore class) describing the invalidated objects. For a description of snapshots and their role in an application, see the class description.
See also:
forgetSnapshotForGlobalID
, forgetAllSnapshots
, recordSnapshots
invalidateResultCache
public void invalidateResultCache
Invalidates the receiver's result cache. See the class description for more discussion of this topic.
See also:
invalidateResultCacheForEntityNamed
, resultCacheForEntityNamed
invalidateResultCacheForEntityNamed
public void invalidateResultCacheForEntityNamed
(java.lang.String entityName)
Invalidates the result cache containing an array of globalIDs for the objects associated with the entity entityName. See the class description for more discussion of this topic.
See also:
invalidateResultCache
, resultCacheForEntityNamed
models
public NSArray models
()
Returns the receiver's EOModels.
See also:
"Constructors", addModel
, addModelIfCompatible
, removeModel
recordSnapshot:forGlobalID:
public void recordSnapshotForGlobalID
(NSDictionary aSnapshot, com.apple.yellow.eocontrol.EOGlobalID globalID)
Records aSnapshot under globalID. For a description of snapshots and their role in an application, see the class description.
See also:
- globalIDForRow:
(EOEntity), recordSnapshots
, forgetSnapshotForGlobalID
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. For a description of snapshots and their role in an application, see the class description.
See also:
recordSnapshot:forGlobalID:
, recordSnapshots
, recordSnapshot:forGlobalID:
,
snapshotForSourceGlobalIDpublic NSArray snapshotForSourceGlobalID(
com.apple.yellow.eocontrol.EOGlobalID globalID, java.lang.String name)
recordSnapshots
public void recordSnapshots
(NSDictionary snapshots)
Records the snapshots in snapshots. snapshots is a dictionary whose keys are EOGlobalIDs and whose values are the snapshots for those global IDs. For a description of snapshots and their role in an application, see the class description.
See also:
recordSnapshot:forGlobalID:
, forgetSnapshotsForGlobalIDs
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. For a description of snapshots and their role in an application, see the class description.
See also:
recordSnapshotForSourceGlobalIDpublic void
recordSnapshotForSourceGlobalID(NSArray globalIDs,
com.apple.yellow.eocontrol.EOGlobalID globalID, java.lang.String name)
, recordSnapshot:
forGlobalID:
, snapshotForSourceGlobalIDpublic NSArray snapshotForSourceGlobalID(
com.apple.yellow.eocontrol.EOGlobalID globalID, java.lang.String name)
registerContext
public void registerContext
(EODatabaseContext aContext)
Records aContext as one of the receiver's EODatabaseContexts. The receiver must have been specified as aContext's EODatabase in the EODatabaseContext constructor (which invokes this method automatically). You should never need to invoke this method directly.
See also:
unregisterContext
, registeredContexts
registeredContexts
public NSArray registeredContexts
()
Returns all the EODatabaseContexts that have been registered with the receiver, generally all the database contexts that were created with the receiver as their EODatabase object.
See also:
registerContext
, unregisterContext
removeModel
public void removeModel
(EOModel aModel)
Removes aModel from the receiver's list of EOModels. Throws an exception if aModel isn't one of the receiver's models.
See also:
addModel
, addModelIfCompatible
, models
resultCacheForEntityNamed
public NSArray resultCacheForEntityNamed
(java.lang.String entityName)
Returns an array containing the globalIDs of the objects associated with entityName. See the class description for more discussion of this topic.
See also:
invalidateResultCache
, invalidateResultCacheForEntityNamed
setResultCacheForEntityWithName
public void setResultCacheForEntityWithName
(NSArray cache, java.lang.String entityName)
Updates the receiver's cache for entityName with cache, an array of EOGlobalID objects, for all the enterprise objects associated with the EOEntity named entityName. This method is invoked automatically, and you should never need to invoke it directly. For more information on this topic, see the class description.
See also:
invalidateResultCache
, invalidateResultCacheForEntityNamed
,
resultCacheForEntityNamed
snapshotForGlobalID
public NSDictionary snapshotForGlobalID
(com.apple.yellow.eocontrol.EOGlobalID globalID)
Returns the snapshot associated with globalID if there is one; otherwise returns null
. For a description of snapshots and their role in an application, see the class description.
See also:
recordSnapshot:forGlobalID:
, forgetSnapshotForGlobalID
snapshotForSourceGlobalID public NSArray snapshotForSourceGlobalID
(
com.apple.yellow.eocontrol.EOGlobalID globalID,
java.lang.String name)
Returns a snapshot that consists of an array of globalIDs. These globalIDs 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
. For a description of snapshots and their role in an application, see the class description.
snapshots
public NSDictionary snapshots
()
Returns all of the receiver's snapshots, stored in a dictionary under their EOGlobalIDs.
See also:
recordSnapshotForSourceGlobalIDpublic void
recordSnapshotForSourceGlobalID(NSArray globalIDs,
com.apple.yellow.eocontrol.EOGlobalID globalID, java.lang.String name)
,
recordToManySnapshotspublic void recordToManySnapshots(NSDictionary snapshots)
unregisterContext
public void unregisterContext
(EODatabaseContext aContext)
Removes aContext as one of the receiver's EODatabaseContexts. An EODatabaseContext automatically invokes this method when it's finalized; you should never need to invoke it directly.
See also:
registerContext
, registeredContexts