org.apache.servicemix.store.memory
Class MemoryStore

java.lang.Object
  extended by org.apache.servicemix.store.memory.MemoryStore
All Implemented Interfaces:
Store
Direct Known Subclasses:
TimeoutMemoryStore

public class MemoryStore
extends java.lang.Object
implements Store

A simple memory store implementation based on a simple map. This store is neither clusterable, nor persistent, nor transactional.

Author:
gnodet

Field Summary
 
Fields inherited from interface org.apache.servicemix.store.Store
CLUSTERED, PERSISTENT, TRANSACTIONAL
 
Constructor Summary
MemoryStore(IdGenerator idGenerator)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryStore

public MemoryStore(IdGenerator idGenerator)
Method Detail

hasFeature

public boolean hasFeature(java.lang.String name)
Description copied from interface: Store
Returns true if the store implementation supports the given feature.

Specified by:
hasFeature in interface Store
Parameters:
name - the feature to check
Returns:
true if the feature is supported

store

public void store(java.lang.String id,
                  java.lang.Object data)
           throws java.io.IOException
Description copied from interface: Store
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.

Specified by:
store in interface Store
Parameters:
id - the id of the object to store
data - the object to store
Throws:
java.io.IOException - if an error occurs

store

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

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

load

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

Specified by:
load in interface 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.