story.dbcore.admin
Class DBCAccessor

java.lang.Object
  extended by story.dbcore.admin.DBCAccessor

public class DBCAccessor
extends java.lang.Object

Accessor functions for a DBCoreInterface. Provides syntactic sugar for calling applications to use to avoid run-time class cast exceptions and other inconveniences of the manual creation of Command objects required by DBCoreInterface.


Constructor Summary
DBCAccessor(DBCoreInterface dbci)
           
 
Method Summary
 boolean areRelatedDirectly(java.lang.Object node1, java.lang.Object linkType, java.lang.Object node2)
          Test whether two nodes are related directly.
 boolean areRelatedIndirectly(java.lang.Object node1, java.lang.Object linkType, java.lang.Object node2)
          Test whether two nodes are related indirectly.
 void closeDocument()
          Returns nothing
 HistoryFrameID currentStateID()
          Return the current state of the db-core.
 java.lang.Object execute(Command command)
          Interpret and execute a command.
 void execute(CommandSequence sequence)
          Execute all the commands in a CommandSequence.
 NodeAddress findNode(NodeID nodeID)
          Find the full address of a node by its ID.
 CommandSequence getCommandHistory()
          Gets the command history at the moment
 HistoryFrameID getCurrentStateID()
          GetCurrentStateID.
 DBCoreInterface getDBCoreInterface()
           
 NodeAddress getFirstNodeLinkedFromNode(NodeAddress node, LinkType linkType)
          Syntactic sugar for getting the first directly linked node from a node.
 NodeAddress getFirstNodeLinkedToNode(LinkType linkType, NodeAddress node)
          Syntactic sugar for getting the first directly linked node to a node.
 int getHistoryFrameRelationship(HistoryFrameID historyFrame)
          GetHistoryFrameRelationship.
 Command getLastCommand()
          Returns the last successfully-executed command issued to the DBCore, or throws an exception if this is the first command
 LinkSet getLinksFromNode(NodeAddress node, LinkType linkType, boolean directOnly)
          Compile a set of nodes that are linked from a particular node by a particular type of link.
 LinkSet getLinksOfNode(LinkType linkType, LinkDirection linkDirection, NodeAddress node, boolean directOnly)
          Compile a set of nodes that are linked to or from a particular node by a particular type of link.
 LinkSet getLinksToNode(LinkType linkType, NodeAddress node, boolean directOnly)
          Compile a set of nodes that are linked to a particular node by a particular type of link.
 ViaSet getLinkVias(NodeAddress fromNode, LinkType linkType, NodeAddress toNode)
          Get the Via(s) of a link between two nodes.
 int getMaxAttributeLength(java.lang.Object nodeAddress, java.lang.Object attributeID)
          Returns the maximum allowable length of an attribute.
 AttributeValue getNodeAttribute(java.lang.Object node, java.lang.Object attribute)
          Get a node attribute's value with no inheritance.
 AttributeValue getNodeAttribute(java.lang.Object node, java.lang.Object attribute, boolean overrideInheritance)
          Get a node attribute's value.
 java.util.Iterator getNodeAttributeIDs(java.lang.Object node)
          Return an iterator over all the AttributeIDs of a node's attributes.
 NodeInstancing getNodeDefinition(NodeAddress node)
          Get the definition of an instance node.
 NodeInstancing getNodeDefinition(java.lang.Object node)
          Get an instance node's definition (NodeInstancing).
 NodeProxy getNodeProxy(NodeAddress node)
          Get a node's proxy.
 NodeType getNodeType(java.lang.Object node)
          Get a node's type.
 DocumentID getOpenDocument()
          Returns the DocumentID of the currently open document, or null if no document is currently open.
 SymbolTable getSymbolTable()
          Retrieve the symbol table.
 void launchCoreBrowser()
          Launch a CoreBrowser
 void link(java.lang.Object node1, java.lang.Object linkType, java.lang.Object node2)
          Link two nodes with no label.
 void link(java.lang.Object node1, java.lang.Object linkType, java.lang.Object node2, java.lang.Object label)
          Link two nodes with a label.
 LinkLabel linkInstancing(java.lang.Object node1, NodeInstancing instancing, java.lang.Object linkType, java.lang.Object linkDirection)
          Link a node to an instancing with no label (packaged input)
 LinkLabel linkInstancing(java.lang.Object node1, NodeInstancing instancing, java.lang.Object linkType, java.lang.Object linkDirection, java.lang.Object linkLabel)
          Link a node to an instancing with a label (packaged input)
 LinkLabel linkInstancing(java.lang.Object node1, java.lang.Object prototypeNode, java.lang.Object arguments, java.lang.Object linkType, java.lang.Object linkDirection)
          Link a node to an instancing with no label (unpackaged input)
 LinkLabel linkInstancing(java.lang.Object node1, java.lang.Object prototypeNode, java.lang.Object arguments, java.lang.Object linkType, java.lang.Object linkDirection, java.lang.Object linkLabel)
          Link a node to an instancing with a label (unpackaged input)
 java.util.HashSet listRepositories()
          Returns a list of repositories
 NodeAddress moveNode(NodeAddress node, NodeRepositoryID newRepository)
          Move a node to a differenct repository.
 DocumentID newDocument(java.lang.Object documentID)
          Returns DocumentID on success
 NodeInstancing newExpansion(java.lang.Object node, java.lang.Object args)
          Create a new NodeInstancing on a node's "expansion" parameter
 NodeAddress newInstanceNode(java.lang.Object repository, java.lang.Object nodeID, NodeInstancing instancing)
          Alternate way to add an instance node that takes a NodeInstancing (from newExpansion()).
 NodeAddress newInstanceNode(java.lang.Object repository, java.lang.Object nodeID, java.lang.Object prototypeNode)
          Easy way to add a new instance node with no arguments.
 NodeAddress newInstanceNode(java.lang.Object repository, java.lang.Object nodeID, java.lang.Object prototypeNode, java.lang.Object arguments)
          Add a new instance node.
 NodeAddress newNode(java.lang.Object repository, NodeType type, java.lang.Object nodeID)
          Add a new node.
 NodeRepositoryID newRepository(RepositoryType type, java.lang.Object repositoryID)
          Add a new repository.
 NodeAddress newSubtypeNode(NodeAddress newNode, java.lang.Object prototypeNode)
          Easy way to add a node that is a subtype of another node.
 NodeAddress newSubtypeNode(NodeRepositoryID repository, NodeID nodeID, java.lang.Object prototypeNode)
          Easy way to add a node that is a subtype of another node.
 NodeAddress newSubtypeNode(java.lang.Object repository, NodeType type, java.lang.Object nodeID, java.lang.Object parent, java.lang.Object linkLabel)
          Add a node that is a subtype of another node.
 boolean nodeExists(NodeAddress node)
          Check whether a node exists.
 boolean nodeRepositoryExists(NodeRepositoryID repositoryID)
          Check whether a node repository exists.
 java.lang.StringBuffer printState()
          Render the current state of the db-core.
 QueryResultSet query(ParameterSet params)
          Execute a query over the open Document.
 HistoryFrameID reconstruct(HistoryFrameID targetFrame)
          Reconstruct a prior state of the db-core from the command history.
 void redefineNode(java.lang.Object nodeAddress, NodeInstancing newDefinition)
          Redefine an instance node.
 void redo()
          Redo.
 void redoTo(java.lang.Object historyFrameID)
          RedoTo.
 boolean removeNode(java.lang.Object nodeAddress)
          Remove a node.
 boolean removeRepository(java.lang.Object nodeRepository)
          Remove a repository.
 NodeID renameNode(NodeAddress node, NodeID newNodeID)
          Rename a node.
 NodeRepositoryID renameRepository(NodeRepositoryID currentName, NodeRepositoryID newName)
          Rename a repository.
 java.lang.StringBuffer renderNode(java.lang.Object node)
          Render node
 void reset()
          Returns nothing
 AttributeValue setNodeAttribute(java.lang.Object nodeAddress, java.lang.Object attributeID, java.lang.Object attributeValue)
          Set a node attribute
 void setSymbolTable(SymbolTable st)
          Set the symbol table.
 void undo()
          Undo.
 void undoTo(java.lang.Object historyFrameID)
          UndoTo.
 void unlink(java.lang.Object from, java.lang.Object linkType, java.lang.Object to)
          Unlink all links of a certain type between two nodes.
 void unlink(java.lang.Object from, java.lang.Object linkType, java.lang.Object to, java.lang.Object label)
          Unlink a particular link between two nodes.
 SatisfactionResult validateNodeInstancing(NodeInstancing instancing)
          Validates a NodeInstancing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBCAccessor

public DBCAccessor(DBCoreInterface dbci)
            throws Scheherexception
Throws:
Scheherexception
Method Detail

getDBCoreInterface

public DBCoreInterface getDBCoreInterface()

findNode

public NodeAddress findNode(NodeID nodeID)
                     throws Scheherexception
Find the full address of a node by its ID.

Throws:
Scheherexception

getLinksOfNode

public LinkSet getLinksOfNode(LinkType linkType,
                              LinkDirection linkDirection,
                              NodeAddress node,
                              boolean directOnly)
                       throws Scheherexception
Compile a set of nodes that are linked to or from a particular node by a particular type of link.

Parameters:
linkType - The type of link.
linkDirection - The direction of the link.
node - The address node.
directOnly - Set true to include nodes that are linked directly to the parameterized node. Set false to employ inference and find nodes that are indirectly linked.
Throws:
Scheherexception

getLinkVias

public ViaSet getLinkVias(NodeAddress fromNode,
                          LinkType linkType,
                          NodeAddress toNode)
                   throws Scheherexception
Get the Via(s) of a link between two nodes.

Parameters:
fromNode - The node on the "from" end of the link.
linkType - Type type of link.
toNode - The node on the "to" end of the link.
Throws:
Scheherexception - Throws exception if there is no such link between the two nodes.

