org.apache.excalibur.store
Interface Store

All Superinterfaces:
Component
All Known Implementing Classes:
AbstractFilesystemStore, AbstractJispFilesystemStore, AbstractReadWriteStore, JispFilesystemStore, MemoryStore, MRUMemoryStore

public interface Store
extends Component

A Store is an object managing arbitrary data. It holds data stored under a given key persistently. So if you put something in a store you can be sure that the next time (even if the application restarted) your data is in the store (of course unless noone else did remove it). In some cases (like for example a cache) the data needs not to be persistent. Therefore with the two role TRANSIENT_STORE and PERSISTENT_STORE you get a store with exactly that behaviour.

Version:
CVS $Id: Store.java,v 1.5 2004/02/28 11:47:34 cziegeler Exp $
Author:
Avalon Development Team

Field Summary
static java.lang.String PERSISTENT_STORE
          The role for a persistent store
static java.lang.String ROLE
          The role for a persistent store
static java.lang.String TRANSIENT_STORE
          The role for a transient store
 
Method Summary
 void clear()
          Clear the Store of all data it holds
 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.
 

Field Detail

ROLE

public static final java.lang.String ROLE
The role for a persistent store


TRANSIENT_STORE

public static final java.lang.String TRANSIENT_STORE
The role for a transient store


PERSISTENT_STORE

public static final java.lang.String PERSISTENT_STORE
The role for a persistent store

Method Detail

get

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


store

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

Throws:
java.io.IOException

free

public void free()
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.


remove

public void remove(java.lang.Object key)
Remove the object associated to the given key.


clear

public void clear()
Clear the Store of all data it holds


containsKey

public boolean containsKey(java.lang.Object key)
Indicates if the given key is associated to a contained object.


keys

public java.util.Enumeration keys()
Returns the list of used keys as an Enumeration of Objects.


size

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



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