org.gcube.common.core.persistence
Class GCUBENoPersistenceDelegate<RESOURCEID>

java.lang.Object
  extended by org.gcube.common.core.persistence.GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>
      extended by org.gcube.common.core.persistence.GCUBENoPersistenceDelegate<RESOURCEID>
Type Parameters:
RESOURCEID - the identifier of the resource type.

public class GCUBENoPersistenceDelegate<RESOURCEID>
extends GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>

An implementation of GCUBEPersistenceDelegate which simulates serialisation and deserialisation of GCUBEStatefulResources.

It is used as the delegate of resources which do not explicitly indicate one in the configuration of their GCUBEResourceHome.

Author:
Fabio Simeoni (University of Strathclyde)

Field Summary
 
Fields inherited from class org.gcube.common.core.persistence.GCUBEPersistenceDelegate
logger
 
Constructor Summary
GCUBENoPersistenceDelegate()
           
 
Method Summary
 List<RESOURCEID> getResourceIdentifiers()
          Returns the identifiers of all the resources serialised by the delegate.
 void load(GCUBEStatefulResource<RESOURCEID> resource, boolean firstLoad)
          Deserialises the state of an uninitialised resource.
protected  void onLoad(GCUBEStatefulResource<RESOURCEID> resource, boolean firstLoad)
          Invoked by GCUBEPersistenceDelegate.load(GCUBEStatefulResource, boolean) to deserialise a resource.
protected  void onRemove(GCUBEStatefulResource<RESOURCEID> resource)
          Invoked by GCUBEPersistenceDelegate.remove(GCUBEStatefulResource) to remove the serialisation of a resource.
protected  void onStore(GCUBEStatefulResource<RESOURCEID> resource)
          Invoked by GCUBEPersistenceDelegate.store(GCUBEStatefulResource) to serialise a resource.
 void remove(GCUBEStatefulResource<RESOURCEID> resource)
          Removes the serialisation of a resource.
 void store(GCUBEStatefulResource<RESOURCEID> resource)
          Serialises the state of a resource.
 
Methods inherited from class org.gcube.common.core.persistence.GCUBEPersistenceDelegate
initialise
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GCUBENoPersistenceDelegate

public GCUBENoPersistenceDelegate()
Method Detail

load

public void load(GCUBEStatefulResource<RESOURCEID> resource,
                 boolean firstLoad)
          throws Exception
Deserialises the state of an uninitialised resource.

Overrides:
load in class GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>
Parameters:
resource - the resource.
firstLoad - true if the resource has not been previously loaded since the container last booted, false otherwise.
Throws:
Exception - if the resource could not be deserialised.

store

public void store(GCUBEStatefulResource<RESOURCEID> resource)
Serialises the state of a resource.

Overrides:
store in class GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>
Parameters:
resource - the resource.

remove

public void remove(GCUBEStatefulResource<RESOURCEID> resource)
Removes the serialisation of a resource.

Overrides:
remove in class GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>
Parameters:
resource - the resource.

onLoad

protected void onLoad(GCUBEStatefulResource<RESOURCEID> resource,
                      boolean firstLoad)
               throws Exception
Invoked by GCUBEPersistenceDelegate.load(GCUBEStatefulResource, boolean) to deserialise a resource. Implement in accordance with resource and serialisation semantics.

Specified by:
onLoad in class GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>
firstLoad - true if the resource has not been previously loaded since the container last booted, false otherwise.
Throws:
Exception - if the resource could not be deserialised.
See Also:
GCUBEPersistenceDelegate.load(GCUBEStatefulResource, boolean)

onStore

protected void onStore(GCUBEStatefulResource<RESOURCEID> resource)
                throws Exception
Invoked by GCUBEPersistenceDelegate.store(GCUBEStatefulResource) to serialise a resource. Implement in accordance with serialisation and resource semantics.

Specified by:
onStore in class GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>
Throws:
Exception - if the resource could not be serialised.
See Also:
GCUBEPersistenceDelegate.store(GCUBEStatefulResource)

onRemove

protected void onRemove(GCUBEStatefulResource<RESOURCEID> resource)
                 throws Exception
Invoked by GCUBEPersistenceDelegate.remove(GCUBEStatefulResource) to remove the serialisation of a resource. Implement in accordance with serialisation and resource semantics.

Specified by:
onRemove in class GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>
Throws:
Exception - if the resource serialisation could not be removed.
See Also:
GCUBEPersistenceDelegate.remove(GCUBEStatefulResource)

getResourceIdentifiers

public List<RESOURCEID> getResourceIdentifiers()
Returns the identifiers of all the resources serialised by the delegate.

Specified by:
getResourceIdentifiers in class GCUBEPersistenceDelegate<RESOURCEID,GCUBEStatefulResource<RESOURCEID>>
Returns:
the identifiers.


Copyright © 2012. All Rights Reserved.