org.apache.excalibur.store.impl
Class AbstractJispFilesystemStore

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.excalibur.store.impl.AbstractReadWriteStore
          extended byorg.apache.excalibur.store.impl.AbstractJispFilesystemStore
All Implemented Interfaces:
Component, LogEnabled, Store, ThreadSafe
Direct Known Subclasses:
JispFilesystemStore

public abstract class AbstractJispFilesystemStore
extends AbstractReadWriteStore
implements Store, ThreadSafe

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: AbstractJispFilesystemStore.java,v 1.7 2004/02/28 11:47:31 cziegeler Exp $
Author:
Avalon Development Team

Field Summary
protected  com.coyotegulch.jisp.IndexedObjectDatabase m_Database
          The database
protected  java.io.File m_directoryFile
          The directory repository
protected  com.coyotegulch.jisp.BTreeIndex m_Index
          And the index
 
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
AbstractJispFilesystemStore()
           
 
Method Summary
protected  void doClear()
          Clear the Store of all elements
protected  boolean doContainsKey(java.lang.Object key)
          Test if the the index file contains the given key
protected  void doFree()
          Try to free some used memory.
protected  java.lang.Object doGet(java.lang.Object key)
          Returns a Object from the store associated with the Key Object
protected  java.util.Enumeration doGetKeys()
          Returns a Enumeration of all Keys in the indexed file.
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)
          Removes a value from the data file with the given key.
protected  void doStore(java.lang.Object key, java.lang.Object value)
          Store the given object in the indexed data file.
 void free()
          Frees some values of the data file.
TODO: implementation
protected  com.coyotegulch.jisp.KeyObject getNullKey()
          Return the Null JispKey
 void setDirectory(java.io.File directory)
          Sets the repository's location
protected  com.coyotegulch.jisp.KeyObject wrapKeyObject(java.lang.Object key)
          This method wraps around the key Object a Jisp KeyObject.
 
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

m_directoryFile

protected java.io.File m_directoryFile
The directory repository


m_Database

protected com.coyotegulch.jisp.IndexedObjectDatabase m_Database
The database


m_Index

protected com.coyotegulch.jisp.BTreeIndex m_Index
And the index

Constructor Detail

AbstractJispFilesystemStore

public AbstractJispFilesystemStore()
Method Detail

setDirectory

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

Throws:
java.io.IOException

doGet

protected java.lang.Object doGet(java.lang.Object key)
Returns a Object from the store associated with the Key Object

Specified by:
doGet in class AbstractReadWriteStore
Parameters:
key - the Key object
Returns:
the Object associated with Key Object

doStore

protected void doStore(java.lang.Object key,
                       java.lang.Object value)
                throws java.io.IOException
Store the given object in the indexed data file.

Specified by:
doStore in class AbstractReadWriteStore
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
Overrides:
free in class AbstractReadWriteStore

doFree

protected void doFree()
Description copied from class: AbstractReadWriteStore
Try to free some used memory. The transient store can simply remove some hold data, the persistent store can free all memory by writing the data to a persistent store etc.

Specified by:
doFree in class AbstractReadWriteStore

doClear

protected void doClear()
Clear the Store of all elements

Specified by:
doClear in class AbstractReadWriteStore

doRemove

protected void doRemove(java.lang.Object key)
Removes a value from the data file with the given key.

Specified by:
doRemove in class AbstractReadWriteStore
Parameters:
key - the key object

doContainsKey

protected boolean doContainsKey(java.lang.Object key)
Test if the the index file contains the given key

Specified by:
doContainsKey in class AbstractReadWriteStore
Parameters:
key - the key object
Returns:
true if Key exists and false if not

doGetKeys

protected java.util.Enumeration doGetKeys()
Returns a Enumeration of all Keys in the indexed file.

Specified by:
doGetKeys in class AbstractReadWriteStore
Returns:
Enumeration Object with all existing keys

doGetSize

protected int doGetSize()
Description copied from class: AbstractReadWriteStore
Returns count of the objects in the store, or -1 if could not be obtained.

Specified by:
doGetSize in class AbstractReadWriteStore

wrapKeyObject

protected com.coyotegulch.jisp.KeyObject wrapKeyObject(java.lang.Object key)
This method wraps around the key Object a Jisp KeyObject.

Parameters:
key - the key object
Returns:
the wrapped key object

getNullKey

protected com.coyotegulch.jisp.KeyObject getNullKey()
Return the Null JispKey



Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.