USERKEY - The user's key.STOREKEY - The key type used by the storage medium.VALUE - The values stored.public interface NodeStore<USERKEY,STOREKEY,VALUE>
The bridge code from Java objects to stored documents.
Implementors of this interface will be doing much of what a DAO would do,
and a little more. Specifically functions like convert(Object)
and generateKey(Node, Object) are critical but not something a
traditional DAO would exposing.
All exceptions are NodeStoreExceptions which is itself a
RuntimeException. Note that loadNode(Object) is
unique in that it will throw a NodeStoreNodeNotFoundException
(which is a type of NodeStoreException).
| Modifier and Type | Method and Description |
|---|---|
STOREKEY |
convert(USERKEY key)
Convert user keys to store keys.
|
STOREKEY |
generateKey(Node<USERKEY,STOREKEY> node,
VALUE value)
Generate a key to store a node or data element.
|
VALUE |
loadData(STOREKEY key)
Load the user's data.
|
Node<USERKEY,STOREKEY> |
loadNode(STOREKEY key)
Load a node object from
NodeStore. |
void |
removeData(STOREKEY key)
Remove the given data key.
|
void |
removeNode(STOREKEY key)
Remove the given node key.
|
void |
store(STOREKEY key,
Node<USERKEY,STOREKEY> node)
Store the given node.
|
void |
store(STOREKEY key,
VALUE data)
Store user data.
|
VALUE loadData(STOREKEY key)
NodeStoreExceptionNode<USERKEY,STOREKEY> loadNode(STOREKEY key)
NodeStore.NodeStoreExceptionNodeStoreNodeNotFoundException - When a node is not found.void store(STOREKEY key, VALUE data)
NodeStoreExceptionvoid store(STOREKEY key, Node<USERKEY,STOREKEY> node)
NodeStoreExceptionvoid removeNode(STOREKEY key)
NodeStoreExceptionvoid removeData(STOREKEY key)
NodeStoreExceptionSTOREKEY generateKey(Node<USERKEY,STOREKEY> node, VALUE value)
node - This is provided to implementations for some context.
If generateKey is being called for the purposes of
storing a user key, this will be null.value - If a key is being generated for a user key value, it will
be passed along. This is most useful
when things like a PagedList
are adding a value, but the List API does not
provide a way to specify a key.NodeStoreExceptionSTOREKEY convert(USERKEY key)
NodeStoreException - if any error occurs.