org.mule.util.store
Class QueuePersistenceObjectStore<T extends Serializable>

java.lang.Object
  extended by org.mule.util.store.AbstractObjectStore<T>
      extended by org.mule.util.store.QueuePersistenceObjectStore<T>
All Implemented Interfaces:
MuleContextAware, ListableObjectStore<T>, ObjectStore<T>

public class QueuePersistenceObjectStore<T extends Serializable>
extends AbstractObjectStore<T>
implements ListableObjectStore<T>, MuleContextAware

This is an ObjectStore implementation that is to be used to persist messages on Mule's internal queues. Note that this is a specialized implementation of the ObjectStore interface which hard-codes the location of the persistence folder to $MULE_HOME/.mule/queuestore.

This implementation uses Java serialization to implement persistence.


Field Summary
static String DEFAULT_QUEUE_STORE
          The default queueStore directory for persistence
 
Fields inherited from class org.mule.util.store.AbstractObjectStore
logger
 
Constructor Summary
QueuePersistenceObjectStore()
          Default constructor for Spring.
QueuePersistenceObjectStore(MuleContext context)
           
 
Method Summary
 List<Serializable> allKeys()
           
 void clear()
          Removes all items of this store without disposing it, meaning that after performing a clear(), you should still be able perform other operations.
 void close()
          Close the underlying store.
protected  List<Serializable> collectAllKeys()
           
protected  void createStoreDirectory(File directory)
           
protected  File createStoreFile(Serializable key)
           
protected  void deleteStoreFile(File file)
           
protected  T deserialize(File file)
           
protected  boolean doContains(Serializable key)
           
protected  T doRemove(Serializable key)
           
protected  T doRetrieve(Serializable key)
           
protected  void doStore(Serializable key, T value)
           
protected  void ensureStoreDirectoryExists(File outputFile)
           
 boolean isPersistent()
          Is this store persistent?
protected  void listStoredFiles(File directory, List<Serializable> keys)
           
 void open()
          Open the underlying store.
protected  void serialize(T value, File outputFile)
           
 void setMuleContext(MuleContext context)
           
 
Methods inherited from class org.mule.util.store.AbstractObjectStore
contains, remove, retrieve, store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.api.store.ObjectStore
contains, remove, retrieve, store
 

Field Detail

DEFAULT_QUEUE_STORE

public static final String DEFAULT_QUEUE_STORE
The default queueStore directory for persistence

See Also:
Constant Field Values
Constructor Detail

QueuePersistenceObjectStore

public QueuePersistenceObjectStore()
Default constructor for Spring.


QueuePersistenceObjectStore

public QueuePersistenceObjectStore(MuleContext context)
Method Detail

isPersistent

public boolean isPersistent()
Is this store persistent?

Specified by:
isPersistent in interface ObjectStore<T extends Serializable>
Returns:
true if this store is persistent

open

public void open()
          throws ObjectStoreException
Description copied from interface: ListableObjectStore
Open the underlying store.

Specified by:
open in interface ListableObjectStore<T extends Serializable>
Throws:
ObjectStoreException - if an exception occurred while opening the underlying store.

clear

public void clear()
           throws ObjectStoreException
Description copied from interface: ObjectStore
Removes all items of this store without disposing it, meaning that after performing a clear(), you should still be able perform other operations. Implementations of this method have to remove all items in the fastest way possible. No assumptions should be made regarding thread safeness. If the store implementation is thread-safe, then this method should also be. If the implementation does not guarantee thread-safeness, then you shouldn't expect that from this method either.

Specified by:
clear in interface ObjectStore<T extends Serializable>
Throws:
ObjectStoreException - if the operation fails

createStoreDirectory

protected void createStoreDirectory(File directory)
                             throws ObjectStoreException
Throws:
ObjectStoreException

close

public void close()
           throws ObjectStoreException
Description copied from interface: ListableObjectStore
Close the underlying store.

Specified by:
close in interface ListableObjectStore<T extends Serializable>
Throws:
ObjectStoreException - if an exception occurred while closing the underlying store.

allKeys

public List<Serializable> allKeys()
                           throws ObjectStoreException
Specified by:
allKeys in interface ListableObjectStore<T extends Serializable>
Returns:
list containing all keys that this object store currently holds values for.
Throws:
ObjectStoreException - if an exception occurred while collecting the list of all keys.

collectAllKeys

protected List<Serializable> collectAllKeys()
                                     throws ObjectStoreException
Throws:
ObjectStoreException

listStoredFiles

protected void listStoredFiles(File directory,
                               List<Serializable> keys)
                        throws IOException,
                               ClassNotFoundException
Throws:
IOException
ClassNotFoundException

doContains

protected boolean doContains(Serializable key)
                      throws ObjectStoreException
Specified by:
doContains in class AbstractObjectStore<T extends Serializable>
Throws:
ObjectStoreException

doStore

protected void doStore(Serializable key,
                       T value)
                throws ObjectStoreException
Specified by:
doStore in class AbstractObjectStore<T extends Serializable>
Throws:
ObjectStoreException

ensureStoreDirectoryExists

protected void ensureStoreDirectoryExists(File outputFile)
                                   throws ObjectStoreException
Throws:
ObjectStoreException

serialize

protected void serialize(T value,
                         File outputFile)
                  throws ObjectStoreException
Throws:
ObjectStoreException

doRetrieve

protected T doRetrieve(Serializable key)
                                     throws ObjectStoreException
Specified by:
doRetrieve in class AbstractObjectStore<T extends Serializable>
Throws:
ObjectStoreException

createStoreFile

protected File createStoreFile(Serializable key)
                        throws ObjectStoreException
Throws:
ObjectStoreException

deserialize

protected T deserialize(File file)
                                      throws ObjectStoreException
Throws:
ObjectStoreException

doRemove

protected T doRemove(Serializable key)
                                   throws ObjectStoreException
Specified by:
doRemove in class AbstractObjectStore<T extends Serializable>
Throws:
ObjectStoreException

deleteStoreFile

protected void deleteStoreFile(File file)
                        throws ObjectStoreException
Throws:
ObjectStoreException

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.