story.dbcore.repositories
Class NodeRepository

java.lang.Object
  extended by story.dbcore.repositories.NodeRepository

public class NodeRepository
extends java.lang.Object

NodeRepository allows storage of and random access to nodes in a single, unstructured pool. This is an abstract class, and no actual types of repositories are a part of the db-core. The applications on top (flashback, scheherazade, etc) have classes that extend NodeRepository.

This class is only meant to be instantiated and handled by a Document.


Constructor Summary
NodeRepository(Document doc, NodeRepositoryConfig config)
          Starts a new repository.
 
Method Summary
 void addNode(GenericNode node, NodeID nodeID)
           
 boolean containsNode(NodeID ID)
          Does this repository contain a node of a paritcular ID?
 java.util.Enumeration getAllNodes()
          Return an Enumeration of all nodes in the repository.
 NodeRepositoryID getID()
          Retrieve this Repository's ID.
 GenericNode getNode(NodeID nodeID)
          Retrieve a node from the repository.
 NodeID getNodeID(GenericNode node)
          Retrieve the NodeID of a node if it is in the repository.
 RepositoryType getType()
          Get the repository type.
 DocumentID memberOf()
          Retreive the identifier of this repository's parent Document.
 int numberOfNodes()
          Retrieve the number of nodes in the repository
 void removeNode(GenericNode deadNode)
          Remove a node from the repository.
 NodeID renameNode(NodeID currentID, NodeID newID)
          Rename a node.
 java.lang.StringBuffer renderNodeList()
          Render a roster of nodes in the repository into a StringBuffer.
 void validateInstanceNodes()
          Validate the instance nodes in this repository
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeRepository

public NodeRepository(Document doc,
                      NodeRepositoryConfig config)
Starts a new repository.

Method Detail

addNode

public void addNode(GenericNode node,
                    NodeID nodeID)
             throws Scheherexception
Throws:
Scheherexception

getType

public RepositoryType getType()
Get the repository type.


removeNode

public void removeNode(GenericNode deadNode)
                throws Scheherexception
Remove a node from the repository.

Note: This function assumes that all links have already been cut from the node.

Parameters:
deadNode - The node to remove.
Throws:
Scheherexception

numberOfNodes

public int numberOfNodes()
Retrieve the number of nodes in the repository


getID

public NodeRepositoryID getID()
                       throws Scheherexception
Retrieve this Repository's ID.

Throws:
Scheherexception

getNode

public GenericNode getNode(NodeID nodeID)
                    throws Scheherexception
Retrieve a node from the repository.

Parameters:
nodeID - Identifier of node to retrieve.
Throws:
Scheherexception

renameNode

public NodeID renameNode(NodeID currentID,
                         NodeID newID)
                  throws Scheherexception
Rename a node.

Parameters:
currentID - The current ID of the node.
newID - The new ID of the node.
Throws:
Scheherexception

getNodeID

public NodeID getNodeID(GenericNode node)
                 throws Scheherexception
Retrieve the NodeID of a node if it is in the repository.

Throws:
Scheherexception

getAllNodes

public java.util.Enumeration getAllNodes()
Return an Enumeration of all nodes in the repository. This ought to be read-only; I don't mean to expose the internal Vector.


renderNodeList

public java.lang.StringBuffer renderNodeList()
Render a roster of nodes in the repository into a StringBuffer.


memberOf

public DocumentID memberOf()
Retreive the identifier of this repository's parent Document.


containsNode

public boolean containsNode(NodeID ID)
Does this repository contain a node of a paritcular ID?


validateInstanceNodes

public void validateInstanceNodes()
                           throws Scheherexception
Validate the instance nodes in this repository

Throws:
Scheherexception


Copyright © 2011 David K. Elson. All Rights Reserved.