org.apache.servicemix.store
Interface Store

All Known Implementing Classes:
JdbcStore, MemoryStore, TimeoutMemoryStore

public interface Store

A Store is an interface representing a storage where objects can be put and retrieved. A store can support different features, mainly persistence, clustered or transactional. A store is not designed to be a thread-safe map. If a user tries to store an object with an existing id, the behavior is undefined.

Author:
gnodet

Field Summary
static java.lang.String CLUSTERED
           
static java.lang.String PERSISTENT
           
static java.lang.String TRANSACTIONAL
           
 
Method Summary
 boolean hasFeature(java.lang.String name)
          Returns true if the store implementation supports the given feature.
 java.lang.Object load(java.lang.String id)
          Loads an object that has been previously stored under the specified key.
 java.lang.String store(java.lang.Object data)
          Put an object into the store and return the unique id that may be used at a later time to retrieve the object.
 void store(java.lang.String id, java.lang.Object data)
          Put an object in the store under the given id.
 

Field Detail

PERSISTENT

static final java.lang.String PERSISTENT
See Also:
Constant Field Values

CLUSTERED

static final java.lang.String CLUSTERED
See Also:
Constant Field Values

TRANSACTIONAL

static final java.lang.String TRANSACTIONAL
See Also:
Constant Field Values
Method Detail

hasFeature

boolean hasFeature(java.lang.String name)
Returns true if the store implementation supports the given feature.

Parameters:
name - the feature to check
Returns:
true if the feature is supported

store

void store(java.lang.String id,
           java.lang.Object data)
           throws java.io.IOException
Put an object in the store under the given id. This method must be used with caution and the behavior is unspecified if an object already exist for the same id.

Parameters:
id - the id of the object to store
data - the object to store
Throws:
java.io.IOException - if an error occurs

store

java.lang.String store(java.lang.Object data)
                       throws java.io.IOException
Put an object into the store and return the unique id that may be used at a later time to retrieve the object.

Parameters:
data - the object to store
Returns:
the id of the object stored
Throws:
java.io.IOException - if an error occurs

load

java.lang.Object load(java.lang.String id)
                      throws java.io.IOException
Loads an object that has been previously stored under the specified key. The object is removed from the store.

Parameters:
id - the id of the object
Returns:
the object, or null> if the object could not be found
Throws:
java.io.IOException - if an error occurs


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.