storage.memory
Class BareContent.Editor

java.lang.Object
  extended byorg.nodal.util.NodeFilter
      extended bystorage.memory.BareContent.Editor
All Implemented Interfaces:
Content, Content.Editor, Node, NodeContent, NodeContent.Editor, NodeFactory, TxnMonitorable
Enclosing class:
BareContent

public abstract static class BareContent.Editor
extends NodeFilter
implements NodeContent.Editor


Nested Class Summary
 
Nested classes inherited from class org.nodal.model.NodeContent
NodeContent.Editor
 
Field Summary
protected  BareContent content
           
protected  storage.memory.NodeManager nodeMgr
           
 
Fields inherited from class org.nodal.util.NodeFilter
node
 
Constructor Summary
protected BareContent.Editor(BareContent content)
           
 
Method Summary
 void addTxnHandler(TxnHandler handler)
          Add a TxnHandler to be invoked when this object changes.
 NodeContent.Editor apply(Operator op)
          Apply an Operator to modify this Node, or create a new Node.
 MapNode asMapNode()
          The Node's contents expressed as a Map.
 RecordNode asRecordNode()
          The Node's contents expressed as a Record.
 SequenceNode asSequenceNode()
          The Node's contents expressed as a Sequence.
 NodeContent.Editor cloneNode(Node node)
          Create a clone of an existing Node using this factory as context.
 NodeContent.Editor cloneNode(Node node, Node context)
          Create a clone of an existing Node.
 boolean commit()
          Commit the current transaction to permanent storage.
 NodeContent content()
          The Node's contents.
 NodeContent.Editor createNode(NodeType type)
          Create a new Node of the given type using this factory as context.
 NodeContent.Editor createNode(NodeType type, Node context)
          Create a new Node of the given type.
 NodeContent.Editor edit()
          An Editor for changing the Content of this Node.
 MapNode.Editor editMap()
          This NodeEditor as a MapEditor.
 RecordNode.Editor editRecord()
          This NodeEditor as a RecordEditor.
 SequenceNode.Editor editSequence()
          This NodeEditor as a SequenceEditor.
 java.lang.Object getValue(java.lang.Object obj)
          Access the property value, given a property.
 Operator invert(Operator op)
          Produce an Operator that would undo the application of op on this Content.
 boolean isValidProperty(java.lang.Object property)
          Check for the validity of a given property value.
 void modify(Operator op)
          Apply an Operator to modify this Content object.
 java.util.Iterator properties()
          A sequence of all of the properties currently indexing the contents if this Content.
 void removeTxnHandler(TxnHandler handler)
          Remove a previously added TxnHandler.
abstract  Setter setValue(java.lang.Object key)
          Return a Setter that will change the value of the specified property.
 int size()
          The number of properties contained in this Content object.
abstract  java.lang.String toString()
           
 Txn txn()
          Return the current Txn being managed by this Editor.
 NodeType type()
          The data Type of the Node's contents.
 Getter value(java.lang.Object obj)
          A generic Getter for property values, given a property.
 
Methods inherited from class org.nodal.util.NodeFilter
asAnchor, bareNode, capability, history, id, path, repository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.nodal.model.Node
asAnchor, bareNode, capability, history, id, path, repository
 

Field Detail

content

protected final BareContent content

nodeMgr

protected final storage.memory.NodeManager nodeMgr
Constructor Detail

BareContent.Editor

protected BareContent.Editor(BareContent content)
Method Detail

content

public NodeContent content()
Description copied from interface: Node
The Node's contents.

If the Capability does not provide read access, then this will return null.

Specified by:
content in interface Node
Overrides:
content in class NodeFilter

type

public final NodeType type()
Description copied from interface: Node
The data Type of the Node's contents.

Specified by:
type in interface Node
Overrides:
type in class NodeFilter

size

public final int size()
Description copied from interface: Content
The number of properties contained in this Content object.

Specified by:
size in interface Content

properties

public final java.util.Iterator properties()
Description copied from interface: Content
A sequence of all of the properties currently indexing the contents if this Content.

Specified by:
properties in interface Content

isValidProperty

public boolean isValidProperty(java.lang.Object property)
Description copied from interface: Content
Check for the validity of a given property value.

Specified by:
isValidProperty in interface Content
Parameters:
property - the property to be checked
Returns:
true if that value can be used as a property of this Node

value

public Getter value(java.lang.Object obj)
             throws PropertyConstraintFailure
Description copied from interface: Content
A generic Getter for property values, given a property.

Will throw an exception if the property type is invalid, but not if the property is not available in this Node's content. This way, a value Getter can be established in anticipation of the addition of a property.

Specified by:
value in interface Content
Parameters:
obj - the Object that identifies this property
Throws:
PropertyConstraintFailure

getValue

public final java.lang.Object getValue(java.lang.Object obj)
                                throws PropertyConstraintFailure
Description copied from interface: Content
Access the property value, given a property.

Will throw an exception if the property type is invalid, but not if the property is not available in this Node's content. This way, a value Getter can be established in anticipation of the addition of a property.

Specified by:
getValue in interface Content
Parameters:
obj - the Object that identifies this property
Returns:
the value of the property
Throws:
PropertyConstraintFailure

invert

public final Operator invert(Operator op)
                      throws InvalidOperator,
                             ConstraintFailure
Description copied from interface: Content
Produce an Operator that would undo the application of op on this Content.

Specified by:
invert in interface Content
Throws:
InvalidOperator
ConstraintFailure

addTxnHandler

public void addTxnHandler(TxnHandler handler)
Description copied from interface: TxnMonitorable
Add a TxnHandler to be invoked when this object changes.

Specified by:
addTxnHandler in interface TxnMonitorable
Parameters:
handler - a TxnHandler whose notify methods will be invoked when this object changes.

removeTxnHandler

public void removeTxnHandler(TxnHandler handler)
Description copied from interface: TxnMonitorable
Remove a previously added TxnHandler.

Specified by:
removeTxnHandler in interface TxnMonitorable
Parameters:
handler - a TxnHandler that has previously been added.

asMapNode

public MapNode asMapNode()
Description copied from interface: Node
The Node's contents expressed as a Map. This is a shortcut for content().asMap().

Specified by:
asMapNode in interface Node
Overrides:
asMapNode in class NodeFilter

asRecordNode

public RecordNode asRecordNode()
Description copied from interface: Node
The Node's contents expressed as a Record. This is a shortcut for content().asRecord().

Specified by:
asRecordNode in interface Node
Overrides:
asRecordNode in class NodeFilter

asSequenceNode

public SequenceNode asSequenceNode()
Description copied from interface: Node
The Node's contents expressed as a Sequence. This is a shortcut for content().asSequence().

Specified by:
asSequenceNode in interface Node
Overrides:
asSequenceNode in class NodeFilter

createNode

public final NodeContent.Editor createNode(NodeType type)
Description copied from interface: NodeFactory
Create a new Node of the given type using this factory as context.

Specified by:
createNode in interface NodeFactory

createNode

public final NodeContent.Editor createNode(NodeType type,
                                           Node context)
Description copied from interface: NodeFactory
Create a new Node of the given type.

Specified by:
createNode in interface NodeFactory
Parameters:
type - The NodeType that will be assigned to the new Node.
context - The Node from which context metadata wil be inherited.

cloneNode

public final NodeContent.Editor cloneNode(Node node)
Description copied from interface: NodeFactory
Create a clone of an existing Node using this factory as context.

Specified by:
cloneNode in interface NodeFactory
Parameters:
node - The node to be cloned.

cloneNode

public final NodeContent.Editor cloneNode(Node node,
                                          Node context)
Description copied from interface: NodeFactory
Create a clone of an existing Node.

Specified by:
cloneNode in interface NodeFactory
Parameters:
node - The node to be cloned.
context - The Node from which context metadata wil be inherited.

apply

public NodeContent.Editor apply(Operator op)
                         throws InvalidOperator,
                                ConstraintFailure
Description copied from interface: NodeContent.Editor
Apply an Operator to modify this Node, or create a new Node.

Specified by:
apply in interface NodeContent.Editor
Throws:
InvalidOperator
ConstraintFailure

modify

public void modify(Operator op)
            throws InvalidOperator,
                   ConstraintFailure
Description copied from interface: Content.Editor
Apply an Operator to modify this Content object.

Specified by:
modify in interface Content.Editor
Throws:
InvalidOperator
ConstraintFailure

txn

public final Txn txn()
Description copied from interface: NodeContent.Editor
Return the current Txn being managed by this Editor.

Specified by:
txn in interface NodeContent.Editor
Returns:
the current Txn being managed by this Editor

commit

public final boolean commit()
Description copied from interface: NodeContent.Editor
Commit the current transaction to permanent storage.

Specified by:
commit in interface NodeContent.Editor
Returns:
true if successful

toString

public abstract java.lang.String toString()

setValue

public abstract Setter setValue(java.lang.Object key)
                         throws PropertyConstraintFailure
Description copied from interface: Content.Editor
Return a Setter that will change the value of the specified property.

Specified by:
setValue in interface Content.Editor
Throws:
PropertyConstraintFailure

edit

public NodeContent.Editor edit()
Description copied from interface: Node
An Editor for changing the Content of this Node. If the Capability does not provide write access, then this will return null.

Specified by:
edit in interface Node
Overrides:
edit in class NodeFilter

editMap

public MapNode.Editor editMap()
Description copied from interface: Node
This NodeEditor as a MapEditor.

Returns null if the type is not MapType.

Specified by:
editMap in interface Node
Overrides:
editMap in class NodeFilter

editRecord

public RecordNode.Editor editRecord()
Description copied from interface: Node
This NodeEditor as a RecordEditor.

Returns null if the type is not RecordType.

Specified by:
editRecord in interface Node
Overrides:
editRecord in class NodeFilter

editSequence

public SequenceNode.Editor editSequence()
Description copied from interface: Node
This NodeEditor as a SequenceEditor.

Returns null if the type is not SequenceType.

Specified by:
editSequence in interface Node
Overrides:
editSequence in class NodeFilter