wt.xml.io
Class DOMTreeDecoder

java.lang.Object
  extended bywt.xml.io.DOMTreeDecoder
All Implemented Interfaces:
PersistentRetrieveIfc, XMLMechanismConstants

public class DOMTreeDecoder
extends Object
implements PersistentRetrieveIfc, XMLMechanismConstants


Field Summary
private  Node ActiveNode
           
private  DOMTreeDecoderCallback callback
           
private  boolean callbackFinished
           
private  NodeList ChildNodeList
           
private  Stack ChildNodes
           
private  Vector ChildNodesFilled
           
private  Stack ChildNodesUseStack
           
private static boolean DEBUG
           
private  int iNrChildren
           
private  Stack Nodes
           
private  int readObjectDepth
           
private  Node tree
           
 
Fields inherited from interface wt.pds.PersistentRetrieveIfc
versionID
 
Fields inherited from interface wt.util.xml.XMLMechanismConstants
ATTLIST_ATTRIBUTE_NAME, ATTLIST_CLASS_NAME, ATTLIST_ENCODING_TYPE, ATTLIST_OID, DEFAULT_XML_PARSER_IMPLEMENTATION, DOCUMENT_ELEMENT_NAME, SELF_DESCRIBING_XML, XML_FILE_EXT
 
Constructor Summary
private DOMTreeDecoder()
           
  DOMTreeDecoder(Element tree)
           
  DOMTreeDecoder(Element tree, DOMTreeDecoderCallback callback)
           
 
Method Summary
 void close()
          Immediately release a ResultSet's datastore and connection resources
private  Object deserializeObject(byte[] bArray)
           
private  Node findNode(String tagName)
           
private  Node findNode(String tagName, String tagAttributeValue)
           
 InputStream getAsciiStream(String attribute_name)
          Get the value of a column in the current row as a stream of ASCII characters.
 BigDecimal getBigDecimal(String attribute_name)
          Get the value of a column in the current row as a BigDecimal
 InputStream getBinaryStream(String attribute_name)
          Get the value of a column in the current row as a stream of uninterpreted bytes.
 boolean getBoolean(String attribute_name)
          Get the value of a column in the current row as a Java boolean.
 Boolean getBooleanObject(String attribute_name)
          Get the value of a column in the current row as a Boolean.
 byte getByte(String attribute_name)
          Get the value of a column in the current row as a Java byte.
private  byte[] getByteData(Node theNode)
           
 Byte getByteObject(String attribute_name)
          Get the value of a column in the current row as a Byte.
 byte[] getBytes(String attribute_name)
          Get the value of a column in the current row as a Java byte array.
 char getChar(String attribute_name)
          Get the value of a column in the current row as a Java char.
 Character getCharObject(String attribute_name)
          Get the value of a column in the current row as a Character.
 String getContainer()
          Get the current container name.
private  String getData(Node theNode)
           
 Date getDate(String attribute_name)
          Get the value of a column in the current row as a java.sql.Date object.
 double getDouble(String attribute_name)
          Get the value of a column in the current row as a Java double.
 Double getDoubleObject(String attribute_name)
          Get the value of a column in the current row as a Double.
 float getFloat(String attribute_name)
          Get the value of a column in the current row as a Java float.
 Float getFloatObject(String attribute_name)
          Get the value of a column in the current row as a Float.
 Object getInlineObject(String attribute_name, String blobAttributeName)
          Get the value of a blob column as a Java Object.
 int getInt(String attribute_name)
          Get the value of a column in the current row as a Java int.
 Integer getIntObject(String attribute_name)
          Get the value of a column in the current row as an Integer.
 LobLocator getLobLocator(String attribute_name)
          Get a LobLocator for the given attribute.
 long getLong(String attribute_name)
          Get the value of a column in the current row as a Java long.
 Long getLongObject(String attribute_name)
          Get the value of a column in the current row as a Long.
 Object getObject(String attribute_name)
          Get the value of a column in the current row as a Java object.
 short getShort(String attribute_name)
          Get the value of a column in the current row as a Java short.
 Short getShortObject(String attribute_name)
          Get the value of a column in the current row as a Short.
 Object getSmallObject(String attribute_name)
          Get the value of a column in the current row as a Java object.
 String getString(String attribute_name)
          Get the value of a column in the current row as a Java String.
 Time getTime(String attribute_name)
          Get the value of a column in the current row as a java.sql.Time object.
 Timestamp getTimestamp(String attribute_name)
          Get the value of a column in the current row as a java.sql.Timestamp object.
 Node getTree()
           
 InputStream getUnicodeStream(String attribute_name)
          Get the value of a column in the current row as a stream of Unicode characters and then read in chunks.
