org.jboss.dna.connector.inmemory
Class InMemoryRepository

java.lang.Object
  extended by org.jboss.dna.connector.inmemory.InMemoryRepository

@NotThreadSafe
public class InMemoryRepository
extends Object

Author:
Randall Hauch

Constructor Summary
InMemoryRepository(String name, UUID rootNodeUUID)
           
 
Method Summary
 Node copyNode(ExecutionContext context, Node original, Node newParent, boolean recursive)
           
 Node createNode(ExecutionContext context, Node parentNode, Name name, UUID uuid)
          Create a new node with the supplied name, as a child of the supplied parent.
 Node createNode(ExecutionContext context, String pathToNewNode)
          Create a node at the supplied path.
 ReadWriteLock getLock()
           
 Path getLowestExistingPath(Path path)
          Find the lowest existing node along the path.
 String getName()
           
 Node getNode(ExecutionContext context, String path)
           
 Node getNode(Path path)
          Find a node with the given path.
 Node getNode(UUID uuid)
           
 Node getRoot()
           
 void moveNode(ExecutionContext context, Node node, Node newParent)
          Move the supplied node to the new parent.
 void removeNode(ExecutionContext context, Node node)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryRepository

public InMemoryRepository(String name,
                          UUID rootNodeUUID)
Method Detail

getLock

public ReadWriteLock getLock()
Returns:
lock

getName

public String getName()
Returns:
name

getRoot

public Node getRoot()

getNode

public Node getNode(UUID uuid)

getNode

public Node getNode(ExecutionContext context,
                    String path)

getNode

public Node getNode(Path path)
Find a node with the given path.

Parameters:
path - the path to the node; may not be null
Returns:
the node with the path, or null if the node does not exist

getLowestExistingPath

public Path getLowestExistingPath(Path path)
Find the lowest existing node along the path.

Parameters:
path - the path to the node; may not be null
Returns:
the lowest existing node along the path, or the root node if no node exists on the path

removeNode

public void removeNode(ExecutionContext context,
                       Node node)

createNode

public Node createNode(ExecutionContext context,
                       String pathToNewNode)
Create a node at the supplied path. The parent of the new node must already exist.

Parameters:
context - the environment; may not be null
pathToNewNode - the path to the new node; may not be null
Returns:
the new node (or root if the path specified the root)

createNode

public Node createNode(ExecutionContext context,
                       Node parentNode,
                       Name name,
                       UUID uuid)
Create a new node with the supplied name, as a child of the supplied parent.

Parameters:
context - the execution context
parentNode - the parent node; may not be null
name - the name; may not be null
uuid - the UUID of the node, or null if the UUID is to be generated
Returns:
the new node

moveNode

public void moveNode(ExecutionContext context,
                     Node node,
                     Node newParent)
Move the supplied node to the new parent. This method automatically removes the node from its existing parent, and also correctly adjusts the index to be correct in the new parent.

Parameters:
context -
node - the node to be moved; may not be the root
newParent - the new parent; may not be the root

copyNode

public Node copyNode(ExecutionContext context,
                     Node original,
                     Node newParent,
                     boolean recursive)


Copyright © 2008-Present JBoss a division of Red Hat. All Rights Reserved.