de.fzj.unicore.wsrflite.persistence
Class InMemory

java.lang.Object
  extended by de.fzj.unicore.wsrflite.persistence.InMemory
All Implemented Interfaces:
IPersistenceProperties, Store

public class InMemory
extends Object
implements Store

map-based storage class

Author:
schuller

Field Summary
protected  Map<String,Calendar> terminationTimes
           
 
Fields inherited from interface de.fzj.unicore.wsrflite.persistence.IPersistenceProperties
WSRF_PERSIST_CLASSNAME, WSRF_PERSIST_STORAGE_DIRECTORY
 
Constructor Summary
InMemory()
           
 
Method Summary
 WSRFInstance getForUpdate(String uniqueID, long time, TimeUnit timeUnit)
          get and lock a live instance from storage.
 PersistenceSettings getPersistenceSettings()
           
 Map<String,Calendar> getTerminationTimes()
          gets current termination times for all ws-resources in this store
 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
 void purgePersistentData()
          Fully deletes persistent data, for example after service undeployment
 WSRFInstance read(String uniqueID)
          read an instance from storage.
 void remove(String uniqueID)
          Delete an instance, and cleanup the persistence.
 void setPersistenceSettings(PersistenceSettings ps)
           
 void setTerminationTime(String uniqueID, Calendar c)
          sets termination time for a ws-resource
 void shutdown()
          shutdown the store
 int size()
          returns the number of instances in this store
 void unlock(WSRFInstance i)
          clear lock for the given instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

terminationTimes

protected Map<String,Calendar> terminationTimes
Constructor Detail

InMemory

public InMemory()
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

shutdown

public void shutdown()
Description copied from interface: Store
shutdown the store

Specified by:
shutdown in interface Store

persist

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

Specified by:
persist in interface Store

getUniqueIDs

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

Specified by:
getUniqueIDs in interface Store
Returns:

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

getForUpdate

public WSRFInstance getForUpdate(String uniqueID,
                                 long time,
                                 TimeUnit timeUnit)
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

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

unlock

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

Specified by:
unlock in interface Store

size

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

Specified by:
size in interface Store
Returns:

setPersistenceSettings

public void setPersistenceSettings(PersistenceSettings ps)

getPersistenceSettings

public PersistenceSettings getPersistenceSettings()

getTerminationTimes

public Map<String,Calendar> getTerminationTimes()
Description copied from interface: Store
gets current termination times for all ws-resources in this store

Specified by:
getTerminationTimes in interface Store
Returns:
Map terminationTimes

setTerminationTime

public void setTerminationTime(String uniqueID,
                               Calendar c)
Description copied from interface: Store
sets termination time for a ws-resource

Specified by:
setTerminationTime in interface Store

purgePersistentData

public void purgePersistentData()
Description copied from interface: Store
Fully deletes persistent data, for example after service undeployment

Specified by:
purgePersistentData in interface Store


Copyright © 2010. All Rights Reserved.