public class PersistentObjectStorePartition<T extends Serializable> extends Object implements ListableObjectStore<T>, ExpirableObjectStore<T>
Modifier and Type | Class and Description |
---|---|
static class |
PersistentObjectStorePartition.StoreValue<T> |
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
contains(Serializable key)
Check whether the given Object is already registered with this store.
|
protected void |
createDirectory(File directory) |
protected File |
createFileToStoreObject() |
protected File |
createOrRetrievePartitionDescriptorFile() |
protected void |
deleteStoreFile(File file) |
protected PersistentObjectStorePartition.StoreValue<T> |
deserialize(File file) |
void |
expire(int entryTTL,
int maxEntries) |
String |
getPartitionName() |
boolean |
isPersistent()
Is this store persistent?
|
void |
open()
Open the underlying store.
|
T |
remove(Serializable key)
Remove the object with key.
|
T |
retrieve(Serializable key)
Retrieve the given Object.
|
protected void |
serialize(File outputFile,
PersistentObjectStorePartition.StoreValue<T> storeValue) |
void |
store(Serializable key,
T value)
Store the given Object.
|
protected final Log logger
public void open() throws ObjectStoreException
ListableObjectStore
open
in interface ListableObjectStore<T extends Serializable>
ObjectStoreException
- if an exception occurred while opening the underlying store.public void close() throws ObjectStoreException
ListableObjectStore
close
in interface ListableObjectStore<T extends Serializable>
ObjectStoreException
- if an exception occurred while closing the underlying store.public List<Serializable> allKeys() throws ObjectStoreException
allKeys
in interface ListableObjectStore<T extends Serializable>
ObjectStoreException
- if an exception occurred while collecting the list of all keys.public boolean contains(Serializable key) throws ObjectStoreException
ObjectStore
contains
in interface ObjectStore<T extends Serializable>
key
- the identifier of the object to checktrue
if the key is stored or false
no value
was stored for the key.ObjectStoreException
- if the given key is null
.ObjectStoreNotAvaliableException
- if any implementation-specific error
occured, e.g. when the store is not availablepublic void store(Serializable key, T value) throws ObjectStoreException
ObjectStore
store
in interface ObjectStore<T extends Serializable>
key
- the identifier for value
value
- the Object to store with key
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.public void clear() throws ObjectStoreException
ObjectStore
clear
in interface ObjectStore<T extends Serializable>
ObjectStoreException
- if the operation failspublic T retrieve(Serializable key) throws ObjectStoreException
ObjectStore
retrieve
in interface ObjectStore<T extends Serializable>
key
- the identifier of the object to retrieve.ObjectDoesNotExistException
.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 T remove(Serializable key) throws ObjectStoreException
ObjectStore
remove
in interface ObjectStore<T extends Serializable>
key
- the identifier of the object to remove.ObjectStoreException
- if the given key is null
or if the
store is not available or any other implementation-specific error
occuredObjectDoesNotExistException
- if no value for the given key was
previously stored.public boolean isPersistent()
ObjectStore
isPersistent
in interface ObjectStore<T extends Serializable>
public void expire(int entryTTL, int maxEntries) throws ObjectStoreException
expire
in interface ExpirableObjectStore<T extends Serializable>
ObjectStoreException
protected void createDirectory(File directory) throws ObjectStoreException
ObjectStoreException
protected File createFileToStoreObject() throws ObjectStoreException
ObjectStoreException
protected File createOrRetrievePartitionDescriptorFile() throws ObjectStoreException
ObjectStoreException
protected void serialize(File outputFile, PersistentObjectStorePartition.StoreValue<T> storeValue) throws ObjectStoreException
ObjectStoreException
protected PersistentObjectStorePartition.StoreValue<T> deserialize(File file) throws ObjectStoreException
ObjectStoreException
protected void deleteStoreFile(File file) throws ObjectStoreException
ObjectStoreException
public String getPartitionName()
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.