|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
org.gcube.common.core.state.GCUBEStatefulResource<RESOURCEID>
RESOURCEID - the type of the resource identifier.public abstract class GCUBEStatefulResource<RESOURCEID>
Partial implementation of stateful entities managed by gCube services.
In particular, a GCUBEStatefulResource is an identifiable, initialisable, and removable entity.
| Nested Class Summary | |
|---|---|
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. |
| Field Summary | |
|---|---|
protected GCUBELog |
logger
Instance logger. |
protected static org.apache.axis.components.uuid.UUIDGen |
uuidGen
String generator for local resource identifiers. |
| Constructor Summary | |
|---|---|
GCUBEStatefulResource()
|
|
| Method Summary | ||
|---|---|---|
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. |
|
|
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. |
|
| Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl |
|---|
getPortTypeMap, setPortTypeMap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.axis.components.uuid.UUIDGen uuidGen
protected final GCUBELog logger
| Constructor Detail |
|---|
public GCUBEStatefulResource()
| Method Detail |
|---|
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).
GCUBEReadWriteLock
public <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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||