getLinksFromNode

public LinkSet getLinksFromNode(NodeAddress node,
                                LinkType linkType,
                                boolean directOnly)
                         throws Scheherexception
Compile a set of nodes that are linked from a particular node by a particular type of link.

Parameters:
linkType - The type of link.
linkDirection - The direction of the link.
node - The address node.
directOnly - Set true to include nodes that are linked directly to the parameterized node. Set false to employ inference and find nodes that are indirectly linked.
Throws:
Scheherexception

getLinksToNode

public LinkSet getLinksToNode(LinkType linkType,
                              NodeAddress node,
                              boolean directOnly)
                       throws Scheherexception
Compile a set of nodes that are linked to a particular node by a particular type of link.

Parameters:
linkType - The type of link.
linkDirection - The direction of the link.
node - The address node.
directOnly - Set true to include nodes that are linked directly to the parameterized node. Set false to employ inference and find nodes that are indirectly linked.
Throws:
Scheherexception

getNodeAttribute

public AttributeValue getNodeAttribute(java.lang.Object node,
                                       java.lang.Object attribute,
                                       boolean overrideInheritance)
                                throws Scheherexception
Get a node attribute's value.

Throws:
Scheherexception

getNodeDefinition

public NodeInstancing getNodeDefinition(java.lang.Object node)
                                 throws Scheherexception
Get an instance node's definition (NodeInstancing).

Throws:
Scheherexception

getNodeAttribute

public AttributeValue getNodeAttribute(java.lang.Object node,
                                       java.lang.Object attribute)
                                throws Scheherexception
Get a node attribute's value with no inheritance.

Throws:
Scheherexception

getNodeType

public NodeType getNodeType(java.lang.Object node)
                     throws Scheherexception
Get a node's type.

Throws:
Scheherexception

