org.gcube.common.core.persistence
Class GCUBEWSFilePersistenceDelegate<RESOURCE extends GCUBEWSResource>

java.lang.Object
  extended by org.gcube.common.core.persistence.GCUBEPersistenceDelegate<RESOURCEID,RESOURCE>
      extended by org.gcube.common.core.persistence.GCUBEFilePersistenceDelegate<GCUBEWSResourceKey,RESOURCE>
          extended by org.gcube.common.core.persistence.GCUBEWSFilePersistenceDelegate<RESOURCE>
Direct Known Subclasses:
GCUBEWSFields2FilePersistenceDelegate, GCUBEWSLiteFilePersistenceDelegate

public class GCUBEWSFilePersistenceDelegate<RESOURCE extends GCUBEWSResource>
extends GCUBEFilePersistenceDelegate<GCUBEWSResourceKey,RESOURCE>

An specialisation of GCUBEFilePersistenceDelegate to GCUBEWSResources.

Author:
Fabio Simeoni (University of Strathclyde)

Field Summary
protected  GCUBEStatefulPortTypeContext ctxt
           
protected static String WSRESOURCE_FILE_SUFFIX
          The suffix of file serialisation of resource.
 
Fields inherited from class org.gcube.common.core.persistence.GCUBEPersistenceDelegate
logger
 
Constructor Summary
GCUBEWSFilePersistenceDelegate()
           
 
Method Summary
protected  File getFileFromResource(RESOURCE resource)
          Returns the file serialisation of a resource.
protected  GCUBEWSResourceKey getIDFromFileName(String s)
          Returns a resource identifier from a string.
protected  String getSuffix()
          Returns the suffix for resource file serialisations.
 void initialise(GCUBEResourceHome<? super GCUBEWSResourceKey,GCUBEWSResourceKey,RESOURCE> home)
          Initialises the delegate from the GCUBEResourceHome of the associated resources.
protected  void onLoad(RESOURCE resource, ObjectInputStream stream)
          Deserialises the state of resource from a ObjectInputStream.
protected  void onStore(RESOURCE resource, ObjectOutputStream stream)
          Serialises the state of a resource into a ObjectOutputStream.
 
Methods inherited from class org.gcube.common.core.persistence.GCUBEFilePersistenceDelegate
getResourceIdentifiers, getStorageRoot, onLoad, onRemove, onStore
 
Methods inherited from class org.gcube.common.core.persistence.GCUBEPersistenceDelegate
load, remove, store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WSRESOURCE_FILE_SUFFIX

protected static final String WSRESOURCE_FILE_SUFFIX
The suffix of file serialisation of resource.

See Also:
Constant Field Values

ctxt

protected volatile GCUBEStatefulPortTypeContext ctxt
Constructor Detail

GCUBEWSFilePersistenceDelegate

public GCUBEWSFilePersistenceDelegate()
Method Detail

initialise

public void initialise(GCUBEResourceHome<? super GCUBEWSResourceKey,GCUBEWSResourceKey,RESOURCE> home)
                throws Exception
Initialises the delegate from the GCUBEResourceHome of the associated resources.

Overrides:
initialise in class GCUBEFilePersistenceDelegate<GCUBEWSResourceKey,RESOURCE extends GCUBEWSResource>
Parameters:
home - the home.
Throws:
Exception - if the delegate could not be initialised.

onLoad

protected void onLoad(RESOURCE resource,
                      ObjectInputStream stream)
               throws Exception
Deserialises the state of resource from a ObjectInputStream. Extends in accordance with resource semantics.

Overrides:
onLoad in class GCUBEFilePersistenceDelegate<GCUBEWSResourceKey,RESOURCE extends GCUBEWSResource>
stream - the stream.
Throws:
Exception - if the stream could not be processed.

onStore

protected void onStore(RESOURCE resource,
                       ObjectOutputStream stream)
                throws Exception
Serialises the state of a resource into a ObjectOutputStream. Extend in accordance with resource semantics.

Overrides:
onStore in class GCUBEFilePersistenceDelegate<GCUBEWSResourceKey,RESOURCE extends GCUBEWSResource>
stream - the stream.
Throws:
Exception - if the stream could not be processed.

getSuffix

protected String getSuffix()
Returns the suffix for resource file serialisations.

Specified by:
getSuffix in class GCUBEFilePersistenceDelegate<GCUBEWSResourceKey,RESOURCE extends GCUBEWSResource>
Returns:
the suffix

getFileFromResource

protected File getFileFromResource(RESOURCE resource)
Returns the file serialisation of a resource.

Specified by:
getFileFromResource in class GCUBEFilePersistenceDelegate<GCUBEWSResourceKey,RESOURCE extends GCUBEWSResource>
Returns:
the file serialisation.

getIDFromFileName

protected GCUBEWSResourceKey getIDFromFileName(String s)
Returns a resource identifier from a string.

Specified by:
getIDFromFileName in class GCUBEFilePersistenceDelegate<GCUBEWSResourceKey,RESOURCE extends GCUBEWSResource>
Parameters:
s - the string.
Returns:
the identifier.


Copyright © 2012. All Rights Reserved.