org.globus.wsrf.utils
Class FilePersistenceHelper

java.lang.Object
  extended byorg.globus.wsrf.utils.FilePersistenceHelper
Direct Known Subclasses:
XmlPersistenceHelper

public class FilePersistenceHelper
extends Object

This helper contains common functions for managing persistent information stored as files.


Nested Class Summary
private static class FilePersistenceHelper.Filter
           
 
Field Summary
protected  Class beanClass
           
private static String FILE_PERSISTENCE_DIR
           
protected  String fileSuffix
           
private static org.globus.util.I18n i18n
           
private static org.apache.commons.logging.Log logger
           
static String SERVER_ID
           
protected  File storageDir
           
 
Constructor Summary
FilePersistenceHelper(Class beanClass, String suffix)
          Creates FilePersistenceHelper with default storage directory based on the beanClass name and specified suffix.
FilePersistenceHelper(Class beanClass, String storageDir, String suffix)
          Creates FilePersistenceHelper with specific storage directory and file suffix.
 
Method Summary
 Class getBeanClass()
           
private static String getDefaultStorageDir(Class beanClass)
           
 String getFileSuffix()
           
 File getKeyAsFile(Object key)
          Create a file object based on the key supplied in parameter.
private static String getServerID()
           
 File getStorageDirectory()
           
 List list()
          This function returns the keys of the objects that have been stored.
 void remove(Object key)
           
 void removeAll()
          Removes all stored objects from file system.
protected  void setStorageDirectory(String strDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

i18n

private static org.globus.util.I18n i18n

SERVER_ID

public static final String SERVER_ID
See Also:
Constant Field Values

FILE_PERSISTENCE_DIR

private static final String FILE_PERSISTENCE_DIR

logger

private static org.apache.commons.logging.Log logger

beanClass

protected Class beanClass

storageDir

protected File storageDir

fileSuffix

protected String fileSuffix
Constructor Detail

FilePersistenceHelper

public FilePersistenceHelper(Class beanClass,
                             String suffix)
                      throws IOException
Creates FilePersistenceHelper with default storage directory based on the beanClass name and specified suffix.


FilePersistenceHelper

public FilePersistenceHelper(Class beanClass,
                             String storageDir,
                             String suffix)
                      throws IOException
Creates FilePersistenceHelper with specific storage directory and file suffix.

Method Detail

getServerID

private static String getServerID()

getDefaultStorageDir

private static String getDefaultStorageDir(Class beanClass)
                                    throws IOException
Throws:
IOException

setStorageDirectory

protected void setStorageDirectory(String strDir)
                            throws IOException
Throws:
IOException

getStorageDirectory

public File getStorageDirectory()

getFileSuffix

public String getFileSuffix()

getBeanClass

public Class getBeanClass()

getKeyAsFile

public File getKeyAsFile(Object key)
Create a file object based on the key supplied in parameter. The file name will follow the format:

file name :== (class name)_(key scalar value).xml

where:


remove

public void remove(Object key)
            throws ResourceException
Throws:
ResourceException

list

public List list()
          throws IOException
This function returns the keys of the objects that have been stored. This should be used by the home in order to recover state, by listing all the stored object keys and adding them to the map of resources. The consumer code must test for null.

Returns:
List the list of key values
Throws:
IOException

removeAll

public void removeAll()
               throws IOException
Removes all stored objects from file system.

Throws:
IOException