org.apache.cocoon.components.store
Class FilesystemStore

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.components.store.FilesystemStore
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.Loggable, Store, org.apache.avalon.framework.thread.ThreadSafe

public final class FilesystemStore
extends org.apache.avalon.framework.logger.AbstractLoggable
implements org.apache.avalon.framework.context.Contextualizable, Store, org.apache.avalon.framework.thread.ThreadSafe


Field Summary
protected  java.io.File directoryFile
          The directory repository
protected  java.lang.String directoryPath
           
 
Fields inherited from interface org.apache.cocoon.components.store.Store
ROLE
 
Constructor Summary
FilesystemStore()
           
 
Method Summary
protected  void addKeys(org.apache.cocoon.components.store.FilesystemStore.FSEnumeration enum, java.io.File directory)
           
 boolean containsKey(java.lang.Object key)
          Indicates if the given key is associated to a contained object.
 void contextualize(org.apache.avalon.framework.context.Context context)
           
protected  java.io.File fileFromKey(java.lang.Object key)
           
 void free()
           
 java.lang.Object get(java.lang.Object key)
          Get the file associated with the given unique key name.
 java.lang.String getDirectoryPath()
          Returns the repository's full pathname
 java.lang.Object getObject(java.lang.Object key)
           
 java.lang.String getString(java.lang.Object key)
           
 void hold(java.lang.Object key, java.lang.Object value)
          Holds the given object in a volatile state.
 java.util.Enumeration keys()
          Returns the list of stored files as an Enumeration of Files
 void remove(java.lang.Object key)
          Remove the object associated to the given key.
 void setDirectory(java.io.File directory)
          Sets the repository's location
 void setDirectory(java.lang.String directory)
          Sets the repository's location
 void store(java.lang.Object key, java.lang.Object value)
          Store the given object in a persistent state. 1) Null values generate empty directories. 2) String values are dumped to text files 3) Object values are serialized
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directoryFile

protected java.io.File directoryFile
The directory repository

directoryPath

protected volatile java.lang.String directoryPath
Constructor Detail

FilesystemStore

public FilesystemStore()
Method Detail

setDirectory

public void setDirectory(java.lang.String directory)
                  throws java.io.IOException
Sets the repository's location

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable

setDirectory

public void setDirectory(java.io.File directory)
                  throws java.io.IOException
Sets the repository's location

getDirectoryPath

public java.lang.String getDirectoryPath()
Returns the repository's full pathname

get

public java.lang.Object get(java.lang.Object key)
Get the file associated with the given unique key name.
Specified by:
get in interface Store

store

public void store(java.lang.Object key,
                  java.lang.Object value)
           throws java.io.IOException
Store the given object in a persistent state. 1) Null values generate empty directories. 2) String values are dumped to text files 3) Object values are serialized
Specified by:
store in interface Store

hold

public void hold(java.lang.Object key,
                 java.lang.Object value)
          throws java.io.IOException
Holds the given object in a volatile state.
Specified by:
hold in interface Store

remove

public void remove(java.lang.Object key)
Remove the object associated to the given key.
Specified by:
remove in interface Store

containsKey

public boolean containsKey(java.lang.Object key)
Indicates if the given key is associated to a contained object.
Specified by:
containsKey in interface Store

keys

public java.util.Enumeration keys()
Returns the list of stored files as an Enumeration of Files
Specified by:
keys in interface Store

addKeys

protected void addKeys(org.apache.cocoon.components.store.FilesystemStore.FSEnumeration enum,
                       java.io.File directory)

fileFromKey

protected java.io.File fileFromKey(java.lang.Object key)

getString

public java.lang.String getString(java.lang.Object key)
                           throws java.io.IOException

free

public void free()
Specified by:
free in interface Store

getObject

public java.lang.Object getObject(java.lang.Object key)
                           throws java.io.IOException,
                                  java.lang.ClassNotFoundException


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.