Package helma.objectmodel.db
Class NodeHandle
- java.lang.Object
-
- helma.objectmodel.db.NodeHandle
-
- All Implemented Interfaces:
INodeState
,java.io.Serializable
public final class NodeHandle extends java.lang.Object implements INodeState, java.io.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NodeHandle(Key key)
Builds a handle given a node's retrieval information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.boolean
equals(java.lang.Object other)
java.lang.String
getID()
Get the ID for the node described by this handle.Key
getKey()
Get the key for the node described by this handle.Node
getNode(WrappedNodeManager nodemgr)
Get the node described by this node handleboolean
hasNode()
Check if the node is available without fetching it from the node managerjava.lang.String
toString()
-
-
-
Constructor Detail
-
NodeHandle
public NodeHandle(Key key)
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 Detail
-
getNode
public Node getNode(WrappedNodeManager nodemgr)
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
public Key getKey()
Get the key for the node described by this handle. This will return null for transient Nodes.
-
getID
public java.lang.String getID()
Get the ID for the node described by this handle. This may only be called on persistent Nodes.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
- ...- Returns:
- ...
-
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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- ...
-
-