|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkrati.sos.ObjectStoreAgent<K,V>
K
- KeyV
- Valuepublic class ObjectStoreAgent<K,V>
ObjectStoreAgent: An agent that wraps an ObjectStore can have inbound and outbound ObjectHandler(s). The inbound handler is associated with the put method. It is called on an inbound object before the object is passed down to the underlying ObjectStore. The outbound handler is associated with the get method. It is called on an outbound object before the object is returned back to the ObjectStore visitor. Either inbound or outbound handlers does not affect the delete method.
get(K key) + get object from the underlying store + Call the outbound handler on the object + return the object put(K key, V value) + Call the inbound handler on the value object + delegate operation put to the underlying store
Field Summary | |
---|---|
protected ObjectHandler<V> |
_inboundHandler
|
protected ObjectHandler<V> |
_outboundHandler
|
protected ObjectStore<K,V> |
_store
|
Constructor Summary | |
---|---|
ObjectStoreAgent(ObjectStore<K,V> store,
ObjectHandler<V> inboundHandler,
ObjectHandler<V> outboundHandler)
|
Method Summary | |
---|---|
void |
clear()
Clears this object store by removing all the persisted data permanently. |
boolean |
delete(K key)
|
V |
get(K key)
|
byte[] |
getBytes(byte[] keyBytes)
Gets an object in the form of byte array from the store. |
byte[] |
getBytes(K key)
Gets an object in the form of byte array from the store. |
ObjectHandler<V> |
getInboundHandler()
|
ObjectStore<K,V> |
getObjectStore()
|
ObjectHandler<V> |
getOutboundHandler()
|
Iterator<Map.Entry<K,V>> |
iterator()
|
Iterator<K> |
keyIterator()
|
void |
persist()
Persists this object store. |
boolean |
put(K key,
V value)
|
void |
sync()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ObjectStore<K,V> _store
protected ObjectHandler<V> _inboundHandler
protected ObjectHandler<V> _outboundHandler
Constructor Detail |
---|
public ObjectStoreAgent(ObjectStore<K,V> store, ObjectHandler<V> inboundHandler, ObjectHandler<V> outboundHandler)
Method Detail |
---|
public ObjectStore<K,V> getObjectStore()
public ObjectHandler<V> getInboundHandler()
public ObjectHandler<V> getOutboundHandler()
public boolean delete(K key) throws Exception
delete
in interface DataStore<K,V>
Exception
public V get(K key)
get
in interface DataStore<K,V>
public boolean put(K key, V value) throws Exception
put
in interface DataStore<K,V>
Exception
public void sync() throws IOException
sync
in interface DataStore<K,V>
IOException
public void persist() throws IOException
persist
in interface DataStore<K,V>
IOException
public void clear() throws IOException
clear
in interface DataStore<K,V>
IOException
public byte[] getBytes(K key)
ObjectStore
getBytes
in interface ObjectStore<K,V>
key
- the retrieving key.
public byte[] getBytes(byte[] keyBytes)
ObjectStore
getBytes
in interface ObjectStore<K,V>
public Iterator<K> keyIterator()
keyIterator
in interface DataStore<K,V>
public Iterator<Map.Entry<K,V>> iterator()
iterator
in interface Iterable<Map.Entry<K,V>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |