org.gcube.common.core.state
Class GCUBELocalHome

java.lang.Object
  extended by org.gcube.common.core.state.GCUBEResourceHome<String,String,GCUBELocalResource>
      extended by org.gcube.common.core.state.GCUBELocalHome
All Implemented Interfaces:
org.globus.wsrf.jndi.Initializable

public abstract class GCUBELocalHome
extends GCUBEResourceHome<String,String,GCUBELocalResource>

A specialisation of GCUBEResourceHome for GCUBELocalResources.

Author:
Fabio Simeoni (University of Strathclyde)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.common.core.state.GCUBEResourceHome
GCUBEResourceHome.Mode
 
Field Summary
 
Fields inherited from class org.gcube.common.core.state.GCUBEResourceHome
cache, lockManager, logger, mode, persistenceDelegate, resourceClass, resourceLog
 
Constructor Summary
GCUBELocalHome()
           
 
Method Summary
protected  void onInitialisation()
          Invoked during initialisation of the Running Instance to initialise the home.
protected  boolean onRemove(GCUBELocalResource resource)
          Invoked as a precondition to the removal of a resource.
protected  void onReuse(GCUBELocalResource resource)
          Invoked when a resource is reused across two or more calls to GCUBEResourceHome.create(Object, Object...) .
protected  void preInitialise(GCUBELocalResource resource)
          Invoked during the creation of a resource and before its initialisation.
 
Methods inherited from class org.gcube.common.core.state.GCUBEResourceHome
add, create, create, createInternal, find, get, getIdentifiers, getResourceClass, getResources, getServiceContext, initialize, newInstance, onFailure, onLoad, onReady, onStateChange, onUpdate, postInitialise, remove, remove, reuse, setCacheTimeout, setPersistenceDelegateClass, setResourceClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GCUBELocalHome

public GCUBELocalHome()
Method Detail

onInitialisation

protected void onInitialisation()
                         throws Exception
Invoked during initialisation of the Running Instance to initialise the home. Most of the initialisation occurs from JNDI configuration. Subclasses must define a configuration template which extends the following (text in italics marks points of instantiations):

<resource name="[name]" type="[FQN of a subclass of GCUBEResourceHome]">
  <resourceParams>
   <parameter>
    <name>factory</name>
    <value>org.globus.wsrf.jndi.BeanFactory</value>
   </parameter>
   <parameter>
    <name>resourceClass</name>
    <value>[FQN of a concrete subclass of GCUBEStatefulResource]</value>
   </parameter>
   <parameter>
    <name>persistenceDelegateClass</name>
    <value>[FQN of a concrete subclass of GCUBEPersistenceDelegate]</value>
   </parameter>
   <parameter>
    <name>cacheTimeout</name>
    <value>[seconds]</value>
   </parameter>
  </resourceParams>
</resource>

where:

-) the name of the JNDI resource and its resourceClass parameter may be further constrained by subclasses.
-) persistenceDelegateClass and cacheTimeout are optional and related. If neither is present, the mode of operation is TRANSIENT. If the first is present but the second is absent, then the mode of operation is SOFTPERSISTENT. If both are present, then the mode of operation is HARDPERSISTENT if the second has a value of 0 and CACHEDPERSISTENT in all other cases. Finally, the second cannot occur without the first.

Overrides:
onInitialisation in class GCUBEResourceHome<String,String,GCUBELocalResource>
Throws:
Exception - if the callback did not complete successfully (causes service failure).

onReuse

protected void onReuse(GCUBELocalResource resource)
                throws org.globus.wsrf.ResourceException
Invoked when a resource is reused across two or more calls to GCUBEResourceHome.create(Object, Object...) .

Overrides:
onReuse in class GCUBEResourceHome<String,String,GCUBELocalResource>
Parameters:
resource - the resource.
Throws:
org.globus.wsrf.ResourceException - if the resource could not be reused.

preInitialise

protected void preInitialise(GCUBELocalResource resource)
                      throws org.globus.wsrf.ResourceException
Invoked during the creation of a resource and before its initialisation.

If overriding this method, please note that the resource may not have been assigned an identifier yet.

Overrides:
preInitialise in class GCUBEResourceHome<String,String,GCUBELocalResource>
Parameters:
resource - the resource.
Throws:
org.globus.wsrf.ResourceException - if the resource could not be pre-initialised.

onRemove

protected boolean onRemove(GCUBELocalResource resource)
                    throws org.globus.wsrf.ResourceException
Invoked as a precondition to the removal of a resource.

Overrides:
onRemove in class GCUBEResourceHome<String,String,GCUBELocalResource>
Parameters:
resource - the resource.
Throws:
org.globus.wsrf.ResourceException - if the precondition could not be verified.


Copyright © 2013. All Rights Reserved.