org.apache.cocoon.components.store
Class JispFilesystemStore

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

public final class JispFilesystemStore
extends org.apache.avalon.framework.logger.AbstractLoggable
implements Store, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.parameters.Parameterizable

This store is based on the Jisp library (http://www.coyotegulch.com/jisp/index.html). This store uses B-Tree indexes to access variable-length serialized data stored in files.

Version:
CVS $Id: JispFilesystemStore.java,v 1.2 2002/02/22 07:00:13 cziegeler Exp $
Author:
Gerhard Froehlich, Vadim Gritsenko

Field Summary
protected  java.io.File cacheDir
           
protected  java.io.File directoryFile
          The directory repository
protected  java.lang.String directoryPath
           
protected  java.io.File workDir
           
 
Fields inherited from interface org.apache.cocoon.components.store.Store
PERSISTENT_CACHE, ROLE, TRANSIENT_CACHE
 
Constructor Summary
JispFilesystemStore()
           
 
Method Summary
 boolean containsKey(java.lang.Object key)
          Test if the the index file contains the given key
 void contextualize(org.apache.avalon.framework.context.Context context)
          Contextualize the Component
 void free()
          Frees some values of the data file.
TODO: implementation
 java.lang.Object get(java.lang.Object key)
          Returns a Object from the store associated with the Key Object
 java.lang.String getDirectoryPath()
          Returns the repository's full pathname
 void hold(java.lang.Object key, java.lang.Object value)
          Holds the given object in the indexed data file.
 void initialize()
          Initialize the Component
 java.util.Enumeration keys()
          Returns a Enumeration of all Keys in the indexed file.
 void parameterize(org.apache.avalon.framework.parameters.Parameters params)
          Configure the Component.
A few options can be used datafile = the name of the data file (Default: cocoon.dat) indexfile = the name of the index file (Default: cocoon.idx) order = The page size of the B-Tree
 void remove(java.lang.Object key)
          Removes a value from the data file with 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
 int size()
          Returns count of the objects in the store, or -1 if could not be obtained.
 void store(java.lang.Object key, java.lang.Object value)
          Store the given object in the indexed data file.
 
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

workDir

protected java.io.File workDir

cacheDir

protected java.io.File cacheDir

directoryFile

protected java.io.File directoryFile
The directory repository

directoryPath

protected volatile java.lang.String directoryPath
Constructor Detail

JispFilesystemStore

public JispFilesystemStore()
Method Detail

setDirectory

public void setDirectory(java.lang.String directory)
                  throws java.io.IOException
Sets the repository's location
Parameters:
directory - the new directory value
Throws:
java.io.IOException -  

setDirectory

public void setDirectory(java.io.File directory)
                  throws java.io.IOException
Sets the repository's location
Parameters:
directory - the new directory value
Throws:
java.io.IOException -  

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Contextualize the Component
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Parameters:
context - the Context of the Application
Throws:
org.apache.avalon.framework.context.ContextException -  

parameterize

public void parameterize(org.apache.avalon.framework.parameters.Parameters params)
                  throws org.apache.avalon.framework.parameters.ParameterException
Configure the Component.
A few options can be used
Specified by:
parameterize in interface org.apache.avalon.framework.parameters.Parameterizable
Parameters:
params - the configuration paramters
Throws:
org.apache.avalon.framework.parameters.ParameterException -  

initialize

public void initialize()
Initialize the Component
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable

getDirectoryPath

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

get

public java.lang.Object get(java.lang.Object key)
Returns a Object from the store associated with the Key Object
Specified by:
get in interface Store
Parameters:
key - the Key object
Returns:
the Object associated with Key Object

store

public void store(java.lang.Object key,
                  java.lang.Object value)
           throws java.io.IOException
Store the given object in the indexed data file.
Specified by:
store in interface Store
Parameters:
key - the key object
value - the value object
Throws:
java.io.IOException -  

hold

public void hold(java.lang.Object key,
                 java.lang.Object value)
          throws java.io.IOException
Holds the given object in the indexed data file.
Specified by:
hold in interface Store
Parameters:
key - the key object
value - the value object
Throws:
java.io.IOException -  

free

public void free()
Frees some values of the data file.
TODO: implementation
Specified by:
free in interface Store

remove

public void remove(java.lang.Object key)
Removes a value from the data file with the given key.
Specified by:
remove in interface Store
Parameters:
key - the key object

containsKey

public boolean containsKey(java.lang.Object key)
Test if the the index file contains the given key
Specified by:
containsKey in interface Store
Parameters:
key - the key object
Returns:
true if Key exists and false if not

keys

public java.util.Enumeration keys()
Returns a Enumeration of all Keys in the indexed file.
Specified by:
keys in interface Store
Returns:
Enumeration Object with all existing keys

size

public int size()
Description copied from interface: Store
Returns count of the objects in the store, or -1 if could not be obtained.
Specified by:
size in interface Store


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