|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eocontrol.EOObjectStore com.webobjects.eodistribution.client.EODistributedObjectStore
An EODistributedObjectStore functions as the parent object store on the client side of Java Client applications. It handles interaction with the distribution layer's channel (an EODistributionChannel object), incorporating knowledge of that channel so it can forward messages it receives from the server to its editing contexts and forward messages from its editing contexts to the server. With the channel, it represents a single connection to the server, fetching and saving objects on behalf of one or more client-side editing contexts. In this regard, an EODistributedObjectStore acts like an EODatabaseContext on the server side. It differs from EODatabaseContext in that its editing contexts interact directly with it without the intervention of an object store coordinator.
EODistributedObjectStore provides several methods in addition to those defined by EOObjectStore.
The invocation methods invokeRemoteMethod
(two overloaded versions),
invokeRemoteMethodWithKeyPath
, and invokeStatelessRemoteMethodWithKeyPath
allow you to send messages to any object on the server and receive responses from them. The methods
classDescriptionForGlobalID
and snapshotForSourceGlobalID
return
information related to enterprise objects in the distributed object store given an object's
global ID.
Field Summary |
Fields inherited from class com.webobjects.eocontrol.EOObjectStore |
DeletedKey, InsertedKey, InvalidatedAllObjectsInStoreNotification, InvalidatedKey, ObjectsChangedInStoreNotification, UpdatedKey |
Fields inherited from interface com.webobjects.foundation.NSLocking |
OneCentury, OneDay, OneHour, OneMinute, OneSecond, OneWeek, OneYear |
Constructor Summary | |
EODistributedObjectStore(EODistributionChannel channel)
Creates an EODistributedObjectStore instance initialized with a distribution channel. |
Method Summary | |
NSArray |
arrayFaultWithSourceGlobalID(EOGlobalID globalID,
String relationshipName,
EOEditingContext editingContext)
Creates a to-many fault in the editing context editingContext and
returns an array of the destination objects for the to-many relationship
identified by relationshipName . |
EOClassDescription |
classDescriptionForGlobalID(EOGlobalID globalID)
Returns the class description for the enterprise object identified by globalID . |
EODistributionChannel |
distributionChannel()
Returns the distribution channel used by the distributed object store. |
void |
editingContextDidForgetObjectWithGlobalID(EOEditingContext editingContext,
EOGlobalID globalID)
Invoked if a child editing context forgot an object to clear out the snapshots. |
EOEnterpriseObject |
faultForGlobalID(EOGlobalID globalID,
EOEditingContext editingContext)
Creates a to-one fault for the enterprise object identified by the global ID globalID , registers it in the editing context
editingContext , and returns the fault. |
EOEnterpriseObject |
faultForRawRow(NSDictionary row,
String entityName,
EOEditingContext editingContext)
Creates a to-one fault for an enterprise object identified by the raw row row and the entity name entityName , registers
it in the editing context editingContext , and returns the
fault. |
void |
initializeObject(EOEnterpriseObject object,
EOGlobalID globalID,
EOEditingContext editingContext)
Initializes the enterprise object object with its attributes
and relationships using key-value coding. |
void |
invalidateAllObjects()
Invoked to notify the receiver that all the properties and objects it caches are no longer valid and that they should be refaulted. |
void |
invalidateObjectsWithGlobalIDs(NSArray globalIDs)
Invoked to notify the receiver that the objects in the object store with the global IDs globalIDs should no longer be considered valid
and that they should be refaulted. |
Object |
invokeRemoteMethod(EOEditingContext editingContext,
EOGlobalID globalID,
String methodName,
Class[] argumentTypes,
Object[] arguments)
Pushes the changes of the object graph in editingContext to the
server-side editing context (but does not save the changes to the database) and
invokes the method named methodName with the arguments passed
remotely on the enterprise object identified by the global ID globalID . |
Object |
invokeRemoteMethod(EOEditingContext editingContext,
EOGlobalID globalID,
String methodName,
Class[] argumentTypes,
Object[] arguments,
boolean shouldPush)
Invokes the method named methodName with the arguments passed
remotely on the enterprise object identified by the global ID globalID . |
Object |
invokeRemoteMethodWithKeyPath(EOEditingContext editingContext,
String keyPath,
String methodName,
Class[] argumentTypes,
Object[] arguments,
boolean shouldPush)
This method invokes a remote method on an object on the server side that can be specified with a key path (not just an enterprise object) relative to the invocation target of the server side EODistributionContext (for example "session"). |
Object |
invokeStatelessRemoteMethodWithKeyPath(String keyPath,
String methodName,
Class[] argumentTypes,
Object[] arguments)
This method invokes a remote method on an object on the server side that can be specified with a key path (no enterprise object) relative to the invocation target of the server side EODistributionContext (for example "session"). |
boolean |
isObjectLockedWithGlobalID(EOGlobalID globalID,
EOEditingContext editingContext)
Returns whether an object has been locked by the underlying data store. |
void |
lock()
This method is used to protect access to the receiver from concurrent operations by multiple threads. |
void |
lockObjectWithGlobalID(EOGlobalID globalID,
EOEditingContext editingContext)
Places a persistent lock on the object in it's underlying data store. |
NSArray |
objectsForSourceGlobalID(EOGlobalID globalID,
String relationshipName,
EOEditingContext editingContext)
Returns the destination objects for the to-many relationship identified by relationshipName . |
NSArray |
objectsWithFetchSpecification(EOFetchSpecification fetchSpecification,
EOEditingContext editingContext)
Fetches objects from the server according to the criteria specified by the fetch specification fetchSpecification and returns them in an
array for inclusion in the editing context editingContext . |
void |
refaultObject(EOEnterpriseObject object,
EOGlobalID globalID,
EOEditingContext editingContext)
Turns the enterprise object object back into a fault (an
empty enterprise object, identified by the global ID globalID )
in the editing context editingContext . |
void |
saveChangesInEditingContext(EOEditingContext editingContext)
Requests the server to commit changes to the enterprise objects in the editing context editingContext . |
NSArray |
snapshotForSourceGlobalID(EOGlobalID globalID,
String relationshipName)
Returns an array of global IDs identifying the destination objects for the to-many relationship relationshipName having the source
global ID globalID . |
void |
unlock()
This method is used to protect access to the receiver from concurrent operations by multiple threads. |
Methods inherited from class com.webobjects.eocontrol.EOObjectStore |
dispose |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EODistributedObjectStore(EODistributionChannel channel)
channel
- the distribution channel used to communicate with the serverMethod Detail |
public NSArray arrayFaultWithSourceGlobalID(EOGlobalID globalID, String relationshipName, EOEditingContext editingContext)
editingContext
and
returns an array of the destination objects for the to-many relationship
identified by relationshipName
. The globalID
parameter identifies
the source object for the relationship (which doesn't necessarily exist in
memory yet).
arrayFaultWithSourceGlobalID
in class EOObjectStore
globalID
- the source object global IDrelationshipName
- the to-many relationship nameeditingContext
- the editing context
EOObjectStore.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 EOClassDescription classDescriptionForGlobalID(EOGlobalID globalID)
globalID
.
globalID
- the global ID of the enterprise object
public EODistributionChannel distributionChannel()
public void editingContextDidForgetObjectWithGlobalID(EOEditingContext editingContext, EOGlobalID globalID)
editingContextDidForgetObjectWithGlobalID
in class EOObjectStore
editingContext
- the editing context which forgot the objectglobalID
- the global ID of the object forgotten by the editing contextEOEditingContext.editingContextDidForgetObjectWithGlobalID(com.webobjects.eocontrol.EOEditingContext, com.webobjects.eocontrol.EOGlobalID)
,
EODatabaseContext.editingContextDidForgetObjectWithGlobalID(com.webobjects.eocontrol.EOEditingContext, com.webobjects.eocontrol.EOGlobalID)
public EOEnterpriseObject faultForGlobalID(EOGlobalID globalID, EOEditingContext editingContext)
globalID
, registers it in the editing context
editingContext
, and returns the fault. This method could return
an already existing object.
faultForGlobalID
in class EOObjectStore
globalID
- the global IDeditingContext
- the editing context
EOEditingContext.faultForGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.faultForGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EOObjectStore.arrayFaultWithSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
,
EOEditingContext.recordObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID)
,
EOFaultHandler
public EOEnterpriseObject faultForRawRow(NSDictionary row, String entityName, EOEditingContext editingContext)
row
and the entity name entityName
, registers
it in the editing context editingContext
, and returns the
fault. This method may return an already existing object.
faultForRawRow
in class EOObjectStore
row
- the raw rowentityName
- the entity nameeditingContext
- the editing context
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 void initializeObject(EOEnterpriseObject object, EOGlobalID globalID, EOEditingContext editingContext)
object
with its attributes
and relationships using key-value coding. The properties of object
are identified and accessed using the global ID globalID
.
For properties with NSKeyValueCoding.NullValue
,
null
is substituted.
initializeObject
in class EOObjectStore
object
- the enterprise object to initializeglobalID
- the global ID of the enterprise objecteditingContext
- the editing context of the enterprise 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 void invalidateAllObjects()
InvalidatedAllObjectsInStoreNotification
after removing
snapshots from the object store.
invalidateAllObjects
in class EOObjectStore
EOObjectStore.invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray)
,
EOObjectStore.refaultObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EOEditingContext.invalidateAllObjects()
,
EODatabaseContext.invalidateAllObjects()
public void invalidateObjectsWithGlobalIDs(NSArray globalIDs)
globalIDs
should no longer be considered valid
and that they should be refaulted. This message is propagated to any underlying
object store resulting in a refetch the next time the objects are accessed.
Any child object stores are notified that the objects are no longer valid.
invalidateObjectsWithGlobalIDs
in class EOObjectStore
globalIDs
- the array of global IDs to invalidateEOObjectStore.invalidateAllObjects()
,
EOObjectStore.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 editingContext, EOGlobalID globalID, String methodName, Class[] argumentTypes, Object[] arguments)
editingContext
to the
server-side editing context (but does not save the changes to the database) and
invokes the method named methodName
with the arguments passed
remotely on the enterprise object identified by the global ID globalID
.
Note that if editingContext
is a nested editing context, the changes
have to be pushed through the parent editing context.
invokeRemoteMethod
in class EOObjectStore
editingContext
- the client editing editing of the enterprise objectglobalID
- the global ID of the enterprise object to invoke the remote method onmethodName
- the name of the method to be invokedargumentTypes
- the types of the arguments of the method to be invokedarguments
- the arguments of the method to be invoked
invokeRemoteMethod(EOEditingContext, EOGlobalID, String, Class[], Object[], boolean)
,
EODistributionContext
,
EODistributionContext.Delegate
public Object invokeRemoteMethod(EOEditingContext editingContext, EOGlobalID globalID, String methodName, Class[] argumentTypes, Object[] arguments, boolean shouldPush)
methodName
with the arguments passed
remotely on the enterprise object identified by the global ID globalID
.
If shouldPush
is true
, the changes of the object graph
in editingContext
are pushed to the server side editing context (but
not saved to the database). Note that if editingContext
is a nested
editing context, the changes have to be pushed through to the parent editing context.
editingContext
- the client editing context of the enterprise objectglobalID
- the global ID of the enterprise object to invoke the remote method onmethodName
- the name of the method to be invokedargumentTypes
- the types of the arguments of the method to be invokedarguments
- the arguments of the method to be invokedshouldPush
- true
if the changes in the editing context should be pushed
to the server; false
otherwise
invokeRemoteMethod(EOEditingContext, EOGlobalID, String, Class[], Object[])
,
EODistributionContext
,
EODistributionContext.Delegate
public Object invokeRemoteMethodWithKeyPath(EOEditingContext editingContext, String keyPath, String methodName, Class[] argumentTypes, Object[] arguments, boolean shouldPush)
This method invokes a remote method on an object on the server side that can be specified with a key path (not just an enterprise object) relative to the invocation target of the server side EODistributionContext (for example "session").
The keyPath
argument has special semantics:
keyPath
is a fully qualified key path (for example,
"session"), the key path is followed starting from the invocation target
of the EODistributionContext.keyPath
is an empty string, the method is invoked on the
invocation target of the EODistributionContext directly (typically a subclass
of WOJavaClientComponent).keyPath
is null
, the method is invoked on
one of the remote method receivers of the server side EODistributionContext.If an actual key path is specified, the EODistributionContext on
the server blocks all invocations sent with this method unless methodName
is prefixed with "clientSideRequest" or unless the EODistributionContext's
delegate (on the server) implements the right delegate methods to explicitly
allow the invocation. "clientSideRequest" methods can be invoked without special
delegate methods on the server-side distribution context, on a remote method
receiver registered with the distribution context or on the session of the
distribution context's invocation target.
If enterprise objects are involved in the remote method invocation (either as argument or as return value), you need to specify an editing context. In that case you also have the choice to push the changes of the editing context's enterprise object graph to the server-side editing context.
editingContext
- the editing context for enterprise objects involved in the remote method invocationkeyPath
- the key path identifying the receiver of the method invocationmethodName
- the name of the method to be invokedargumentTypes
- the types of the arguments of the method to be invokedarguments
- the arguments of the method to be invokedshouldPush
- true
if the changes in the editing context should be pushed
to the server; false
otherwise
invokeStatelessRemoteMethodWithKeyPath(String, String, Class[], Object[])
,
EODistributionContext
,
EODistributionContext.Delegate
public Object invokeStatelessRemoteMethodWithKeyPath(String keyPath, String methodName, Class[] argumentTypes, Object[] arguments)
This method invokes a remote method on an object on the server side that can be specified with a key path (no enterprise object) relative to the invocation target of the server side EODistributionContext (for example "session"). The arguments and return values of remote methods invoked through this method cannot be enterprise objects (but global IDs are okay). You can use this method, for example, to load resources from the server or to perform checks in background threads (as long as no enterprise objects are involved).
The keyPath
argument has special semantics:
keyPath
is a fully qualified key path (for example,
"session"), the key path is followed starting from the invocation target
of the EODistributionContext.keyPath
is an empty string, the method is invoked on the
invocation target of the EODistributionContext directly (typically a subclass
of WOJavaClientComponent).keyPath
is null
, the method is invoked on
one of the remote method receivers of the server side EODistributionContext.If an actual key path is specified, the EODistributionContext on
the server blocks all invocations sent with this method unless methodName
is prefixed with "clientSideRequest" or unless the EODistributionContext's
delegate (on the server) implements the right delegate methods to explicitly
allow the invocation. "clientSideRequest" methods can be invoked without special
delegate methods on the server-side distribution context, on a remote method
receiver registered with the distribution context or on the session of the
distribution context's invocation target.
keyPath
- the key path identifying the receiver of the method invocationmethodName
- the name of the method to be invokedargumentTypes
- the types of the arguments of the method to be invokedarguments
- the arguments of the method to be invoked
invokeRemoteMethodWithKeyPath(EOEditingContext, String, String, Class[], Object[], boolean)
,
EODistributionContext
,
EODistributionContext.Delegate
public boolean isObjectLockedWithGlobalID(EOGlobalID globalID, EOEditingContext editingContext)
false
.
isObjectLockedWithGlobalID
in class EOObjectStore
globalID
- the global ID of the object to testeditingContext
- the editing context of the object
false
since EODistributedObjectStore does not support lockingEOEditingContext.isObjectLockedWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.isObjectLockedWithGlobalID(com.webobjects.eocontrol.EOGlobalID)
public void lock()
EOObjectStore
lock
in interface NSLocking
lock
in class EOObjectStore
EOObjectStore.unlock()
public void lockObjectWithGlobalID(EOGlobalID globalID, EOEditingContext editingContext)
IllegalStateException
.
lockObjectWithGlobalID
in class EOObjectStore
globalID
- the global ID of the object to lockeditingContext
- the editing context of the objectEOEditingContext.lockObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.lockObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
public NSArray objectsForSourceGlobalID(EOGlobalID globalID, String relationshipName, EOEditingContext editingContext)
relationshipName
. The source object for the relationship
is identified by its global ID globalID
. The source object
and all destination objects for the relationship belong to the editing
context editingContext
. This method first looks to find the
destination objects for the relationship in a client-side cache. If that
cache is empty, it requests those objects from the server and updates the
client-side cache with them.
objectsForSourceGlobalID
in class EOObjectStore
globalID
- the source global IDrelationshipName
- the to-many relationship nameeditingContext
- the editing context of the enterprise object
EOEditingContext.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 NSArray objectsWithFetchSpecification(EOFetchSpecification fetchSpecification, EOEditingContext editingContext)
fetchSpecification
and returns them in an
array for inclusion in the editing context editingContext
.
Updates the client-side caches with the fetched enterprise objects. Throws
an exception if an error occurs.
objectsWithFetchSpecification
in class EOObjectStore
fetchSpecification
- the fetch specification describing the object to be fetchededitingContext
- the editing context to fetch the objects into
EOEditingContext.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification, com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification, com.webobjects.eocontrol.EOEditingContext)
public void refaultObject(EOEnterpriseObject object, EOGlobalID globalID, EOEditingContext editingContext)
object
back into a fault (an
empty enterprise object, identified by the global ID globalID
)
in the editing context editingContext
. Objects that have been
inserted but not saved, or that have been deleted, shouldn't be refaulted.
refaultObject
in class EOObjectStore
object
- the enterprise object to refaultglobalID
- the global ID of the enterprise objecteditingContext
- the editing context of the enterprise objectEOEditingContext.refaultObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
EODatabaseContext.refaultObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
public void saveChangesInEditingContext(EOEditingContext editingContext)
editingContext
. This message is invoked by
the editing context. The receiver calls back to the editing context to
get the updated, deleted, and inserted objects to save and commits these
changes in a single transaction. Raises an exception if any error occurs.
saveChangesInEditingContext
in class EOObjectStore
editingContext
- the editing context to save.EOEditingContext.saveChangesInEditingContext(com.webobjects.eocontrol.EOEditingContext)
,
EODatabaseContext.saveChangesInEditingContext(com.webobjects.eocontrol.EOEditingContext)
,
EOAdaptor
public NSArray snapshotForSourceGlobalID(EOGlobalID globalID, String relationshipName)
relationshipName
having the source
global ID globalID
. Returns null
if the object
identified by the source global ID does not currently exist in the object
store or if there is no relationship with the given name.
globalID
- the source global IDrelationshipName
- the to-many relationship name
public void unlock()
EOObjectStore
unlock
in interface NSLocking
unlock
in class EOObjectStore
EOObjectStore.lock()
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |