Package helma.objectmodel.db
Class NodeHandle
java.lang.Object
helma.objectmodel.db.NodeHandle
- All Implemented Interfaces:
INodeState
,Serializable
This class is a handle or reference to a Node. This is to abstract from different
methods of reference: Transient Nodes are referred to directly, while persistent
nodes are referred to via key/node manager.
A handle is used to refer to a node in a safe way over a longer period.
While a direct reference may point to a node that has been evicted from the cache
and reinstanciated since being set, NodeHandle will always return an up-to-date
instance of its node.
Helma tries to ensure the following rules on NodeHandles:
- For transient nodes there exists only one NodeHandle.
- If a transient node becomes persistent its node handle is notified and converted into a persistent NodeHandle.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This is to notify the handle that the underlying node is becoming persistent and we have to refer to it via the key from now on.boolean
getID()
Get the ID for the node described by this handle.getKey()
Get the key for the node described by this handle.getNode
(WrappedNodeManager nodemgr) Get the node described by this node handleboolean
hasNode()
Check if the node is available without fetching it from the node managertoString()
-
Constructor Details
-
NodeHandle
Builds a handle given a node's retrieval information. At the time this is called, the node is ususally not yet created. It will be fetched on demand when accessed by application code.- Parameters:
key
- the key
-
-
Method Details
-
getNode
Get the node described by this node handle -
hasNode
public boolean hasNode()Check if the node is available without fetching it from the node manager- Returns:
- true if we alreay have a reference to our node
-
getKey
Get the key for the node described by this handle. This will return null for transient Nodes. -
getID
Get the ID for the node described by this handle. This may only be called on persistent Nodes. -
equals
-
becomePersistent
protected void becomePersistent()This is to notify the handle that the underlying node is becoming persistent and we have to refer to it via the key from now on. -
toString
-