org.gcube.common.core.state
Class GCUBEWSLiteResource<LOCAL extends GCUBELocalResource>

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
      extended by org.gcube.common.core.state.GCUBEStatefulResource<GCUBEWSResourceKey>
          extended by org.gcube.common.core.state.GCUBEWSResource
              extended by org.gcube.common.core.state.GCUBEWSLiteResource<LOCAL>
Type Parameters:
LOCAL - the type of the GCUBELocalResource which can be viewed over.
All Implemented Interfaces:
GCUBEServiceClient, org.globus.wsrf.PersistenceCallback, org.globus.wsrf.Resource, org.globus.wsrf.ResourceLifetime, org.globus.wsrf.ResourceProperties, org.globus.wsrf.TopicListAccessor

public abstract class GCUBEWSLiteResource<LOCAL extends GCUBELocalResource>
extends GCUBEWSResource

An abstract specialisation of GCUBEWSResources for resource that act as views over GCUBELocalResources.

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
 
Fields inherited from class org.gcube.common.core.state.GCUBEStatefulResource
logger, uuidGen
 
Constructor Summary
GCUBEWSLiteResource()
           
 
Method Summary
 String getLocalID()
          Returns the identifier of the GCUBELocalResource associated with the resource.
 LOCAL getLocalResource()
          Returns the GCUBELocalResource associated with resource.
protected  org.globus.wsrf.ResourceProperty getProperty(String name)
          Returns a new RP with a given local name.
protected abstract  String[] getPropertyNames()
          Returns the names of fields to be transformed to into ReflectionResourceProperties.
protected  void initialise(GCUBEWSResourceKey id, Object... params)
          Used internally to initialise the resource with a given identifier and from given parameters.
 void onRemove()
          Invoked by GCUBEResourceHome in the process of removing the resource.
 void setLocalID(String resourceID)
          Sets the identifier of the GCUBELocalResource associated with the resource.
protected  Object[] transformParams(Object... params)
          Invoked during the initialisation of the resource, it transforms the initialisation parameters into those required by the associated GCUBELocalResource.
 
Methods inherited from class org.gcube.common.core.state.GCUBEWSResource
getCurrentTime, getEPR, getPorttypeContext, getPublisher, getResourcePropertySet, getServiceContext, getTerminationTime, getTopicList, getTopicNames, initialise, initialiseContainers, inScope, load, publish, setPortTypeContext, setTerminationTime, unpublish
 
Methods inherited from class org.gcube.common.core.state.GCUBEStatefulResource
getID, getLock, getScheduledTasks, getScope, launchTask, 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
 
Methods inherited from interface org.globus.wsrf.PersistenceCallback
store
 

Constructor Detail

GCUBEWSLiteResource

public GCUBEWSLiteResource()
Method Detail

initialise

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

Overrides:
initialise in class GCUBEWSResource
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.

transformParams

protected Object[] transformParams(Object... params)
                            throws Exception
Invoked during the initialisation of the resource, it transforms the initialisation parameters into those required by the associated GCUBELocalResource.

By default, it performs the identity transformation. Override if the initialisation of the resource must be decoupled from the initialisation of the GCUBELocalResource.

Parameters:
params - the initialisation parameters of the view.
Returns:
the initialisation parameters of the local resource.
Throws:
Exception - if the transformation could not be performed.

getLocalID

public String getLocalID()
Returns the identifier of the GCUBELocalResource associated with the resource.

Returns:
the identifier.

setLocalID

public void setLocalID(String resourceID)
Sets the identifier of the GCUBELocalResource associated with the resource.

Parameters:
resourceID - the identifier.

onRemove

public void onRemove()
              throws org.globus.wsrf.ResourceException
Invoked by GCUBEResourceHome in the process of removing the resource.

Overrides:
onRemove in class GCUBEStatefulResource<GCUBEWSResourceKey>
Throws:
org.globus.wsrf.ResourceException - if the resource could not be removed.

getPropertyNames

protected abstract String[] getPropertyNames()
Returns the names of fields to be transformed to into ReflectionResourceProperties. With reflection, subclasses do not need to maintain their RPs in sync with the state of the associated GCUBELocalResource. Rather, the RPs remain virtual, but requires getters and setters for each of the corresponding fields. Typically, getters and setters would dispatch to corresponding methods of the associated GCUBELocalResource.

Overrides:
getPropertyNames in class GCUBEWSResource
Returns:
the names.

getLocalResource

public LOCAL getLocalResource()
                                                  throws org.globus.wsrf.ResourceException
Returns the GCUBELocalResource associated with resource.

Returns:
the local resource.
Throws:
org.globus.wsrf.ResourceException

getProperty

protected org.globus.wsrf.ResourceProperty getProperty(String name)
                                                throws Exception
Returns a new RP with a given local name. By default it creates SimpleResourceProperty. Override to use different ResourceProperty implementation.

Overrides:
getProperty in class GCUBEWSResource
Parameters:
name - the local name.
Returns:
the property.
Throws:
Exception - if the property could not be created.


Copyright © 2012. All Rights Reserved.