org.jboss.cache
Interface NodeFactory<K,V>

All Known Implementing Classes:
AbstractNodeFactory, MVCCNodeFactory, OptimisticNodeFactory, PessimisticNodeFactory

public interface NodeFactory<K,V>

An interface for a factory that creates nodes. This used to be a concrete class prior to 3.0.0. Made into an interface to simplify logic of different locking schemes and node types.

Since:
3.0
Author:
Manik Surtani (manik AT jboss DOT org)

Method Summary
 InternalNode<K,V> createChildNode(Fqn fqn, InternalNode<K,V> parent, InvocationContext ctx, boolean attachToParent)
          Creates a new node, and optionally attaches the node to its parent.
 InternalNode<K,V> createInternalNode(Fqn childFqn)
          Creates an internal node.
 NodeSPI<K,V> createNode(Fqn fqn, NodeSPI<K,V> parent)
          Creates a new, empty node.
 NodeSPI<K,V> createNode(Fqn fqn, NodeSPI<K,V> parent, Map<K,V> data)
          Creates a new node and populates its attributes.
 NodeSPI<K,V> createNode(Object childName, NodeSPI<K,V> parent)
          Creates a new, empty node.
 NodeSPI<K,V> createNode(Object childName, NodeSPI<K,V> parent, Map<K,V> data)
          Creates a new node and populates its attributes.
 NodeSPI<K,V> createRootNode()
           
 ReadCommittedNode createWrappedNode(InternalNode<K,V> node, InternalNode<K,V> parent)
           
 WorkspaceNode<K,V> createWrappedNode(NodeSPI<K,V> dataNode, TransactionWorkspace workspace)
           
 ReadCommittedNode createWrappedNodeForRemoval(Fqn fqn, InternalNode<K,V> node, InternalNode<K,V> parent)
           
 

Method Detail

createWrappedNode

ReadCommittedNode createWrappedNode(InternalNode<K,V> node,
                                    InternalNode<K,V> parent)

createWrappedNodeForRemoval

ReadCommittedNode createWrappedNodeForRemoval(Fqn fqn,
                                              InternalNode<K,V> node,
                                              InternalNode<K,V> parent)

createWrappedNode

WorkspaceNode<K,V> createWrappedNode(NodeSPI<K,V> dataNode,
                                     TransactionWorkspace workspace)

createNode

NodeSPI<K,V> createNode(Fqn fqn,
                        NodeSPI<K,V> parent,
                        Map<K,V> data)
Creates a new node and populates its attributes.

Note that the data map passed in must not be null, and must not be referenced anywhere else as a defensive copy is NOT made when injecting it into the node.

Parameters:
fqn -
parent -
data -
Returns:
a new node

createNode

NodeSPI<K,V> createNode(Object childName,
                        NodeSPI<K,V> parent,
                        Map<K,V> data)
Creates a new node and populates its attributes.

Note that the data map passed in must not be null, and must not be referenced anywhere else as a defensive copy is NOT made when injecting it into the node.

Parameters:
childName -
parent -
data -
Returns:
a new node

createNode

NodeSPI<K,V> createNode(Fqn fqn,
                        NodeSPI<K,V> parent)
Creates a new, empty node.

Parameters:
fqn -
parent -
Returns:
a new node

createNode

NodeSPI<K,V> createNode(Object childName,
                        NodeSPI<K,V> parent)
Creates a new, empty node.

Parameters:
childName -
parent -
Returns:
a new node

createChildNode

InternalNode<K,V> createChildNode(Fqn fqn,
                                  InternalNode<K,V> parent,
                                  InvocationContext ctx,
                                  boolean attachToParent)
Creates a new node, and optionally attaches the node to its parent.

The assumption here is that any locks are acquired to prevent concurrent creation of the same node. Implementations of the NodeFactory should not attempt to synchronize or guard against concurrent creation.

Parameters:
fqn - fqn of node to create. Must not be null or root.
parent - parent to attach to. Must not be null, even if attachToParent is false.
ctx - invocation context to register with. Must not be null.
attachToParent - if true, the node is registered in the parent's child map. If false, it is not.
Returns:
a new node, or the existing node if one existed.

createRootNode

NodeSPI<K,V> createRootNode()

createInternalNode

InternalNode<K,V> createInternalNode(Fqn childFqn)
Creates an internal node. Similar to createNode(Fqn, NodeSPI) except that the resultant node is not wrapped in a NodeInvocationDelegate.

Parameters:
childFqn -
Returns:
a new node


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.