| java.lang.Object |
| ↳ |
org.mule.modules.ObjectStoreModule |
Known Direct Subclasses
|
Known Indirect Subclasses
|
Class Overview
Generic module for accessing Object Stores.
Can be used with Mule default implementations or one can be passed via ref. It allows to store,
retrieve and remove objects from the store.
Summary
| Fields |
|
private
ObjectStore |
objectStore |
Reference to an Object Store bean. |
|
private
ObjectStoreManager |
objectStoreManager |
|
|
private
String |
partition |
Name of the partition in the default in-memory or persistent object stores (this argument has no
meaning if the object store is passed by ref using objectStore-ref)
|
|
private
boolean |
persistent |
Specified whenever the required store needs to be persistent or not (this argument has no
meaning if the object store is passed by ref using objectStore-ref)
|
|
private
Registry |
registry |
|
| Public Methods |
|
List<Serializable>
|
allKeys()
Returns a list of all the keys in the store.
|
|
void
|
dualStore(String key, Serializable value, boolean overwrite)
Store value using key, and also store key using value.
|
|
ObjectStoreManager
|
getObjectStoreManager()
|
|
void
|
init()
|
|
Object
|
remove(String key)
Remove the object with key.
|
|
Object
|
retrieve(String key, Object defaultValue)
Retrieve the given Object.
|
|
void
|
setObjectStore(ObjectStore objectStore)
|
|
void
|
setObjectStoreManager(ObjectStoreManager objectStoreManager)
|
|
void
|
setPartition(String partition)
|
|
void
|
setPersistent(boolean persistent)
|
|
void
|
setRegistry(Registry registry)
|
|
void
|
store(String key, Serializable value, boolean overwrite)
|
|
[Expand]
Inherited Methods |
From class
java.lang.Object
|
Object
|
clone()
|
|
boolean
|
equals(Object arg0)
|
|
void
|
finalize()
|
|
final
Class<?>
|
getClass()
|
|
int
|
hashCode()
|
|
final
void
|
notify()
|
|
final
void
|
notifyAll()
|
|
String
|
toString()
|
|
final
void
|
wait()
|
|
final
void
|
wait(long arg0, int arg1)
|
|
final
void
|
wait(long arg0)
|
|
Fields
private
ObjectStore
objectStore
Reference to an Object Store bean. This is optional and if it is not specified then the default
in-memory or persistent store will be used.
private
ObjectStoreManager
objectStoreManager
private
String
partition
Name of the partition in the default in-memory or persistent object stores (this argument has no
meaning if the object store is passed by ref using objectStore-ref)
private
boolean
persistent
Specified whenever the required store needs to be persistent or not (this argument has no
meaning if the object store is passed by ref using objectStore-ref)
private
Registry
registry
Public Constructors
public
ObjectStoreModule
()
Public Methods
public
List<Serializable>
allKeys
()
Returns a list of all the keys in the store.
IMPORTANT: Not all stores support this method. If the method is not supported a java.lang.UnsupportedOperationException is thrown
Returns
- a java.util.List with all the keys in the store.
public
void
dualStore
(String key, Serializable value, boolean overwrite)
Store value using key, and also store key using value.
Parameters
| key
| The identifier of the object to store |
| value
| The object to store. If you want this to be the payload then use value-ref="#[payload]". |
| overwrite
| True if you want to overwrite the existing object. |
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. Only thrown if overwrite is false.
|
public
ObjectStoreManager
getObjectStoreManager
()
public
Object
remove
(String key)
Remove the object with key.
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 occurred |
| ObjectDoesNotExistException
| if no value for the given key was previously stored.
|
public
Object
retrieve
(String key, Object defaultValue)
Retrieve the given Object.
Parameters
| key
| The identifier of the object to retrieve. |
| defaultValue
| The default value if the key does not exists. |
Returns
- The object associated with the given key. If no object for the given key was found
this method throws an org.mule.api.store.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.
|
public
void
setObjectStore
(ObjectStore objectStore)
public
void
setObjectStoreManager
(ObjectStoreManager objectStoreManager)
public
void
setPartition
(String partition)
public
void
setPersistent
(boolean persistent)
public
void
setRegistry
(Registry registry)
public
void
store
(String key, Serializable value, boolean overwrite)
Parameters
| key
| The identifier of the object to store |
| value
| The object to store. If you want this to be the payload then use value-ref="#[payload]". |
| overwrite
| True if you want to overwrite the existing object. |
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. Only thrown if overwrite is false.
|