org.mule.util.store
Class AbstractObjectStore<T extends Serializable>
java.lang.Object
org.mule.util.store.AbstractObjectStore<T>
- All Implemented Interfaces:
- ObjectStore<T>
- Direct Known Subclasses:
- QueuePersistenceObjectStore, SimpleMemoryObjectStore
public abstract class AbstractObjectStore<T extends Serializable>
- extends Object
- implements ObjectStore<T>
This is an abstract superclass for ObjectStore
implementations that conforms to the
contract defined in the interface's javadocs. Subclasses only need to implement storing the
actual objects.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final Log logger
AbstractObjectStore
public AbstractObjectStore()
contains
public boolean contains(Serializable key)
throws ObjectStoreException
- Description copied from interface:
ObjectStore
- Check whether the given Object is already registered with this store.
- Specified by:
contains
in interface ObjectStore<T extends Serializable>
- Parameters:
key
- the identifier of the object to check
- Returns:
true
if the key is stored or false
no value was stored for
the key.
- Throws:
ObjectStoreException
- if the given key is null
.
ObjectStoreNotAvaliableException
- if any implementation-specific error occured, e.g.
when the store is not available
doContains
protected abstract boolean doContains(Serializable key)
throws ObjectStoreException
- Throws:
ObjectStoreException
store
public void store(Serializable key,
T value)
throws ObjectStoreException
- Description copied from interface:
ObjectStore
- Store the given Object.
- Specified by:
store
in interface ObjectStore<T extends Serializable>
- Parameters:
key
- the identifier for value
value
- the Object to store with key
- Throws:
ObjectStoreException
- if the given key cannot be stored or is null
.
ObjectStoreNotAvaliableException
- if the store is not available or any other
implementation-specific error occured.
ObjectAlreadyExistsException
- if an attempt is made to store an object for a key
that already has an object associated.
doStore
protected abstract void doStore(Serializable key,
T value)
throws ObjectStoreException
- Throws:
ObjectStoreException
retrieve
public T retrieve(Serializable key)
throws ObjectStoreException
- Description copied from interface:
ObjectStore
- Retrieve the given Object.
- Specified by:
retrieve
in interface ObjectStore<T extends Serializable>
- Parameters:
key
- the identifier of the object to retrieve.
- Returns:
- the object associated with the given key. If no object for the given key was found
this method throws an
ObjectDoesNotExistException
.
- Throws:
ObjectStoreException
- if the given key is null
.
ObjectStoreNotAvaliableException
- if the store is not available or any other
implementation-specific error occured.
ObjectDoesNotExistException
- if no value for the given key was previously stored.
doRetrieve
protected abstract T doRetrieve(Serializable key)
throws ObjectStoreException
- Throws:
ObjectStoreException
remove
public T remove(Serializable key)
throws ObjectStoreException
- Description copied from interface:
ObjectStore
- Remove the object with key.
- Specified by:
remove
in interface ObjectStore<T extends Serializable>
- Parameters:
key
- the identifier of the object to remove.
- Returns:
- the object that was previously stored for the given key
- Throws:
ObjectStoreException
- if the given key is null
or if the store is not
available or any other implementation-specific error occured
ObjectDoesNotExistException
- if no value for the given key was previously stored.
doRemove
protected abstract T doRemove(Serializable key)
throws ObjectStoreException
- Throws:
ObjectStoreException
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.