|
Data Request Broker 2-3-release |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DrbNode
Node interface. This interface represents a single node of a tree of data. Any node can have no, one or several children.This interface provides the primarily operations to browse an entire data structure. All implementations of the "Data Request Broker" shall be able to produce such nodes. Nodes are considered mutable when they provide an interface that enables to change their content or structure (i.e. attribute, name, children, etc.). All the following operations are supposed to fire the most accurate events according to their business. DrbNode interface has been designed on the basis of the MutableTreeNode provided by the Java API and by the DOM Event specifications of the W3C.
Important note: If the node has a physical representation (e.g. a file, an XML document) the any call of the operations defined in DrbMutableNode interface changes this physical representation. For instance renaming a node wrapping a file will effectively rename the file in the file system. The operations does not already support transactions supposed to store the changes until a commit. The changes may therefore take a variable amount of time according to the underlying implementation. For instance the insertion of a node as first child may require to copy a huge file even if the node value has small footprint in the final file.
| Field Summary |
|---|
| Fields inherited from interface fr.gael.drb.DrbItem |
|---|
ATTRIBUTE_ITEM, NODE_ITEM, UNDEFINED_ITEM, VALUE_ITEM |
| Method Summary | |
|---|---|
DrbNode |
appendChild(DrbNode node)
Appends a child at the end of the children list. |
DrbAttribute |
getAttribute(String name)
Returns an attribute matching a specific name. |
DrbAttributeList |
getAttributes()
The attributes of the nodes. |
DrbNode |
getChildAt(int index)
Reference to a specific child. |
DrbNodeList |
getChildren()
The list of children of the current node. |
int |
getChildrenCount()
Number of children. |
DrbNode |
getFirstChild()
Reference to the first child of the current node. |
int |
getIndex()
Index of the node. |
DrbNode |
getLastChild()
Reference to the last child of the current node. |
String |
getName()
Name of the node. |
DrbNode |
getNamedChild(String name,
int occurence)
Returns an occurrence of child matching a specific name. |
String |
getNamespaceURI()
Get namespace URI. |
DrbNode |
getNextSibling()
Next sibling of the current node. |
DrbNode |
getParent()
The parent of this node. |
String |
getPath()
The full path of the node. |
DrbNode |
getPreviousSibling()
Previous sibling of the current node. |
DrbNode |
getRoot()
Root node. |
Value |
getValue()
The value of the node. |
int |
getValueType()
The value type of the node. |
boolean |
hasChild()
Checks if current node is parent of at least one child. |
DrbNode |
insertChild(DrbNode node,
int index)
Inserts a child at a given position. |
void |
removeChild(int index)
Removes an existing child. |
DrbNode |
replaceChild(int index,
DrbNode new_node)
Replaces a child of the current node. |
void |
setAttributes(DrbAttributeList attributes)
Set the attribute list of a node. |
void |
setNamespaceURI(String namespace_uri)
Sets a namespace resource identifier. |
Value |
setValue(Value value)
Changes the value of the node. |
| Methods inherited from interface fr.gael.drb.DrbItem |
|---|
getItemType, rename |
| Method Detail |
|---|
Value setValue(Value value)
throws NullPointerException,
ClassCastException,
UnsupportedOperationException
Important note: The implementation of the node is not supposed to accept value changes. For instance it may not be possible to change the value of a file directory that has no immediate signification.
Events: This operation fires a node changed event when the implementation is a node change producer. The node affected by the change is the current node as well as the source node. The called operation is the nodesChanged() of the listeners.
value - 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. This exception may be
overridden by an UnsupportedOperationException.
ClassCastException - This exception is raised when the
implementation has not succeeded to cast the input value in a
type compatible with the current node.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested assignment for
any reason.
void setAttributes(DrbAttributeList attributes)
throws NullPointerException,
UnsupportedOperationException
Warning: The input attributes may be duplicated or re-instanciated according to the targeted implementation. References to the effectively inserted attributes can be retrieved from the getAttributes() operation of the DrbNode. It is highly recommended to discard the references to the input attributes if not mandatory.
Important note: The implementation of the node is not supposed to accept attribute changes. For instance it may not be possible to change the size attribute of a file through this operation with would meant a effective file resize that is not really relevant without additional data.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the current node as well as the source node.The called operation is the nodesChanged() of the listeners.
attributes - A reference to the new attribute list.
NullPointerException - This exception is raised when the passed
reference to the attribute list is null. This exception may be
overridden by an UnsupportedOperationException.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested attribute changes
for any reason.
void setNamespaceURI(String namespace_uri)
throws NullPointerException,
UnsupportedOperationException
Important note: The implementation of the node is not supposed to accept namespace changes. For instance it may not be possible to change the namespace of a file that is basically fixed.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the current node as well as the source node.The called operation is the nodesChanged() of the listeners.
namespace_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 raised when the
implementation does not support the requested namespace change
for any reason (e.g. by definition or in the specific case).
DrbNode insertChild(DrbNode node,
int index)
throws NullPointerException,
UnsupportedOperationException,
IndexOutOfBoundsException
If the node has been inserted within the children list, the next sibling indices are increased of one. In addition the associations between the inserted node and it previous and next siblings are updated (if any).
Warning: The inserted node may be duplicated or re-instanciated according to the targeted implementation. A reference to the effectively inserted node is returned by the operation. It is highly recommended to discard the reference to the input node if not mandatory and to reference the returned node.
Important note: The implementation of the node is not supposed to accept any kind of node For instance it may not be possible to insert 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 is inserted without taking into account the requested index passed in parameter. 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 inserted node and the source is the current node. The called operation is the nodesInserted() of the listeners.
node - A reference to the node to be inserted.index - The expected index of the node after the insertion.
NullPointerException - This exception is raised when the passed node
a null reference. This exception may be overridden by an
UnsupportedOperationException.
IndexOutOfBoundsException - This exception is raised when the passe
index is less than zero or if it is greater or equal to the
number of children in the number of children prior the call
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested insertion for any
reason (e.g. impossible in this current specific case or in
general).
DrbNode appendChild(DrbNode node)
throws NullPointerException,
UnsupportedOperationException
Warning: The appended node may be duplicated or re-instanciated according to the targeted implementation. A reference to the effectively appended node is returned by the operation. It is highly recommended to discard the reference to the input node if not mandatory and to reference the returned node.
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.
node - A reference to the node to be appended.
NullPointerException - This exception is raised when the passed node
a null reference.This exception may be overridden 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).
DrbNode replaceChild(int index,
DrbNode new_node)
throws NullPointerException,
IndexOutOfBoundsException,
UnsupportedOperationException
Warning: The replacing node may be duplicated or re-instanciated according to the targeted implementation.A reference to the effectively replacing node is returned by the operation. It is highly recommended to discard the reference to the input node if not mandatory and to reference the returned one.
Important note: The implementation of the node is not supposed to accept any kind of node For instance it may not be possible to insert a node wrapping a file in an XML document. The documentation of the implementation shall describe its specific strategy.
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.
index - Index of the node to be replaced. This index starts at 0 and
shall be less than the number of children.new_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. This exception may be overridden by a
UnsupportedOperationException.
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 is raised when the
implementation does not support the requested replace for any
reason. In addition if the old_node is not retrieved in the
current children list, this exception is also raised.
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 indices of the nodes next to the removed one are decreased of one. Their parents as well as their contents are left unchanged.
Events: This operation fires a node change event when the implementation is a node change producer. 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.
index - 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 is raised when the
implementation does not support the requested removal for any
reason.String getName()
getName in interface DrbItemint getIndex()
DrbNode getRoot()
String getPath()
String getNamespaceURI()
getNamespaceURI in interface DrbItemint getValueType()
Value getValue()
getValue in interface DrbItemDrbAttributeList getAttributes()
DrbAttribute getAttribute(String name)
name - The name to match.
DrbNode getParent()
DrbNodeList getChildren()
boolean hasChild()
true if current node has at least one child,
false otherwise.
DrbNode getNamedChild(String name,
int occurence)
name - The name to match.occurence - The occurrence number of the desired child.
null if not found.DrbNode getFirstChild()
DrbNode getLastChild()
DrbNode getChildAt(int index)
index - The position of the node to retrieve starting from 0 and not
greater or equal to the number of children.
int getChildrenCount()
DrbNode getPreviousSibling()
DrbNode getNextSibling()
|
Data Request Broker - DRB API® 2-3-release |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||