org.apache.excalibur.store.impl
Class AbstractJispFilesystemStore

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

public abstract class AbstractJispFilesystemStore
extends AbstractReadWriteStore

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  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(Object key)
          Test if the the index file contains the given key
protected  void doFree()
          Try to free some used memory.
protected  Object doGet(Object key)
          Returns a Object from the store associated with the Key Object
protected  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(Object key)
          Removes a value from the data file with the given key.
protected  void doStore(Object key, 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(File directory)
          Sets the repository's location
protected  com.coyotegulch.jisp.KeyObject wrapKeyObject(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
 

Field Detail

m_directoryFile

protected 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(File directory)
                  throws IOException
Sets the repository's location

Throws:
IOException

doGet

protected Object doGet(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(Object key,
                       Object value)
                throws 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:
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(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(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 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(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-2012 The Apache Software Foundation. All Rights Reserved.