Interface NodeStore<USERKEY,STOREKEY,VALUE>
-
- Type Parameters:
USERKEY- The user's key.STOREKEY- The key type used by the storage medium.VALUE- The values stored.
- All Known Implementing Classes:
DirectoryNodeStore,IONodeStore,TransactionalNodeStore
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)andgenerateKey(Node, Object)are critical but not something a traditional DAO would exposing.All exceptions are
NodeStoreExceptions which is itself aRuntimeException. Note thatloadNode(Object)is unique in that it will throw aNodeStoreNodeNotFoundException(which is a type ofNodeStoreException).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description STOREKEYconvert(USERKEY key)Convert user keys to store keys.STOREKEYgenerateKey(Node<USERKEY,STOREKEY> node, VALUE value)Generate a key to store a node or data element.VALUEloadData(STOREKEY key)Load the user's data.Node<USERKEY,STOREKEY>loadNode(STOREKEY key)Load a node object fromNodeStore.voidremoveData(STOREKEY key)Remove the given data key.voidremoveNode(STOREKEY key)Remove the given node key.voidstore(STOREKEY key, Node<USERKEY,STOREKEY> node)Store the given node.voidstore(STOREKEY key, VALUE data)Store user data.
-
-
-
Method Detail
-
loadData
VALUE loadData(STOREKEY key)
Load the user's data.- Returns:
- the user's data or null if it is not found.
- Throws:
NodeStoreException
-
loadNode
Node<USERKEY,STOREKEY> loadNode(STOREKEY key)
Load a node object fromNodeStore.- Throws:
NodeStoreExceptionNodeStoreNodeNotFoundException- When a node is not found.
-
store
void store(STOREKEY key, VALUE data)
Store user data. If an object already exists at the key, it should be replaced.- Throws:
NodeStoreException
-
store
void store(STOREKEY key, Node<USERKEY,STOREKEY> node)
Store the given node. If an object already exists at the key, it should be replaced.- Throws:
NodeStoreException
-
removeNode
void removeNode(STOREKEY key)
Remove the given node key. If the key does not exist, this should return without error.- Throws:
NodeStoreException
-
removeData
void removeData(STOREKEY key)
Remove the given data key. If the key does not exist, this should return without error.- Throws:
NodeStoreException
-
generateKey
STOREKEY generateKey(Node<USERKEY,STOREKEY> node, VALUE value)
Generate a key to store a node or data element. This key must be unique.- Parameters:
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 aPagedListare adding a value, but the List API does not provide a way to specify a key.- Throws:
NodeStoreException
-
convert
STOREKEY convert(USERKEY key)
Convert user keys to store keys. This method, given a user's key, must always produce the same store key.- Throws:
NodeStoreException- if any error occurs.
-
-