| 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.excalibur.store.impl.AbstractReadWriteStore
org.apache.excalibur.store.impl.AbstractFilesystemStore
Stores objects on the filesystem: String objects as text files, all other objects are serialized. This class must be subclassed in order to set the directory the store should work on.
| Field Summary | |
protected  java.io.File | 
m_directoryFile
The directory repository  | 
protected  java.lang.String | 
m_directoryPath
 | 
| Fields inherited from class org.apache.excalibur.store.impl.AbstractReadWriteStore | 
lock | 
| Fields inherited from interface org.apache.excalibur.store.Store | 
PERSISTENT_STORE, ROLE, TRANSIENT_STORE | 
| Constructor Summary | |
AbstractFilesystemStore()
 | 
|
| Method Summary | |
protected  void | 
addKeys(org.apache.excalibur.store.impl.AbstractFilesystemStore.FSEnumeration enumer,
        java.io.File directory)
 | 
protected  int | 
countKeys(java.io.File directory)
 | 
protected  java.lang.String | 
decode(java.lang.String filename)
Inverse of encode exept it do not use path.  | 
 java.lang.Object | 
deserializeObject(java.io.File file)
This method deserializes an object from an input stream.  | 
 java.lang.String | 
deserializeString(java.io.File file)
Load a text file contents as a String | 
protected  void | 
doClear()
Clear the Store of all elements  | 
protected  boolean | 
doContainsKey(java.lang.Object key)
Indicates if the given key is associated to a contained object.  | 
protected  void | 
doFree()
Try to free some used memory.  | 
protected  java.lang.Object | 
doGet(java.lang.Object key)
Get the File object associated with the given unique key name.  | 
protected  java.util.Enumeration | 
doGetKeys()
Returns the list of stored files as an Enumeration of Files  | 
protected  int | 
doGetSize()
Returns count of the objects in the store, or -1 if could not be obtained.  | 
protected  void | 
doRemove(java.lang.Object key)
Remove the object associated to the given key.  | 
protected  void | 
doStore(java.lang.Object key,
        java.lang.Object value)
Store the given object in a persistent state.  | 
protected  java.lang.String | 
encode(java.lang.String s)
Returns a String that uniquely identifies the object.  | 
protected  java.io.File | 
fileFromKey(java.lang.Object key)
 | 
 void | 
free()
Try to free some used memory.  | 
 java.lang.String | 
getDirectoryPath()
Returns the repository's full pathname  | 
 java.lang.String | 
getFullFilename(java.io.File file)
Get the complete filename corresponding to a (typically relative) File. | 
 java.lang.Object | 
getObject(java.lang.Object key)
 | 
 java.lang.String | 
getString(java.lang.Object key)
 | 
 void | 
serializeObject(java.io.File file,
                java.lang.Object object)
This method serializes an object to an output stream.  | 
 void | 
serializeString(java.io.File file,
                java.lang.String string)
Dump a String to a text file. | 
 void | 
setDirectory(java.io.File directory)
Sets the repository's location  | 
 void | 
setDirectory(java.lang.String directory)
Sets the repository's location  | 
| Methods inherited from class org.apache.excalibur.store.impl.AbstractReadWriteStore | 
clear, containsKey, get, getChildInstrumentables, getInstrumentableName, getInstruments, keys, remove, setInstrumentableName, size, store | 
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled | 
enableLogging, getLogger, setupLogger, setupLogger, setupLogger | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface org.apache.excalibur.store.Store | 
clear, containsKey, get, keys, remove, size, store | 
| Field Detail | 
protected java.io.File m_directoryFile
protected volatile java.lang.String m_directoryPath
| Constructor Detail | 
public AbstractFilesystemStore()
| Method Detail | 
public void setDirectory(java.lang.String directory)
                  throws java.io.IOException
java.io.IOException
public void setDirectory(java.io.File directory)
                  throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getDirectoryPath()
protected java.lang.Object doGet(java.lang.Object key)
doGet in class AbstractReadWriteStore
protected void doStore(java.lang.Object key,
                       java.lang.Object value)
                throws java.io.IOException
doStore in class AbstractReadWriteStorejava.io.IOExceptionprotected void doRemove(java.lang.Object key)
doRemove in class AbstractReadWriteStoreprotected void doClear()
doClear in class AbstractReadWriteStoreprotected boolean doContainsKey(java.lang.Object key)
doContainsKey in class AbstractReadWriteStoreprotected java.util.Enumeration doGetKeys()
doGetKeys in class AbstractReadWriteStoreprotected int doGetSize()
doGetSize in class AbstractReadWriteStore
protected void addKeys(org.apache.excalibur.store.impl.AbstractFilesystemStore.FSEnumeration enumer,
                       java.io.File directory)
protected int countKeys(java.io.File directory)
protected java.io.File fileFromKey(java.lang.Object key)
public java.lang.String getString(java.lang.Object key)
                           throws java.io.IOException
java.io.IOExceptionpublic void free()
Store
free in interface Storefree in class AbstractReadWriteStoreprotected void doFree()
AbstractReadWriteStore
doFree in class AbstractReadWriteStore
public java.lang.Object getObject(java.lang.Object key)
                           throws java.io.IOException,
                                  java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundExceptionprotected java.lang.String decode(java.lang.String filename)
protected java.lang.String encode(java.lang.String s)
public void serializeString(java.io.File file,
                            java.lang.String string)
                     throws java.io.IOException
String to a text file.
file - The output filestring - The string to be dumped
java.io.IOException - IO Error
public java.lang.String deserializeString(java.io.File file)
                                   throws java.io.IOException
String.
 This method does not perform enconding conversions
 
- Parameters:
 file - The input file
- Returns:
 - The file contents as a 
String
 - Throws:
 java.io.IOException - IO Error
 
public void serializeObject(java.io.File file,
                            java.lang.Object object)
                     throws java.io.IOException
file - The output fileobject - The object to be serialized
java.io.IOException - IOError
public java.lang.Object deserializeObject(java.io.File file)
                                   throws java.io.IOException,
                                          java.lang.ClassNotFoundException
file - The input file
java.io.IOException - IOError
java.lang.ClassNotFoundExceptionpublic java.lang.String getFullFilename(java.io.File file)
File.
 This method accounts for the possibility of an error in getting
 the filename's canonical path, returning the io/error-safe
 absolute form instead
file - The file
  | 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||