org.gcube.common.core.state
Class GCUBELocalResource

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
      extended by org.gcube.common.core.state.GCUBEStatefulResource<String>
          extended by org.gcube.common.core.state.GCUBELocalResource
All Implemented Interfaces:
GCUBEServiceClient, org.globus.wsrf.Resource

public abstract class GCUBELocalResource
extends GCUBEStatefulResource<String>

An abstract specialisation of GCUBEStatefulResource for stateful entities that are locally accessible.

Author:
Fabio Simeoni (University of Strathclyde)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.common.core.state.GCUBEStatefulResource
GCUBEStatefulResource.LOCK, GCUBEStatefulResource.TaskContext
 
Field Summary
protected  GCUBEServiceContext context
          The context of the service in which the resource is used.
 
Fields inherited from class org.gcube.common.core.state.GCUBEStatefulResource
logger, uuidGen
 
Constructor Summary
GCUBELocalResource()
           
 
Method Summary
 void addLink()
          Increments the number of clients that share the resource.
 int getLinks()
          Returns the number of clients that share the resource.
 GCUBEServiceContext getServiceContext()
          Returns the context of the service associated with the resource.
protected  void initialise(String id, Object... params)
          Used internally to initialise the resource with a given identifier and from given parameters.
 void removeLink()
          Decrements the number of clients that share the resource.
 void setLinks(int links)
          Sets the number of clients that share the resource.
 void setServiceContext(GCUBEServiceContext context)
          Sets the service context associated with the local resource.
 
Methods inherited from class org.gcube.common.core.state.GCUBEStatefulResource
getID, getLock, getScheduledTasks, getScope, launchTask, onRemove, setID, setPersistenceDelegate, stopTask, store
 
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

context

protected GCUBEServiceContext context
The context of the service in which the resource is used.

Constructor Detail

GCUBELocalResource

public GCUBELocalResource()
Method Detail

initialise

protected void initialise(String id,
                          Object... params)
                   throws Exception
Used internally to initialise the resource with a given identifier and from given parameters.

Specified by:
initialise in class GCUBEStatefulResource<String>
Parameters:
id - the identifier, or null if a new one should be generated.
params - (optional) the initialisation parameters.
Throws:
Exception - if the resource could not be initialised.

getLinks

public int getLinks()
Returns the number of clients that share the resource.

Returns:
the number of clients that share the resource.

addLink

public void addLink()
Increments the number of clients that share the resource.


removeLink

public void removeLink()
Decrements the number of clients that share the resource.


setLinks

public void setLinks(int links)
Sets the number of clients that share the resource.

Parameters:
links - the number of clients that share the resource.

getServiceContext

public GCUBEServiceContext getServiceContext()
Returns the context of the service associated with the resource.

Specified by:
getServiceContext in class GCUBEStatefulResource<String>
Returns:
the context.

setServiceContext

public void setServiceContext(GCUBEServiceContext context)
Sets the service context associated with the local resource.

Parameters:
context - the context.


Copyright © 2013. All Rights Reserved.