getNodeProxy

public NodeProxy getNodeProxy(NodeAddress node)
                       throws Scheherexception
Get a node's proxy.

Throws:
Scheherexception

getNodeDefinition

public NodeInstancing getNodeDefinition(NodeAddress node)
                                 throws Scheherexception
Get the definition of an instance node. Returns null if n/a.

Throws:
Scheherexception

query

public QueryResultSet query(ParameterSet params)
                     throws Scheherexception
Execute a query over the open Document.

Throws:
Scheherexception

getSymbolTable

public SymbolTable getSymbolTable()
Retrieve the symbol table.


setSymbolTable

public void setSymbolTable(SymbolTable st)
Set the symbol table.


execute

public void execute(CommandSequence sequence)
             throws Scheherexception
Execute all the commands in a CommandSequence. In case of an error in any command, the system state is reverted to the state that existed prior to the start of execution.

Throws:
Scheherexception

execute

public java.lang.Object execute(Command command)
                         throws Scheherexception
Interpret and execute a command.

Throws:
Scheherexception

newExpansion

public NodeInstancing newExpansion(java.lang.Object node,
                                   java.lang.Object args)
                            throws Scheherexception
Create a new NodeInstancing on a node's "expansion" parameter

Throws:
Scheherexception

printState

public java.lang.StringBuffer printState()
                                  throws Scheherexception
Render the current state of the db-core.

Throws:
Scheherexception

currentStateID

public HistoryFrameID currentStateID()
                              throws Scheherexception
Return the current state of the db-core.

Throws:
Scheherexception

reconstruct

public HistoryFrameID reconstruct(HistoryFrameID targetFrame)
                           throws Scheherexception
Reconstruct a prior state of the db-core from the command history. Returns HistoryFrameID of the state which the db-core has successfully reconstructed. THIS IS TIME CONSUMING! The entire command history of the db-core is re-executed.

Throws:
Scheherexception

moveNode

public NodeAddress moveNode(NodeAddress node,
                            NodeRepositoryID newRepository)
                     throws Scheherexception
Move a node to a differenct repository.

Throws:
Scheherexception

newNode

public NodeAddress newNode(java.lang.Object repository,
                           NodeType type,
                           java.lang.Object nodeID)
                    throws Scheherexception
Add a new node.

Throws:
Scheherexception

newSubtypeNode

public NodeAddress newSubtypeNode(NodeAddress newNode,
                                  java.lang.Object prototypeNode)
                           throws Scheherexception
Easy way to add a node that is a subtype of another node.

Throws:
Scheherexception

newSubtypeNode

public NodeAddress newSubtypeNode(NodeRepositoryID repository,
                                  NodeID nodeID,
                                  java.lang.Object prototypeNode)
                           throws Scheherexception
Easy way to add a node that is a subtype of another node.

Throws:
Scheherexception

newSubtypeNode

public NodeAddress newSubtypeNode(java.lang.Object repository,
                                  NodeType type,
                                  java.lang.Object nodeID,
                                  java.lang.Object parent,
                                  java.lang.Object linkLabel)
                           throws Scheherexception
Add a node that is a subtype of another node.

Throws:
Scheherexception

newRepository

public NodeRepositoryID newRepository(RepositoryType type,
                                      java.lang.Object repositoryID)
                               throws Scheherexception
Add a new repository.

Throws:
Scheherexception

setNodeAttribute

public AttributeValue setNodeAttribute(java.lang.Object nodeAddress,
                                       java.lang.Object attributeID,
                                       java.lang.Object attributeValue)
                                throws Scheherexception
Set a node attribute

Throws:
Scheherexception

newInstanceNode

public NodeAddress newInstanceNode(java.lang.Object repository,
                                   java.lang.Object nodeID,
                                   java.lang.Object prototypeNode,
                                   java.lang.Object arguments)
                            throws Scheherexception
Add a new instance node.

Throws:
Scheherexception

newInstanceNode

public NodeAddress newInstanceNode(java.lang.Object repository,
                                   java.lang.Object nodeID,
                                   NodeInstancing instancing)
                            throws Scheherexception
Alternate way to add an instance node that takes a NodeInstancing (from newExpansion()).

Throws:
Scheherexception

newInstanceNode

public NodeAddress newInstanceNode(java.lang.Object repository,
                                   java.lang.Object nodeID,
                                   java.lang.Object prototypeNode)
                            throws Scheherexception
Easy way to add a new instance node with no arguments.

Throws:
Scheherexception

redefineNode

public void redefineNode(java.lang.Object nodeAddress,
                         NodeInstancing newDefinition)
                  throws Scheherexception
Redefine an instance node.

Throws:
Scheherexception

link

public void link(java.lang.Object node1,
                 java.lang.Object linkType,
                 java.lang.Object node2)
          throws Scheherexception
Link two nodes with no label.

Throws:
Scheherexception

link

public void link(java.lang.Object node1,
                 java.lang.Object linkType,
                 java.lang.Object node2,
                 java.lang.Object label)
          throws Scheherexception
Link two nodes with a label.

Throws:
Scheherexception

unlink

public void unlink(java.lang.Object from,
                   java.lang.Object linkType,
                   java.lang.Object to)
            throws Scheherexception
Unlink all links of a certain type between two nodes.

Throws:
Scheherexception

unlink

public void unlink(java.lang.Object from,
                   java.lang.Object linkType,
                   java.lang.Object to,
                   java.lang.Object label)
            throws Scheherexception
Unlink a particular link between two nodes.

Throws:
Scheherexception

linkInstancing

public LinkLabel linkInstancing(java.lang.Object node1,
                                java.lang.Object prototypeNode,
                                java.lang.Object arguments,
                                java.lang.Object linkType,
                                java.lang.Object linkDirection,
                                java.lang.Object linkLabel)
                         throws Scheherexception
Link a node to an instancing with a label (unpackaged input)

Throws:
Scheherexception

linkInstancing

public LinkLabel linkInstancing(java.lang.Object node1,
                                java.lang.Object prototypeNode,
                                java.lang.Object arguments,
                                java.lang.Object linkType,
                                java.lang.Object linkDirection)
                         throws Scheherexception
Link a node to an instancing with no label (unpackaged input)

Throws:
Scheherexception

linkInstancing

public LinkLabel linkInstancing(java.lang.Object node1,
                                NodeInstancing instancing,
                                java.lang.Object linkType,
                                java.lang.Object linkDirection,
                                java.lang.Object linkLabel)
                         throws Scheherexception
Link a node to an instancing with a label (packaged input)

Throws:
Scheherexception

linkInstancing

public LinkLabel linkInstancing(java.lang.Object node1,
                                NodeInstancing instancing,
                                java.lang.Object linkType,
                                java.lang.Object linkDirection)
                         throws Scheherexception
Link a node to an instancing with no label (packaged input)

Throws:
Scheherexception

areRelatedDirectly

public boolean areRelatedDirectly(java.lang.Object node1,
                                  java.lang.Object linkType,
                                  java.lang.Object node2)
                           throws Scheherexception
Test whether two nodes are related directly.

Throws:
Scheherexception

areRelatedIndirectly

public boolean areRelatedIndirectly(java.lang.Object node1,
                                    java.lang.Object linkType,
                                    java.lang.Object node2)
                             throws Scheherexception
Test whether two nodes are related indirectly.

Throws:
Scheherexception

undo

public void undo()
          throws Scheherexception
Undo.

Throws:
Scheherexception

undoTo

public void undoTo(java.lang.Object historyFrameID)
            throws Scheherexception
UndoTo.

Throws:
Scheherexception

redo

public void redo()
          throws Scheherexception
Redo.

Throws:
Scheherexception

redoTo

public void redoTo(java.lang.Object historyFrameID)
            throws Scheherexception
RedoTo.

Throws:
Scheherexception

renderNode

public java.lang.StringBuffer renderNode(java.lang.Object node)
                                  throws Scheherexception
Render node

Throws:
Scheherexception

nodeExists

public boolean nodeExists(NodeAddress node)
                   throws Scheherexception
Check whether a node exists.

Throws:
Scheherexception

nodeRepositoryExists

public boolean nodeRepositoryExists(NodeRepositoryID repositoryID)
                             throws Scheherexception
Check whether a node repository exists.

Throws:
Scheherexception

getFirstNodeLinkedFromNode

public NodeAddress getFirstNodeLinkedFromNode(NodeAddress node,
                                              LinkType linkType)
                                       throws Scheherexception
Syntactic sugar for getting the first directly linked node from a node.

Throws:
NoLinkedNode
Scheherexception

getFirstNodeLinkedToNode

public NodeAddress getFirstNodeLinkedToNode(LinkType linkType,
                                            NodeAddress node)
                                     throws Scheherexception
Syntactic sugar for getting the first directly linked node to a node.

Throws:
NoLinkedNode
Scheherexception

validateNodeInstancing

public SatisfactionResult validateNodeInstancing(NodeInstancing instancing)
                                          throws Scheherexception
Validates a NodeInstancing.

Throws:
Scheherexception

launchCoreBrowser

public void launchCoreBrowser()
                       throws Scheherexception
Launch a CoreBrowser

Throws:
Scheherexception

getNodeAttributeIDs

public java.util.Iterator getNodeAttributeIDs(java.lang.Object node)
                                       throws Scheherexception
Return an iterator over all the AttributeIDs of a node's attributes.

Throws:
Scheherexception

getOpenDocument

public DocumentID getOpenDocument()
Returns the DocumentID of the currently open document, or null if no document is currently open.


newDocument

public DocumentID newDocument(java.lang.Object documentID)
                       throws Scheherexception
Returns DocumentID on success

Throws:
Scheherexception

closeDocument

public void closeDocument()
                   throws Scheherexception
Returns nothing

Throws:
Scheherexception

reset

public void reset()
           throws Scheherexception
Returns nothing

Throws:
Scheherexception

getCommandHistory

public CommandSequence getCommandHistory()
                                  throws Scheherexception
Gets the command history at the moment

Throws:
Scheherexception

getLastCommand

public Command getLastCommand()
                       throws Scheherexception
Returns the last successfully-executed command issued to the DBCore, or throws an exception if this is the first command

Throws:
Scheherexception

getMaxAttributeLength

public int getMaxAttributeLength(java.lang.Object nodeAddress,
                                 java.lang.Object attributeID)
                          throws Scheherexception
Returns the maximum allowable length of an attribute.

Throws:
Scheherexception

listRepositories

public java.util.HashSet listRepositories()
                                   throws Scheherexception
Returns a list of repositories

Throws:
Scheherexception

removeNode

public boolean removeNode(java.lang.Object nodeAddress)
                   throws Scheherexception
Remove a node. Returns true on success.

Throws:
Scheherexception

removeRepository

public boolean removeRepository(java.lang.Object nodeRepository)
                         throws Scheherexception
Remove a repository. Returns 0 on success.

Throws:
Scheherexception

getCurrentStateID

public HistoryFrameID getCurrentStateID()
                                 throws Scheherexception
GetCurrentStateID.

Throws:
Scheherexception

getHistoryFrameRelationship

public int getHistoryFrameRelationship(HistoryFrameID historyFrame)
                                throws Scheherexception
GetHistoryFrameRelationship.

Throws:
Scheherexception

renameRepository

public NodeRepositoryID renameRepository(NodeRepositoryID currentName,
                                         NodeRepositoryID newName)
                                  throws Scheherexception
Rename a repository.

Throws:
Scheherexception

renameNode

public NodeID renameNode(NodeAddress node,
                         NodeID newNodeID)
                  throws Scheherexception
Rename a node.

Throws:
Scheherexception


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