RESOURCEID - the type of the resource identifier.public abstract class GCUBEStatefulResource<RESOURCEID> extends GCUBEServiceClientImpl implements org.globus.wsrf.Resource
GCUBEStatefulResource is an identifiable, initialisable, and removable entity.| Modifier and Type | Class and Description |
|---|---|
static class |
GCUBEStatefulResource.LOCK
Enumeration of the lock types associated with the resource.
|
static class |
GCUBEStatefulResource.TaskContext
Used internally to group contextual information about launched tasks.
|
| Modifier and Type | Field and Description |
|---|---|
protected GCUBELog |
logger
Instance logger.
|
protected static org.apache.axis.components.uuid.UUIDGen |
uuidGen
String generator for local resource identifiers.
|
| Constructor and Description |
|---|
GCUBEStatefulResource() |
| Modifier and Type | Method and Description |
|---|---|
RESOURCEID |
getID()
Returns the resource identifier.
|
GCUBEReadWriteLock |
getLock()
Returns a
GCUBEReadWriteLock to grant synchronised access to the resource. |
Map<String,GCUBEStatefulResource.TaskContext> |
getScheduledTasks()
Returns the tasks associated with the resource.
|
GCUBEScope |
getScope()
Returns the scope in which interactions ought to take place.
|
abstract GCUBEServiceContext |
getServiceContext()
Returns the context of the service associated with the resource.
|
protected abstract void |
initialise(RESOURCEID id,
Object... params)
Used internally to initialise the resource with a given identifier and from given parameters.
|
<T> void |
launchTask(String taskName,
GCUBEHandler<T> task,
Long delay,
GCUBEScheduledHandler.Mode mode)
Launches a scheduled task associated with the WS-Resource.
|
protected void |
onRemove()
Invoked by
GCUBEResourceHome in the process of removing the resource. |
void |
setID(RESOURCEID id)
Invoked by the
GCUBEResourceHome of the resource to set its identifier. |
void |
setPersistenceDelegate(GCUBEPersistenceDelegate<RESOURCEID,? extends GCUBEStatefulResource<RESOURCEID>> delegate)
Invoked by the
GCUBEResourceHome of the resource to set the GCUBEPersistenceDelegate that is responsible for
the serialisation and deserialisation of the resource to and from long-term storage. |
void |
stopTask(String taskName)
Stops a scheduled task associated with the resource.
|
void |
store()
Serialises the resource to long term storage using its associated
GCUBEPersistenceDelegate. |
getPortTypeMap, setPortTypeMapprotected static final org.apache.axis.components.uuid.UUIDGen uuidGen
protected final GCUBELog logger
public RESOURCEID getID()
public void setID(RESOURCEID id)
GCUBEResourceHome of the resource to set its identifier.id - the identifier.protected abstract void initialise(RESOURCEID id, Object... params) throws Exception
id - the identifier, or null if a new one should be generated.params - (optional) the initialisation parameters.Exception - if the resource could not be initialised.public abstract GCUBEServiceContext getServiceContext()
public void setPersistenceDelegate(GCUBEPersistenceDelegate<RESOURCEID,? extends GCUBEStatefulResource<RESOURCEID>> delegate)
GCUBEResourceHome of the resource to set the GCUBEPersistenceDelegate that is responsible for
the serialisation and deserialisation of the resource to and from long-term storage.delegate - the delegate.public void store()
GCUBEPersistenceDelegate.org.globus.wsrf.ResourceException - if the resource could not be serialised.protected void onRemove()
throws org.globus.wsrf.ResourceException
GCUBEResourceHome in the process of removing the resource.org.globus.wsrf.ResourceException - if the resource could not be removed.public GCUBEReadWriteLock getLock()
GCUBEReadWriteLock to grant synchronised access to the resource.
Client threads are responsible for releasing the lock when they are finished with the resource.
(typically from within a finally block).
GCUBEReadWriteLockpublic <T> void launchTask(String taskName, GCUBEHandler<T> task, Long delay, GCUBEScheduledHandler.Mode mode) throws Exception
taskName - the unique name of the task.task - the task.delay - the time interval between two runs of the task, in seconds.mode - the eager or lazy scheduling mode of the task.Exception - if the task could not be launched.public Map<String,GCUBEStatefulResource.TaskContext> getScheduledTasks()
public void stopTask(String taskName) throws Exception
taskName - the name of the task.Exception - if the task could not be stopped.public GCUBEScope getScope()
Typically, this is delegated to a GCUBEScopeManager .
getScope in interface GCUBEServiceClientgetScope in class GCUBEServiceClientImplnull if interactions should not to be scoped.Copyright © 2015. All Rights Reserved.