de.fzj.unicore.wsrflite.persistence
Class AbstractStore

java.lang.Object
  extended by de.fzj.unicore.wsrflite.persistence.AbstractStore
All Implemented Interfaces:
IPersistenceProperties, Store
Direct Known Subclasses:
Persistence

public abstract class AbstractStore
extends Object
implements Store

Base functionality shared by all persistence implementations provides optional load-once semantics

Author:
schuller, j.daivandy@fz-juelich.de
See Also:
LoadSemantics

Field Summary
protected  ConcurrentMap<String,WSRFInstance> instances
           
protected  String serviceName
           
protected  PersistenceSettings settings
           
protected  Set<String> uniqueIDs
           
 
Fields inherited from interface de.fzj.unicore.wsrflite.persistence.IPersistenceProperties
WSRF_PERSIST_CLASSNAME, WSRF_PERSIST_STORAGE_DIRECTORY
 
Constructor Summary
AbstractStore()
           
 
Method Summary
protected abstract  WSRFInstanceBean _getForUpdate(String uniqueID, long time, TimeUnit timeUnit)
           
protected abstract  void _getUniqueIDs()
           
protected abstract  void _persist(WSRFInstanceBean bean)
           
protected abstract  WSRFInstanceBean _read(String uniqueID)
           
protected abstract  void _remove(String uniqueID)
           
protected abstract  void _unlock(WSRFInstanceBean bean)
           
 long getCacheHits()
           
 WSRFInstance getForUpdate(String uniqueID, long time, TimeUnit timeUnit)
          get and lock a live instance from storage.
 PersistenceSettings getPersistenceSettings()
           
 String getServiceName()
           
 String[] getUniqueIDs()
          retrieve a list of all unique ids
 void init(String serviceName)
          initialise the store
 void persist(WSRFInstance inst)
          persist a single wsrf instance
 WSRFInstance read(String uniqueID)
          read an instance from storage.
 void remove(String uniqueID)
          Delete an instance, and cleanup the persistence.
 void setPersistenceSettings(PersistenceSettings ps)
           
 int size()
          returns the number of instances in this store
 void unlock(WSRFInstance inst)
          clear lock for the given instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.fzj.unicore.wsrflite.persistence.Store
getTerminationTimes, purgePersistentData, setTerminationTime, shutdown
 

Field Detail

serviceName

protected String serviceName

uniqueIDs

protected final Set<String> uniqueIDs

settings

protected PersistenceSettings settings

instances

protected ConcurrentMap<String,WSRFInstance> instances
Constructor Detail

AbstractStore

public AbstractStore()
Method Detail

init

public void init(String serviceName)
Description copied from interface: Store
initialise the store

Specified by:
init in interface Store
Parameters:
serviceName - The name of the service that is persisted

persist

public void persist(WSRFInstance inst)
Description copied from interface: Store
persist a single wsrf instance

Specified by:
persist in interface Store

unlock

public void unlock(WSRFInstance inst)
Description copied from interface: Store
clear lock for the given instance

Specified by:
unlock in interface Store

_unlock

protected abstract void _unlock(WSRFInstanceBean bean)
                         throws Exception
Throws:
Exception

_persist

protected abstract void _persist(WSRFInstanceBean bean)
                          throws Exception
Throws:
Exception

getUniqueIDs

public String[] getUniqueIDs()
Description copied from interface: Store
retrieve a list of all unique ids

Specified by:
getUniqueIDs in interface Store
Returns:

_getUniqueIDs

protected abstract void _getUniqueIDs()

read

public WSRFInstance read(String uniqueID)
Description copied from interface: Store
read an instance from storage.

Specified by:
read in interface Store
Returns:
null if instance does not exist

_read

protected abstract WSRFInstanceBean _read(String uniqueID)
                                   throws Exception
Throws:
Exception

getForUpdate

public WSRFInstance getForUpdate(String uniqueID,
                                 long time,
                                 TimeUnit timeUnit)
                          throws TimeoutException
Description copied from interface: Store
get and lock a live instance from storage.
This is necessary to aquire write permission

Specified by:
getForUpdate in interface Store
Parameters:
uniqueID - - the id of the instance to read
time - - the maximum time to wait when aquiring a lock
timeUnit - - the time units
Throws:
TimeoutException

_getForUpdate

protected abstract WSRFInstanceBean _getForUpdate(String uniqueID,
                                                  long time,
                                                  TimeUnit timeUnit)
                                           throws Exception
Throws:
Exception

remove

public void remove(String uniqueID)
Description copied from interface: Store
Delete an instance, and cleanup the persistence. A held lock will be released and deleted.

Specified by:
remove in interface Store

_remove

protected abstract void _remove(String uniqueID)

size

public int size()
Description copied from interface: Store
returns the number of instances in this store

Specified by:
size in interface Store
Returns:

getCacheHits

public long getCacheHits()

setPersistenceSettings

public void setPersistenceSettings(PersistenceSettings ps)

getPersistenceSettings

public PersistenceSettings getPersistenceSettings()

getServiceName

public String getServiceName()


Copyright © 2010. All Rights Reserved.