protected  void initDecoder(Node tree)
           
 boolean next()
          A ResultSet is initially positioned before its first row; the first call to next makes the first row the current row; the second call makes the second row the current row, etc.
private  boolean popEm()
           
private  boolean pushEm()
           
 ObjectMappable readObject(String attribute_name, ObjectMappable obj, Class concrete_class, boolean is_required)
          Get the values corresponding to a nested ObjectMappable Object.
 void reset(Element tree)
           
private  void setNodeStructures(Node thisNode)
           
 boolean wasNull()
          A column may have the value of SQL NULL; wasNull reports whether the last column read had this special value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

tree

private Node tree

ActiveNode

private Node ActiveNode

ChildNodeList

private NodeList ChildNodeList

ChildNodesFilled

private Vector ChildNodesFilled

iNrChildren

private int iNrChildren

Nodes

private Stack Nodes

ChildNodes

private Stack ChildNodes

ChildNodesUseStack

private Stack ChildNodesUseStack

callback

private DOMTreeDecoderCallback callback

readObjectDepth

private int readObjectDepth

callbackFinished

private boolean callbackFinished
Constructor Detail

DOMTreeDecoder

private DOMTreeDecoder()

DOMTreeDecoder

public DOMTreeDecoder(Element tree)
               throws XMLIOException

DOMTreeDecoder

public DOMTreeDecoder(Element tree,
                      DOMTreeDecoderCallback callback)
               throws XMLIOException
Method Detail

getTree

public Node getTree()
             throws XMLIOException
Throws:
XMLIOException

reset

public void reset(Element tree)
           throws XMLIOException
Throws:
XMLIOException

initDecoder

protected void initDecoder(Node tree)

setNodeStructures

private void setNodeStructures(Node thisNode)
                        throws XMLIOException
Throws:
XMLIOException

pushEm

private boolean pushEm()
                throws XMLIOException
Throws:
XMLIOException

popEm

private boolean popEm()

findNode

private Node findNode(String tagName)
               throws XMLIOException
Throws:
XMLIOException

findNode

private Node findNode(String tagName,
                      String tagAttributeValue)
               throws XMLIOException
Throws:
XMLIOException

getData

private String getData(Node theNode)
                throws XMLIOException
Throws:
XMLIOException

getByteData

private byte[] getByteData(Node theNode)
                    throws XMLIOException
Throws:
XMLIOException

deserializeObject

private Object deserializeObject(byte[] bArray)
                          throws XMLIOException
Throws:
XMLIOException

getAsciiStream

public InputStream getAsciiStream(String attribute_name)
                           throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a stream of ASCII characters.

Specified by:
getAsciiStream in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getBigDecimal

public BigDecimal getBigDecimal(String attribute_name)
                         throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a BigDecimal

Specified by:
getBigDecimal in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getBinaryStream

public InputStream getBinaryStream(String attribute_name)
                            throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a stream of uninterpreted bytes.

Specified by:
getBinaryStream in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getBoolean

public boolean getBoolean(String attribute_name)
                   throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java boolean.

Specified by:
getBoolean in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is false
Throws:
XMLIOException

getBooleanObject

public Boolean getBooleanObject(String attribute_name)
                         throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Boolean.

Specified by:
getBooleanObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
XMLIOException

getByte

public byte getByte(String attribute_name)
             throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java byte.

Specified by:
getByte in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
XMLIOException

getByteObject

public Byte getByteObject(String attribute_name)
                   throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Byte.

Specified by:
getByteObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
XMLIOException

getBytes

public byte[] getBytes(String attribute_name)
                throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java byte array.

Specified by:
getBytes in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getChar

public char getChar(String attribute_name)
             throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java char.

Specified by:
getChar in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
XMLIOException

getCharObject

public Character getCharObject(String attribute_name)
                        throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Character.

