org.mule.util.store
Class TextFileObjectStore
java.lang.Object
org.mule.util.store.AbstractMonitoredObjectStore<T>
org.mule.util.store.InMemoryObjectStore<String>
org.mule.util.store.TextFileObjectStore
- All Implemented Interfaces:
- Runnable, MuleContextAware, Disposable, Initialisable, ObjectStore<String>
public class TextFileObjectStore
- extends InMemoryObjectStore<String>
A Simple object store that stores String objects by key to a text file. This store
is only suitable for storing simple key value pair strings. This store is backed
by an in-memory store and supports the ability to expire and apply TTL to objects
in the store.
Methods inherited from class org.mule.util.store.AbstractMonitoredObjectStore |
getEntryTTL, getExpirationInterval, getMaxEntries, getName, getScheduler, run, setEntryTTL, setExpirationInterval, setMaxEntries, setMuleContext, setName, setScheduler |
fileStore
protected File fileStore
directory
protected String directory
encoding
protected String encoding
TextFileObjectStore
public TextFileObjectStore()
isPersistent
public boolean isPersistent()
- Is this store persistent?
- Specified by:
isPersistent
in interface ObjectStore<String>
- Overrides:
isPersistent
in class InMemoryObjectStore<String>
- Returns:
- true if this store is persistent
initialise
public void initialise()
throws InitialisationException
- Description copied from interface:
Initialisable
- Method used to perform any initialisation work. If a fatal error occurs during
initialisation an
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.
- Specified by:
initialise
in interface Initialisable
- Overrides:
initialise
in class AbstractMonitoredObjectStore<String>
- Throws:
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdown
RecoverableException
- if an error occurs that can be recovered from
loadFromStore
protected void loadFromStore()
throws Exception
- Throws:
Exception
store
public void store(Serializable id,
String item)
throws ObjectStoreException
- Description copied from interface:
ObjectStore
- Store the given Object.
- Specified by:
store
in interface ObjectStore<String>
- Overrides:
store
in class InMemoryObjectStore<String>
- Parameters:
id
- the identifier for value
item
- 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.
getDirectory
public String getDirectory()
setDirectory
public void setDirectory(String directory)
getEncoding
public String getEncoding()
setEncoding
public void setEncoding(String encoding)
dispose
public void dispose()
- Description copied from interface:
Disposable
- A lifecycle method where implementor should free up any resources. If an
exception is thrown it should just be logged and processing should continue.
This method should not throw Runtime exceptions.
- Specified by:
dispose
in interface Disposable
- Overrides:
dispose
in class AbstractMonitoredObjectStore<String>
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.