org.apache.excalibur.store.impl
Class MemoryStore

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.excalibur.store.impl.MemoryStore
All Implemented Interfaces:
Component, LogEnabled, Store, ThreadSafe

public class MemoryStore
extends AbstractLogEnabled
implements Store, ThreadSafe

Version:
CVS $Id: MemoryStore.java,v 1.4 2004/02/28 11:47:31 cziegeler Exp $
Author:
Avalon Development Team

Field Summary
protected  java.util.Hashtable m_table
          The shared store
 
Fields inherited from interface org.apache.excalibur.store.Store
PERSISTENT_STORE, ROLE, TRANSIENT_STORE
 
Constructor Summary
MemoryStore()
           
 
Method Summary
 void clear()
          Clear the Store of all elements
 boolean containsKey(java.lang.Object key)
          Indicates if the given key is associated to a contained object.
 void free()
          Try to free some used memory.
 java.lang.Object get(java.lang.Object key)
          Get the object associated to the given unique key.
 java.util.Enumeration keys()
          Returns the list of used keys as an Enumeration of Objects.
 void remove(java.lang.Object key)
          Remove the object associated to the given key.
 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 a persistent state.
 
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_table

protected java.util.Hashtable m_table
The shared store

Constructor Detail

MemoryStore

public MemoryStore()
Method Detail

get

public java.lang.Object get(java.lang.Object key)
Get the object associated to the given unique key.

Specified by:
get in interface Store

store

public void store(java.lang.Object key,
                  java.lang.Object value)
Store the given object in a persistent state. It is up to the caller to ensure that the key has a persistent state across different JVM executions.

Specified by:
store 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

clear

public void clear()
Clear the Store of all elements

Specified by:
clear in interface Store

free

public void free()
Description copied from interface: Store
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:
free 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 used keys as an Enumeration of Objects.

Specified by:
keys in interface Store

size

public int size()
Returns count of the objects in the store, or -1 if could not be obtained.

Specified by:
size in interface Store


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