Specified by:
getCharObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
XMLIOException

getDate

public Date getDate(String attribute_name)
             throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a java.sql.Date object.

Specified by:
getDate in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getDouble

public double getDouble(String attribute_name)
                 throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java double.

Specified by:
getDouble in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
XMLIOException

getDoubleObject

public Double getDoubleObject(String attribute_name)
                       throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Double.

Specified by:
getDoubleObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
XMLIOException

getFloat

public float getFloat(String attribute_name)
               throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java float.

Specified by:
getFloat in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
XMLIOException

getFloatObject

public Float getFloatObject(String attribute_name)
                     throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Float.

Specified by:
getFloatObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
XMLIOException

getInlineObject

public Object getInlineObject(String attribute_name,
                              String blobAttributeName)
                       throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a blob column as a Java Object.

Specified by:
getInlineObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
blobAttributeName - a blob attribute name
Throws:
XMLIOException

getInt

public int getInt(String attribute_name)
           throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java int.

Specified by:
getInt in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
XMLIOException

getIntObject

public Integer getIntObject(String attribute_name)
                     throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as an Integer.

Specified by:
getIntObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
XMLIOException

getLong

public long getLong(String attribute_name)
             throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java long.

Specified by:
getLong in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
XMLIOException

getLongObject

public Long getLongObject(String attribute_name)
                   throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Long.

Specified by:
getLongObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
XMLIOException

getObject

public Object getObject(String attribute_name)
                 throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java object.

Specified by:
getObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getSmallObject

public Object getSmallObject(String attribute_name)
                      throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java object.

Specified by:
getSmallObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getShort

public short getShort(String attribute_name)
               throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java short.

Specified by:
getShort in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
XMLIOException

getShortObject

public Short getShortObject(String attribute_name)
                     throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Short.

Specified by:
getShortObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
XMLIOException

getString

public String getString(String attribute_name)
                 throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a Java String.

Specified by:
getString in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getTime

public Time getTime(String attribute_name)
             throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a java.sql.Time object.

Specified by:
getTime in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getTimestamp

public Timestamp getTimestamp(String attribute_name)
                       throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a java.sql.Timestamp object.

Specified by:
getTimestamp in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getUnicodeStream

public InputStream getUnicodeStream(String attribute_name)
                             throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the value of a column in the current row as a stream of Unicode characters and then read in chunks.

Specified by:
getUnicodeStream in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
XMLIOException

getLobLocator

public LobLocator getLobLocator(String attribute_name)
                         throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get a LobLocator for the given attribute.

Specified by:
getLobLocator in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
Throws:
XMLIOException

readObject

public ObjectMappable readObject(String attribute_name,
                                 ObjectMappable obj,
                                 Class concrete_class,
                                 boolean is_required)
                          throws XMLIOException
Description copied from interface: PersistentRetrieveIfc
Get the values corresponding to a nested ObjectMappable Object. This results in a call to the nested object's readExternal method.

Specified by:
readObject in interface PersistentRetrieveIfc
Parameters:
attribute_name - a class attribute name
obj - the nested object
concrete_class - the class to instantiate if needed
Throws:
XMLIOException

getContainer

public String getContainer()
Description copied from interface: PersistentRetrieveIfc
Get the current container name. The container name is set by calls to readObject.

Specified by:
getContainer in interface PersistentRetrieveIfc
Returns:
the current container name

next

public boolean next()
Description copied from interface: PersistentRetrieveIfc
A ResultSet is initially positioned before its first row; the first call to next makes the first row the current row; the second call makes the second row the current row, etc.

Specified by:
next in interface PersistentRetrieveIfc
Returns:
true if new row is valid, false if there are no more rows

close

public void close()
Description copied from interface: PersistentRetrieveIfc
Immediately release a ResultSet's datastore and connection resources

Specified by:
close in interface PersistentRetrieveIfc

wasNull

public boolean wasNull()
Description copied from interface: PersistentRetrieveIfc
A column may have the value of SQL NULL; wasNull reports whether the last column read had this special value. Note that you must first call getXXX on a column to try to read its value and then call wasNull() to find if the value was the SQL NULL.

Specified by:
wasNull in interface PersistentRetrieveIfc
Returns:
true if last column was a null value