Data Request Broker
2-3-release

fr.gael.drb
Interface DrbItem

All Known Subinterfaces:
DrbAttribute, DrbMutableNode, DrbNode, fr.gael.drb.DrbSimpleNode, Numeric, NumericArray, Value, ValueArray, XsdNode
All Known Implementing Classes:
AbstractNumericArray, AbstractValueArray, Binary, BinaryInteger, Boolean, BooleanArray, Byte, ByteArray, DateTime, DayTimeDuration, Decimal, DefaultValueArray, Double, DoubleArray, DrbAbstractAttribute, DrbAbstractNode, DrbDefaultAttribute, DrbDefaultMutableNode, DrbNodeImpl, fr.gael.drb.impl.spi.DrbNodeSpi, Duration, File, FileNode, Float, FloatArray, FtpNode, Int, IntArray, Integer, Long, LongArray, Short, ShortArray, String, UnsignedByte, UnsignedByteArray, UnsignedInt, UnsignedIntArray, UnsignedLong, UnsignedLongArray, UnsignedShort, UnsignedShortArray, URLNode, XmlDocument, XmlNode, XsdNodeImpl, YearMonthDuration, ZipFileNode, ZipNode

public interface DrbItem

Item interface. This interface represents commons properties of structured data. Supported item kinds are nodes, attributes and values.


Field Summary
static int ATTRIBUTE_ITEM
          The item is an attribute.
static int NODE_ITEM
          The item is a node.
static int UNDEFINED_ITEM
          The item type is undefined.
static int VALUE_ITEM
          The item is a value.
 
Method Summary
 int getItemType()
          A code representing the type of the underlying object, as defined above.
 String getName()
          Name of the item.
 String getNamespaceURI()
          Get namespace URI.
 Value getValue()
          The value of the item.
 void rename(String name)
          Changes the name of the item.
 void setNamespaceURI(String namespace_uri)
          Sets a namespace resource identifier.
 Value setValue(Value value)
          Changes the value of the item.
 

Field Detail

UNDEFINED_ITEM

static final int UNDEFINED_ITEM
The item type is undefined.

See Also:
Constant Field Values

NODE_ITEM

static final int NODE_ITEM
The item is a node.

See Also:
Constant Field Values

ATTRIBUTE_ITEM

static final int ATTRIBUTE_ITEM
The item is an attribute.

See Also:
Constant Field Values

VALUE_ITEM

static final int VALUE_ITEM
The item is a value.

See Also:
Constant Field Values
Method Detail

getItemType

int getItemType()
A code representing the type of the underlying object, as defined above.

Returns:
The code of this item.

getName

String getName()
Name of the item. Returns the name of the item. This name does not contain any prefix, path nor any other location or identification part.

Returns:
The name of the item.

rename

void rename(String name)
            throws NullPointerException,
                   UnsupportedOperationException
Changes the name of the item. The passed name may be an empty string but never a null reference. The change is persistant such as further instance of a same node (even in different sessions) will have this new name. If the implementation does not suppot the rename operation it is supposed to throw a UnsupportedOperationException.

Parameters:
name - Reference to the new name.
Throws:
UnsupportedOperationException - This exception is raised when the implementation does not support the requested rename for any reason (e.g. specific case or general incapability).
NullPointerException - This exception is raised when the passed name is a null reference.This exception may be overriden by an UnsupportedOperationException.

getNamespaceURI

String getNamespaceURI()
Get namespace URI. The namespace URI of this item, or null if it is unspecified. This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.

Returns:
The namspace URI or null if unspecified.

setNamespaceURI

void setNamespaceURI(String namespace_uri)
                     throws NullPointerException,
                            UnsupportedOperationException
Sets a namespace resource identifier. The new namespace identifier shall not be null.

Important note: The implementation of the item 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.

Parameters:
namespace_uri - A reference to the new namespace identifier.
Throws:
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).

getValue

Value getValue()
The value of the item. The value is expressed accoring to one of the types supported by the fr.gael.drb.value package. Generally these types correspond to primitive types (e.g. integer, floating points, etc.) or very low level types (e.g. string, date, etc.). On the contrary to DOM implementation all the types are allowed even the arrays, date etc. Only the Value.NULL_ID type is forbidden.

Returns:
The value of the item.

setValue

Value setValue(Value value)
               throws NullPointerException,
                      ClassCastException,
                      UnsupportedOperationException
Changes the value of the item. This operation sets a new value of the current item.The value type of the item shall be compatible with the item implementation. If the type does not match exactly it is casted to a compatible one based on the the fr.gael.drb.value capabilities. A reference to the effectivelly assigned value is returned by the operation so it is possible to check if a cast has been performed and therefore assess the accuracy of the assignement. If the cast is not possible the operation raises an UnsupportedOperationException. If the assignment is possible and the item implementation has a physical representation the value is updated in the physical source in order to persist among sessions. It therefore possible that this operation consumses an variable time.

Parameters:
value - The new value of the node. This value shall not be null.
Returns:
The effectivelly assigned value. The type of this value may differ from the input one.
Throws:
NullPointerException - This exception is raised when the passed reference to the value is null. This exception may be overriden 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.

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .