gov.sns.tools.data
Class TransientDataAdaptor

java.lang.Object
  |
  +--gov.sns.tools.data.TransientDataAdaptor
All Implemented Interfaces:
DataAdaptor

public class TransientDataAdaptor
extends java.lang.Object
implements DataAdaptor

A volatile implementation of the DataAdaptor interface. TransientDataAdaptor is intended as a convenience class for passing data using the DataAdaptor interface. Note, however, class supports no persistence. Once an object of class TransientDataAdaptor is destroyed all internal data is lost.


Constructor Summary
TransientDataAdaptor(java.lang.String strLabel)
          Create a new instance of VolatileDataAdaptor
 
Method Summary
 java.lang.String[] attributes()
          Get all the attribute names in the data node.
 boolean booleanValue(java.lang.String strAttrName)
          Get the value of an attribute.
 DataAdaptor childAdaptor(java.lang.String strLabel)
          Convenience method to get a single child adaptor when only one is expected.
 java.util.Iterator childAdaptorIterator()
          Get an iterator containing all child adaptors of this node.
 java.util.Iterator childAdaptorIterator(java.lang.String strLabel)
          Get an iterator for all child data nodes having a given data label.
 java.util.List childAdaptors()
          Get all the child data nodes of this adaptor.
 java.util.List childAdaptors(java.lang.String strLabel)
          Get all the child data nodes of a particular data label.
 DataAdaptor createChild(java.lang.String strLabel)
          Create a new empty child adaptor with the specified label.
 double doubleValue(java.lang.String strAttrName)
          Get the value of an attribute.
 boolean hasAttribute(java.lang.String strAttrName)
          Test whether or not an attribute is present in the data node.
 int intValue(java.lang.String strAttrName)
          Get the value of an attribute.
 long longValue(java.lang.String strAttrName)
          Get the value of an attribute.
 java.lang.String name()
          Get the label for this data node.
 int nodeCount()
          Get the number of child data nodes.
 void print(java.io.PrintStream os)
           
 void setValue(java.lang.String strAttrName, boolean bolAttrVal)
          Set the value of the specified attribute
 void setValue(java.lang.String strAttrName, double dblAttrVal)
          Set the value of the specified attribute
 void setValue(java.lang.String strAttrName, int intAttrVal)
          Set the value of the specified attribute
 void setValue(java.lang.String strAttrName, long longAttrVal)
          Set the value of the specified attribute
 void setValue(java.lang.String strAttrName, java.lang.Object objAttrVal)
          Set the value of the specified attribute
 void setValue(java.lang.String strAttrName, java.lang.String strAttrVal)
          Set the value of the specified attribute as a string.
 java.lang.String stringValue(java.lang.String strAttrName)
          Get the value of an attribute.
 void writeNode(DataListener ifcSrc)
          Write out the listener data as a new node then append it as a child node in the data tree.
 void writeNodes(java.util.Collection colSrcs)
          write the collection of listeners to new nodes and append them to the data tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransientDataAdaptor

public TransientDataAdaptor(java.lang.String strLabel)
Create a new instance of VolatileDataAdaptor

Parameters:
strLabel - label for new data node
Method Detail

name

public java.lang.String name()
Get the label for this data node.

Specified by:
name in interface DataAdaptor
Returns:
name for the particular node in the data tree

attributes

public java.lang.String[] attributes()
Get all the attribute names in the data node.

Specified by:
attributes in interface DataAdaptor
Returns:
array of all attributes names

hasAttribute

public boolean hasAttribute(java.lang.String strAttrName)
Test whether or not an attribute is present in the data node.

Specified by:
hasAttribute in interface DataAdaptor
Parameters:
strAttrName - attribute name
Returns:
true if specified attribute is present, false otherwise

stringValue

public java.lang.String stringValue(java.lang.String strAttrName)
Get the value of an attribute.

Specified by:
stringValue in interface DataAdaptor
Parameters:
strAttrName - name of attribute
Returns:
value of attribute as boolean

booleanValue

public boolean booleanValue(java.lang.String strAttrName)
                     throws java.lang.NumberFormatException
Get the value of an attribute.

Specified by:
booleanValue in interface DataAdaptor
Parameters:
strAttrName - name of attribute
Returns:
value of attribute as boolean
Throws:
java.lang.NumberFormatException - unable to parse value as boolean

intValue

public int intValue(java.lang.String strAttrName)
Get the value of an attribute.

