|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mandala.rami.AbstractAsynchronousReference mandala.jacob.StoredObjectReference
Convenience class for stored object manipulation.
In a set of active maps, a reference to a stored
object is a pair (activeMap, key)
. An instance of this class
represents such a reference.
Instanciating a StoredObjectReference
doesn't mean mapping
an object in an active map.
Moreover, this class implements the singleton design
pattern. For any pair (activeMap, key)
, only one instance
of this class exist in the JVM. So, getting a reference of an instance of
this class is done by the call :
whereStoredObjectReference storedObjectReference = StoredObjectReference.getInstance(activeMap, key)
activeMap
is the active map reference
where an object is already mapped to key
.
An instance of this class may be unusable if its related stored object
has been removed or doesn't exist. In such a case the reference represented
by the pair (activeMap, key)
is called
invalid.
Each instance of this class uses the Syslog
facility for
logging.
ActiveMap
,
AsynchronousReference
,
FutureFactory
,
CallbackManager
,
Syslog
,
Serialized FormField Summary | |
protected ActiveMap |
activeMap
The active map reference where the stored object is mapped to key. |
protected FutureFactory |
futureFactory
The FutureFactory instance used to create our
future objects. |
protected java.lang.Object |
key
The key of the mapped object. |
Fields inherited from class mandala.rami.AbstractAsynchronousReference |
callbackManager, syslog |
Constructor Summary | |
protected |
StoredObjectReference(ActiveMap activeMap,
java.lang.Object key,
CallbackManager callbackManager,
FutureFactory futureFactory)
Creates a new StoredObjectReference instance. |
Method Summary | |
FutureClient |
call(MethodOp method,
java.lang.Object[] args,
Callback callback)
Call a method asynchronously. |
java.lang.Object |
get()
Gets the object this reference refers to. |
ActiveMap |
getActiveMap()
Gets the active map this reference is linked to. |
FutureFactory |
getFutureFactory()
Returns the factory used to construct futures. |
static java.lang.Object |
getGlobalUniqueKey(ActiveMap activeMap,
java.lang.Object object)
|
static StoredObjectReference |
getInstance(ActiveMap activeMap,
java.lang.Object key,
CallbackManager callbackManager,
FutureFactory futureFactory)
Gets the instance related to the pair (activeMap,
key) . |
java.lang.Object |
getKey()
Gets the key this reference is linked to. |
java.lang.Object |
getObject()
Returns the object this StoredObjectReference refers
to. |
boolean |
isValid()
|
java.lang.Object |
put(java.lang.Object object)
Replace the stored object by a new one. |
java.lang.Object |
remove()
Unmmap the stored object from its key in the active map. |
java.lang.String |
toString()
|
Methods inherited from class mandala.rami.AbstractAsynchronousReference |
call, getCallbackManager, getSyslog, setSyslog |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.Object key
The key of the mapped object.
ActiveMap
protected ActiveMap activeMap
The active map reference where the stored object is mapped to key.
ActiveMap
protected FutureFactory futureFactory
The FutureFactory
instance used to create our
future objects.
FutureFactory
Constructor Detail |
protected StoredObjectReference(ActiveMap activeMap, java.lang.Object key, CallbackManager callbackManager, FutureFactory futureFactory)
Creates a new StoredObjectReference
instance.
activeMap
- the active map where the stored
object resideskey
- the key of the stored objectfutureFactory
- the builder of future
objectscallbackManager
- the manager of
Callback
for this instance.ActiveMap
,
FutureFactory
,
Callback
Method Detail |
public FutureClient call(MethodOp method, java.lang.Object[] args, Callback callback)
AsynchronousReference
Call a method asynchronously.
Since the call is asynchronous, exceptions are not handled in an
usual way. Implementations must provide a mechanism conform to the
FutureClient
specification.
The method done
of the specified Callback
is called once the reflexive
asynchronous method invocation is done. The Callback
instance returned by CallbackManager.getCallback()
is not
used. If multiple callbacks are needed, see CallbackList
.
call
in interface AsynchronousReference
call
in class AbstractAsynchronousReference
public java.lang.Object getObject()
Returns the object this StoredObjectReference
refers
to.
This implementation of the
AsynchronousReference.getObject()
method returns the same
value as get()
.
StoredObjectReference
refers to.Map.get(Object ket)
public java.lang.Object put(java.lang.Object object)
Replace the stored object by a new one.
object
- the object this reference must refer to.
public java.lang.Object get()
Gets the object this reference refers to.
public java.lang.Object remove()
Unmmap the stored object from its key in the active map.
This reference object is invalid upon the return of this method.
public boolean isValid()
public ActiveMap getActiveMap()
Gets the active map this reference is linked to.
public java.lang.Object getKey()
Gets the key
this reference is linked to.
public FutureFactory getFutureFactory()
Returns the factory used to construct futures.
public java.lang.String toString()
toString
in class AbstractAsynchronousReference
public static StoredObjectReference getInstance(ActiveMap activeMap, java.lang.Object key, CallbackManager callbackManager, FutureFactory futureFactory)
Gets the instance related to the pair (activeMap,
key)
.
This class implements the singleton design pattern. If the
related instance doesn't exist, it is created. If the related instance
exist, the futureFactory
and the
callbackManager
arguments are unused.
No call to active map's methods are done.
Future calls to the returned instance are unspecified if this
storedObjectReference is invalid i.e. if no object is
mapped to key
in the specified activeMap
.
activeMap
- the active map where the stored
object resideskey
- the key of the stored objectfutureFactory
- the builder of future
objectscallbackManager
- the manager of
Callback
for this instance.
StoredObjectReference
instance which handles
reflexive asynchronous method invocation on the specified stored object
pair (activeMap, key)
.ActiveMap
,
FutureFactory
,
CallbackManager
public static java.lang.Object getGlobalUniqueKey(ActiveMap activeMap, java.lang.Object object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |