|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.eocontrol.EOObjectStore
EOObjectStore is the abstract class that defines the API for an "intelligent" repository of objects, the control layer's object storage abstraction. An object store is responsible for constructing and registering objects, servicing object faults, and saving changes made to objects. For more information on the object storage abstraction, see "Object Storage Abstraction" in the introduction to the EOControl Framework.
EOEditingContext is the principal EOObjectStore subclass and is used for managing objects in memory. In fact, the primary purpose of the EOObjectStore class is to define an API for servicing editing contexts, not to define a completely general API. Other subclasses of EOObjectStore are:
A subclass of EOObjectStore must implement all of its methods. The default implementations simply throw exceptions.
EOCooperatingObjectStore
,
EOObjectStoreCoordinator
,
EODatabaseContext
Field Summary | |
static String |
DeletedKey
|
static String |
InsertedKey
|
static String |
InvalidatedAllObjectsInStoreNotification
|
static String |
InvalidatedKey
|
static String |
ObjectsChangedInStoreNotification
|
static String |
UpdatedKey
|
Fields inherited from interface com.webobjects.foundation.NSLocking |
OneCentury, OneDay, OneHour, OneMinute, OneSecond, OneWeek, OneYear |
Constructor Summary | |
EOObjectStore()
|
Method Summary | |
abstract NSArray |
arrayFaultWithSourceGlobalID(EOGlobalID globalID,
String relationshipName,
EOEditingContext context)
Implemented by subclasses to return the destination objects for a to-many relationship, whether as real instances or as faults (empty enterprise objects). |
void |
dispose()
Invoked when the receiver should prepare itself for destruction. |
abstract void |
editingContextDidForgetObjectWithGlobalID(EOEditingContext context,
EOGlobalID gid)
Invoked to inform the object store that it can stop keeping data about an object it passed to a child. |
abstract EOEnterpriseObject |
faultForGlobalID(EOGlobalID globalID,
EOEditingContext context)
If the receiver is context and the object associated with
globalID is already registered in context , this method
returns that object. |
abstract EOEnterpriseObject |
faultForRawRow(NSDictionary row,
String entityName,
EOEditingContext context)
Returns a fault for the enterprise object corresponding to row, which is a dictionary of values containing at least the primary key of the corresponding enterprise object. |
abstract void |
initializeObject(EOEnterpriseObject object,
EOGlobalID globalID,
EOEditingContext context)
Implemented by subclasses to set object's properties, as obtained for globalID . |
abstract void |
invalidateAllObjects()
Discards the values of all objects held by the receiver and turns them into faults (empty enterprise objects). |
abstract void |
invalidateObjectsWithGlobalIDs(NSArray globalIDs)
Signals that the objects identified by globalIDs
should no longer be considered valid and that they should be turned
into faults (empty enterprise objects). |
Object |
invokeRemoteMethod(EOEditingContext context,
EOGlobalID gid,
String methodName,
Class[] argumentTypes,
Object[] arguments)
Invokes methodName on the enterprise object identified by gid
in context , using arguments. |
abstract boolean |
isObjectLockedWithGlobalID(EOGlobalID globalID,
EOEditingContext context)
Returns true if the object identified by globalID is locked, false
if it isn't. |
abstract void |
lock()
This method is used to protect access to the receiver from concurrent operations by multiple threads. |
abstract void |
lockObjectWithGlobalID(EOGlobalID globalID,
EOEditingContext context)
Locks the object identified by globalID . |
abstract NSArray |
objectsForSourceGlobalID(EOGlobalID globalID,
String relationshipName,
EOEditingContext context)
Returns the destination objects for a to-many relationship. |
abstract NSArray |
objectsWithFetchSpecification(EOFetchSpecification fetchSpecification,
EOEditingContext context)
Fetches objects from an external store according to the criteria specified by fetchSpecification and returns them in an array for
inclusion in context . |
abstract void |
refaultObject(EOEnterpriseObject object,
EOGlobalID globalID,
EOEditingContext context)
Turns object into a fault (an empty enterprise object), identified by globalID in context . |
abstract void |
saveChangesInEditingContext(EOEditingContext context)
Saves any changes in context to the receiver's repository. |
abstract void |
unlock()
This method is used to protect access to the receiver from concurrent operations by multiple threads. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String DeletedKey
public static final String InsertedKey
public static final String InvalidatedAllObjectsInStoreNotification
public static final String InvalidatedKey
public static final String ObjectsChangedInStoreNotification
public static final String UpdatedKey
Constructor Detail |
public EOObjectStore()
Method Detail |
public abstract NSArray arrayFaultWithSourceGlobalID(EOGlobalID globalID, String relationshipName, EOEditingContext context)
globalID
identifies the source object for the
relationship (which doesn't necessarily exist in memory yet),
and relationshipName
is the name of the relationship. The object
identified by globalID
and the destination objects for the relationship
all belong to context
.
If you implement this method to return a fault, you must define
an EOFaultHandler subclass that stores globalID
and relationshipName
,
using them to fetch the objects in a later objectsForSourceGlobalID
message and that turns the fault into an array containing those
objects. See the EOFaultHandler class specification for more information
on faults.
See the EOEditingContext and EODatabaseContext (EOAccess) class
specifications for more information on how this method works in
concrete subclasses.globalID
- EOGlobalID of a source object with a to-many relationshiprelationshipName
- name of the to-many relationship from which to generate the array
of destination objectscontext
- the EOEditingContext that will contain the source and destination
objectsrelationshipName
from
the source object identified by globalID
faultForGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EOEditingContext.arrayFaultWithSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.arrayFaultWithSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
public void dispose()
NSDisposable
dispose
in interface NSDisposable
public abstract void editingContextDidForgetObjectWithGlobalID(EOEditingContext context, EOGlobalID gid)
context
- the EOEditingContext that has stopped storing data about
the object identified by gid
gid
- the EOGlobalID of the object that was forgotten by context
EOEditingContext.editingContextDidForgetObjectWithGlobalID(com.webobjects.eocontrol.EOEditingContext, com.webobjects.eocontrol.EOGlobalID)
,
EODatabaseContext.editingContextDidForgetObjectWithGlobalID(com.webobjects.eocontrol.EOEditingContext, com.webobjects.eocontrol.EOGlobalID)
public abstract EOEnterpriseObject faultForGlobalID(EOGlobalID globalID, EOEditingContext context)
context
and the object associated with
globalID
is already registered in context
, this method
returns that object. Otherwise it creates a to-one fault, registers
it in context
, and returns the fault. This method is always
directed first at context
, which forwards the message to
its parent object store if needed to create a fault.
If you implement this method to return a fault (an empty enterprise
object), you must define an EOFaultHandler subclass that stores
globalID, uses it to fetch the object's data, and initializes
the object with EOObjectStore's initializeObject
method. See the EOFaultHandler
class specification for more information on faults.
See the EOEditingContext and EODatabaseContext (EOAccess) class
specifications for more information on how this method works in
concrete subclasses.globalID
- the EOGlobalID of the object to returncontext
- the EOEditingContext that holds the object
identified by globalIDEOEditingContext.faultForGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.faultForGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
arrayFaultWithSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
,
EOEditingContext.recordObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID)
,
EOFaultHandler
public abstract EOEnterpriseObject faultForRawRow(NSDictionary row, String entityName, EOEditingContext context)
row
- dictionary containing at least the the primary key of the corresponding rowentityName
- the name of the entity to create an enterprise object fromcontext
- the EOEditingContext that either contains the object from row
,
or will contain the object's faultrow
EOEditingContext.faultForRawRow(com.webobjects.foundation.NSDictionary, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.faultForRawRow(com.webobjects.foundation.NSDictionary, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
public abstract void initializeObject(EOEnterpriseObject object, EOGlobalID globalID, EOEditingContext context)
globalID
. This method is typically invoked after object
has
been created using EOClassDescription's createInstanceWithEditingContext
or using EOGenericRecord's or EOCustomObject's constructors.
This method is also invoked after a fault has been fired.object
- the EOEnterpriseObject to set the properties ofglobalID
- the EOGlobalID that identifies the set of properties to set in objectcontext
- the EOEditingContext that contains the objectEOEnterpriseObject.awakeFromInsertion(com.webobjects.eocontrol.EOEditingContext)
,
EOEnterpriseObject.awakeFromFetch(com.webobjects.eocontrol.EOEditingContext)
,
EOEditingContext.initializeObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
public abstract void invalidateAllObjects()
InvalidatedAllObjectsInStoreNotification
.invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray)
,
refaultObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EOEditingContext.invalidateAllObjects()
,
EODatabaseContext.invalidateAllObjects()
public abstract void invalidateObjectsWithGlobalIDs(NSArray globalIDs)
globalIDs
should no longer be considered valid and that they should be turned
into faults (empty enterprise objects). This causes data for each
object to be refetched the next time it's accessed. Any child
object stores are also notified that the objects are no longer valid.globalIDs
- array of EOGlobalIDs that identify objects to invalidateinvalidateAllObjects()
,
refaultObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EOEditingContext.invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray)
,
EODatabaseContext.invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray)
public Object invokeRemoteMethod(EOEditingContext context, EOGlobalID gid, String methodName, Class[] argumentTypes, Object[] arguments)
methodName
on the enterprise object identified by gid
in context
, using arguments. To pass an enterprise object
as an argument, use its global ID. This method has the side effect
of saving all the changes from the editing context all the way down
to the editing context in the server session.context
- the container of the enterprise object to invoke
the method ongid
- the EOGlobalID of the enterprise object to invoke
the method onmethodName
- the name of the method to invokeargumentTypes
- language array of Class objects defining the types
of arguments to methodName
arguments
- language array of objects to pass to methodName
as argumentspublic abstract boolean isObjectLockedWithGlobalID(EOGlobalID globalID, EOEditingContext context)
true
if the object identified by globalID
is locked, false
if it isn't. See the EODatabaseContext (EOAccess) class specification
for more information on how this method works in concrete subclasses.globalID
- the EOGlobalID of the object to testeditingContext
- EOEditingContext to locate the object with globalID
intrue
if the object identified by globalID
in context
is locked, false
otherwiseEOEditingContext.isObjectLockedWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.isObjectLockedWithGlobalID(com.webobjects.eocontrol.EOGlobalID)
public abstract void lock()
lock
in interface NSLocking
unlock()
public abstract void lockObjectWithGlobalID(EOGlobalID globalID, EOEditingContext context)
globalID
. See the EODatabaseContext
(EOAccess) class specification for more information on how this
method works in concrete subclasses.globalID
- the EOGlobalID of the object to lockcontext
- the EOEditingContext that holds the object to lockEOEditingContext.lockObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.lockObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
public abstract NSArray objectsForSourceGlobalID(EOGlobalID globalID, String relationshipName, EOEditingContext context)
arrayFaultWithSourceGlobalID
.
globalID
identifies the source object for the relationship (which
doesn't necessarily exist in memory yet), and relationshipName
is the name of the relationship. The object identified by globalID
and the destination objects for the relationship all belong to context
.
See the EOEditingContext and EODatabaseContext (EOAccess) class
specifications for more information on how this method works in
concrete subclasses.globalID
- the EOGlobalID of the source objectrelationshipName
- the name of the to-many relationshipcontext
- the EOEditingContext that contains the source and destination objectsEOEditingContext.objectsForSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.objectsForSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
public abstract NSArray objectsWithFetchSpecification(EOFetchSpecification fetchSpecification, EOEditingContext context)
fetchSpecification
and returns them in an array for
inclusion in context
. If one of these objects is already
present in memory, this method doesn't overwrite its values with
the new values from the database. Throws an exception if an error
occurs.
See the EOEditingContext and EODatabaseContext (EOAccess) class
specifications for more information on how this method works in
concrete subclasses.fetchSpecification
- the EOFetchSpecification that speicifies which objects to fetchcontext
- container of objects fetched using fetchSpecificationEOEditingContext.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification, com.webobjects.eocontrol.EOEditingContext)
public abstract void refaultObject(EOEnterpriseObject object, EOGlobalID globalID, EOEditingContext context)
globalID
in context
. Objects that have been inserted
but not saved, or that have been deleted, shouldn't be refaulted.
When using com.webobjects.eocontrol
, use this method with caution
since refaulting an object doesn't remove the object snapshot
from the undo stack.object
- the object to turn into a faultglobalID
- the EOGlobalID identifier for the resulting fault objectcontext
- contains object and the resulting fault for objectEOEditingContext.refaultObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
EODatabaseContext.refaultObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
public abstract void saveChangesInEditingContext(EOEditingContext context)
context
to the receiver's repository.
Sends insertedObjects
, deletedObjects
, and updatedObjects
messages
to context
and applies the changes to the receiver's
data repository as appropriate. For example, EODatabaseContext (EOAccess)
implements this method to send operations to an EOAdaptor (EOAccess)
for making the changes in a database.context
- EOEditingContext that will have its object graph changes savedEOEditingContext.saveChangesInEditingContext(com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.saveChangesInEditingContext(com.webobjects.eocontrol.EOEditingContext)
,
EOAdaptor
public abstract void unlock()
unlock
in interface NSLocking
lock()
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |