|
Data Request Broker 2-3-release |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.gael.drb.DrbDefaultNodesChangeProducer
fr.gael.drb.DrbAbstractNode
fr.gael.drb.impl.DrbNodeImpl
fr.gael.drb.DrbDefaultMutableNode
public class DrbDefaultMutableNode
Simple mutable node implementation. This class is a simple means to build a DrbNode. It extends the DrbMutableNode interface instead of the DrbNode because it natively requires to be modifiable. This also enables to reduce the signature of the constructors are delay the settings to further calls. This class accepts attributes as well as value and namespace identifier. The class is also a node change producer so its possible to monitor the changed performed on each instance.
Important note: The DrbDefaultMutableNode has no physical representation. Its children and attributes are therefore not stored in a physical media that may imply an important memory footprint.
| Field Summary | |
|---|---|
protected DrbAttributeList |
attributes
Node attributes. |
protected DrbDefaultNodeList |
children
Chldren of the current node. |
protected int |
index
Index of the node in its parent children list. |
protected String |
name
Node name. |
protected String |
namespaceURI
Node namespace identifier. |
protected DrbNode |
nextSibling
Next sibling of the current node. |
protected DrbNode |
parent
Parent of the current node. |
protected DrbNode |
previousSibling
Previous sibling of the current node. |
protected DrbNode |
referenceNode
Node reference. |
protected String |
rootPath
The root node path. |
protected Object |
userObject
User object. |
protected Value |
value
Node avlue. |
| Fields inherited from interface fr.gael.drb.DrbItem |
|---|
ATTRIBUTE_ITEM, NODE_ITEM, UNDEFINED_ITEM, VALUE_ITEM |
| Constructor Summary | |
|---|---|
DrbDefaultMutableNode(String name)
Builds a new instance of DrbDefaultMutableNode. |
|
DrbDefaultMutableNode(String name,
DrbNode parent,
int index,
DrbNode previous_sibling,
DrbNode next_sibling)
Builds a new instance of DrbDefaultMutableNode with a specified parent. |
|
| Method Summary | |
|---|---|
DrbNode |
appendChild(DrbNode node)
Appends a child to the node. |
DrbNode |
appendReference(DrbNode node)
Adopt a child at the end of the children list. |
DrbAttributeList |
getAttributes()
The attributes of the nodes. |
DrbNodeList |
getChildren()
The list of children of the current node. |
Object |
getImpl(Class api)
Returns a specific implementation. |
int |
getIndex()
Returns the index of the node. |
String |
getName()
Name of the node. |
Namespace |
getNamespaceBindings()
Get the namespace bindings. |
String |
getNamespaceURI()
Get namespace URI. |
DrbNode |
getNextSibling()
Next sibling of the current node. |
DrbNode |
getParent()
The parent of this node. |
DrbNode |
getPreviousSibling()
Previous sibling of the current node. |
DrbNode |
getRoot()
Returns the root node. |
String |
getRootPath()
Returns the root path. |
Object |
getUserObject()
Returns the user object node. |
Value |
getValue()
The value of the node. |
int |
getValueType()
The value type of the node. |
String |
getXPathName()
Name of the node. |
boolean |
hasImpl(Class api)
Tests if a specific interface can be provided. |
DrbNode |
insertChild(DrbNode node,
int index)
Inserts a child to the node children list. |
boolean |
isSame(DrbNode node)
Checks nodes sameness. |
static void |
main(String[] args)
Makes this class runnable for testing. |
void |
removeChild(int index)
Removes an existing child. |
void |
rename(String name)
Changes the name of the node. |
DrbNode |
replaceChild(int index,
DrbNode node)
Replaces a child of the current node. |
void |
setAttributes(DrbAttributeList attributes)
Sets the attribute list to the node. |
void |
setContent(DrbSequence sequence)
Set the content of the node. |
void |
setIndex(int index)
Sets the index of the node. |
void |
setNamespaceBindings(Namespace namespaces)
Sets the namespace bindings. |
void |
setNamespaceURI(String namespace_uri)
Sets the namespace URI. |
void |
setParent(DrbNode parent)
Sets the parent of this node. |
void |
setRootPath(String root_path)
Set the path of the root node. |
void |
setUserObject(Object user_object)
Set the user object node. |
Value |
setValue(Value value)
Changes the value of the node. |
String |
toString()
Returns the node as a string. |
| Methods inherited from class fr.gael.drb.impl.DrbNodeImpl |
|---|
close, createAttribute, createNode, flush, getProvider |
| Methods inherited from class fr.gael.drb.DrbAbstractNode |
|---|
allowsMultiOccurrence, equals, getAttribute, getChildAt, getChildrenCount, getContent, getFirstChild, getItemType, getLastChild, getNamedChild, getOccurrence, getPath, getXPathName, hasChild |
| Methods inherited from class fr.gael.drb.DrbDefaultNodesChangeProducer |
|---|
addNodesChangeListener, getListenerList, nodesChanged, nodesInserted, nodesRemoved, removeNodesChangeListener, setListenerList, structureChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected DrbNode referenceNode
protected String name
protected String namespaceURI
protected DrbNode parent
protected DrbAttributeList attributes
protected Value value
protected int index
protected DrbDefaultNodeList children
protected DrbNode previousSibling
protected DrbNode nextSibling
protected Object userObject
protected String rootPath
| Constructor Detail |
|---|
public DrbDefaultMutableNode(String name)
name - A reference to the name of the node to be instancied.
public DrbDefaultMutableNode(String name,
DrbNode parent,
int index,
DrbNode previous_sibling,
DrbNode next_sibling)
name - A reference to the name of the node to be instancied.parent - A reference to the parent of the node to be instanciated.index - The index of the node in is parent children list.previous_sibling - A reference to the previous_sibling or null.next_sibling - A reference to the next_sibling or null.| Method Detail |
|---|
public String getName()
getName in class DrbAbstractNodepublic String getXPathName()
getXPathName in class DrbAbstractNode
public void rename(String name)
throws NullPointerException,
UnsupportedOperationException
rename in class DrbAbstractNodename - A reference to the new name to assign.
UnsupportedOperationException - This exception is never raised by
the current implementation.
NullPointerException - This exception is raised when the passed name
is a null reference.public void setContent(DrbSequence sequence)
sequence - The sequence to be setpublic DrbNode getRoot()
getRoot in class DrbAbstractNodepublic int getIndex()
getIndex in class DrbAbstractNodepublic void setIndex(int index)
index - the index to be set.public String getNamespaceURI()
getNamespaceURI in class DrbAbstractNode
public void setNamespaceURI(String namespace_uri)
throws NullPointerException,
UnsupportedOperationException
setNamespaceURI in interface DrbNodesetNamespaceURI in class DrbAbstractNodenamespace_uri - A reference to the new namespace identifier.
NullPointerException - This exception is raised when the passed
reference to the new namespace identifier is null.
UnsupportedOperationException - This exception is never raised
because the operation is fully implemented and accept any
namespace.public Namespace getNamespaceBindings()
getNamespaceBindings in class DrbAbstractNodepublic void setNamespaceBindings(Namespace namespaces)
setNamespaceBindings in class DrbAbstractNodenamespaces - A reference to the new namespace bindings.public int getValueType()
getValueType in class DrbAbstractNodepublic Value getValue()
getValue in class DrbAbstractNode
public Value setValue(Value value)
throws NullPointerException,
ClassCastException,
UnsupportedOperationException
setValue in interface DrbNodesetValue in class DrbAbstractNodevalue - The new value of the node. This value shall not be null.
NullPointerException - This exception is raised when the passed
reference to the value is null.
ClassCastException - This exception is never raised because the
value is immediatly adopted without cast.
UnsupportedOperationException - This exception is never raised
because the operation is fully implemented and accept any value
types.public DrbAttributeList getAttributes()
getAttributes in class DrbAbstractNode
public void setAttributes(DrbAttributeList attributes)
throws NullPointerException,
UnsupportedOperationException
Warning: The attribute list is not duplicated and shall therefore not be modified by another means than the accessors provided by the current node.
setAttributes in interface DrbNodesetAttributes in class DrbAbstractNodeattributes - A reference to the new attribute list.
NullPointerException - This exception is raised when the passed
reference to the attribute list is null.
UnsupportedOperationException - This exception is never raised
because the operation is fully implemented and accept any
attribute.public DrbNode getParent()
getParent in class DrbAbstractNodepublic void setParent(DrbNode parent)
parent - the parent nodepublic DrbNodeList getChildren()
getChildren in class DrbAbstractNode
public DrbNode appendChild(DrbNode node)
throws NullPointerException,
UnsupportedOperationException
Warning: The duplication may have an important or non-applicable memory footprint. This operation shall therefore be used with caution.
Events: This operation fires a node change event when the operation succeeded.The called operation is nodesInserted() of the Listeners.
appendChild in interface DrbNodeappendChild in class DrbAbstractNodenode - A reference to the child to append.
NullPointerException - This exception is raised when the passed
reference to the value is null.
UnsupportedOperationException - This exception is thrown when the
node to append is not a instance of DrbDefaultMutableNode and
the duplication operation has failed.fr.gael.drb.DrbNodesChangeListener
public DrbNode insertChild(DrbNode node,
int index)
throws NullPointerException,
UnsupportedOperationException,
IndexOutOfBoundsException
Warning: The duplication may have an important or non-applicable memory footprint. This operation shall therefore be used with caution.
Events: This operation fires a node change event when the operation succeeded.The called operation is nodesInserted() of the Listeners.
insertChild in interface DrbNodeinsertChild in class DrbAbstractNodenode - A reference to the child to be inserted.index - the index of the nodo to insert
NullPointerException - This exception is raised when the passed
reference to the value is null.
UnsupportedOperationException - This exception is thrown when the
node to append is not a instance of DrbDefaultMutableNode and
the duplication operation has failed.
IndexOutOfBoundsException - This exception is raised when the passed
index is less than zero or greater or equal to the current
number of children.fr.gael.drb.DrbNodesChangeListener
public void removeChild(int index)
throws IndexOutOfBoundsException,
UnsupportedOperationException
This operation takes into account the removal by updating the sibling associations of the children nodes prior and next to the removed one. The indicies of the nodes next to the removed one are decresed of one. Their parents as well as their contents are left unchanged.
Events: This operation fires a node change event on successful removal. The node affected by the change is the removed node and the source is the current node. The called operation is the nodesRemoved() of the listeners.
removeChild in interface DrbNoderemoveChild in class DrbAbstractNodeindex - Index of the child to be removed.
IndexOutOfBoundsException - This exception is raised when the passed
index is less than zero or greater or equal to the current
number of children.
UnsupportedOperationException - This exception never raised.
public DrbNode replaceChild(int index,
DrbNode node)
throws NullPointerException,
IndexOutOfBoundsException,
UnsupportedOperationException
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the new node and the source is the current node.The called operation is the structureChanged() of the listeners.
replaceChild in interface DrbNodereplaceChild in class DrbAbstractNodeindex - Index of the node to be replaced. This index starts at 0 and
shall be less than the number of children.node - A reference to the node that replaces the old one.
NullPointerException - This exception is raised when the reference
to the new node is null.
IndexOutOfBoundsException - This exception is raised when the passed
index does not correspond to any effective child.
UnsupportedOperationException - This exception is raised if one of
the calls to removeChild() and insertChild() operations has
raised it. This case shall never appear because the children
list is supposed to be a consistent collection of
DrbDefaultMutableNodes.
public DrbNode appendReference(DrbNode node)
throws NullPointerException,
UnsupportedOperationException
Important note: The implementation of the node is not supposed to accept any kind of node For instance it may not be possible to append a node wrapping a file in an XML document. The documentation of the implementation shall describe its specific strategy.
Case of unordered or specifically ordered implementations: If the implementation does not support ordered children or has specific ordering rules, the node may not be appended but only inserted according to these rules. For instance it may not be possible to impose the file order in a directory: it generally depends on the lexicographical order of the node names or their creation date.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the appended node and the source is the current node. The called operation is the nodesInserted() of the listeners.
appendReference in class DrbAbstractNodenode - A reference to the node to be adopted.
NullPointerException - This exception is raised when the passed node
a null reference.This exception may be overriden by an
UnsupportedOperationException.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested append for any
reason (e.g. impossible in this current specific case or in
general).public DrbNode getPreviousSibling()
getPreviousSibling in class DrbAbstractNodepublic DrbNode getNextSibling()
getNextSibling in class DrbAbstractNodepublic boolean isSame(DrbNode node)
node - The node to test against to the current one.
public Object getUserObject()
public String getRootPath()
public void setUserObject(Object user_object)
user_object - The new user object.public void setRootPath(String root_path)
root_path - The path of the root node.public boolean hasImpl(Class api)
hasImpl in class DrbNodeImplapi - The class type to test.
public Object getImpl(Class api)
getImpl in class DrbNodeImplapi - The interface (or class) to be provided.
public String toString()
toString in class DrbAbstractNodepublic static void main(String[] args)
args - the main arguments
|
Data Request Broker - DRB API® 2-3-release |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||