Specified by:
intValue in interface DataAdaptor
Parameters:
strAttrName - name of attribute
Returns:
value of attribute as int
Throws:
java.lang.NumberFormatException - unable to parse value as int

longValue

public long longValue(java.lang.String strAttrName)
Get the value of an attribute.

Specified by:
longValue in interface DataAdaptor
Parameters:
strAttrName - name of attribute
Returns:
value of attribute as long
Throws:
java.lang.NumberFormatException - unable to parse value as long

doubleValue

public double doubleValue(java.lang.String strAttrName)
Get the value of an attribute.

Specified by:
doubleValue in interface DataAdaptor
Parameters:
strAttrName - name of attribute
Returns:
value of attribute as double
Throws:
java.lang.NumberFormatException - unable to parse value as double

setValue

public void setValue(java.lang.String strAttrName,
                     java.lang.String strAttrVal)
Set the value of the specified attribute as a string.

Specified by:
setValue in interface DataAdaptor
Parameters:
strAttrName - attribute name
strAttrVal - attribute value

setValue

public void setValue(java.lang.String strAttrName,
                     java.lang.Object objAttrVal)
Set the value of the specified attribute

Specified by:
setValue in interface DataAdaptor
Parameters:
strAttrName - attribute name
objAttrVal - new attribute value

setValue

public void setValue(java.lang.String strAttrName,
                     boolean bolAttrVal)
Set the value of the specified attribute

Specified by:
setValue in interface DataAdaptor
Parameters:
strAttrName - attribute name
bolAttrVal - new attribute value

setValue

public void setValue(java.lang.String strAttrName,
                     int intAttrVal)
Set the value of the specified attribute

Specified by:
setValue in interface DataAdaptor
Parameters:
strAttrName - attribute name
intAttrVal - new attribute value

setValue

public void setValue(java.lang.String strAttrName,
                     long longAttrVal)
Set the value of the specified attribute

Specified by:
setValue in interface DataAdaptor
Parameters:
strAttrName - attribute name
longAttrVal - new attribute value

setValue

public void setValue(java.lang.String strAttrName,
                     double dblAttrVal)
Set the value of the specified attribute

Specified by:
setValue in interface DataAdaptor
Parameters:
strAttrName - attribute name
dblAttrVal - new attribute value

nodeCount

public int nodeCount()
Get the number of child data nodes.

Specified by:
nodeCount in interface DataAdaptor
Returns:
number of child node adaptors

childAdaptor

public DataAdaptor childAdaptor(java.lang.String strLabel)
Convenience method to get a single child adaptor when only one is expected.

Specified by:
childAdaptor in interface DataAdaptor
Parameters:
strLabel - data label of child node
Returns:
first child node with label strLabel, null if none exist

childAdaptors

public java.util.List childAdaptors()
Get all the child data nodes of this adaptor.

Specified by:
childAdaptors in interface DataAdaptor
Returns:
all child adaptors

childAdaptors

public java.util.List childAdaptors(java.lang.String strLabel)
Get all the child data nodes of a particular data label.

Specified by:
childAdaptors in interface DataAdaptor
Parameters:
strLabel - data label for child nodes
Returns:
all child adaptors with specified label

childAdaptorIterator

public java.util.Iterator childAdaptorIterator()
Get an iterator containing all child adaptors of this node.

Specified by:
childAdaptorIterator in interface DataAdaptor
Returns:
iterator of all child adaptors

childAdaptorIterator

public java.util.Iterator childAdaptorIterator(java.lang.String strLabel)
Get an iterator for all child data nodes having a given data label.

Specified by:
childAdaptorIterator in interface DataAdaptor
Parameters:
strLabel - data label for child nodes
Returns:
iterator of child adaptors with specified label

createChild

public DataAdaptor createChild(java.lang.String strLabel)
Create a new empty child adaptor with the specified label.

Specified by:
createChild in interface DataAdaptor
Parameters:
strLabel - data label for the child node
Returns:
new child data node attached to this

writeNode

public void writeNode(DataListener ifcSrc)
Write out the listener data as a new node then append it as a child node in the data tree.

Specified by:
writeNode in interface DataAdaptor
Parameters:
ifcSrc -

writeNodes

public void writeNodes(java.util.Collection colSrcs)
write the collection of listeners to new nodes and append them to the data tree.

Specified by:
writeNodes in interface DataAdaptor

print

public void print(java.io.PrintStream os)