wt.xml
Class WTIntrospectorToDOMDocumentGenerator

java.lang.Object
  extended bywt.xml.DOMDocumentGenerator
      extended bywt.xml.WTIntrospectorToDOMDocumentGenerator
All Implemented Interfaces:
Externalizable, Serializable, XMLMechanismConstants

class WTIntrospectorToDOMDocumentGenerator
extends DOMDocumentGenerator
implements XMLMechanismConstants, Externalizable



Supported API: false

Extendable: false


Field Summary
private static String CLASSNAME
           
private static boolean DEBUG
           
static long EXTERNALIZATION_VERSION_UID
           
 boolean INSTANCE_DEBUG
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
 
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
(package private) WTIntrospectorToDOMDocumentGenerator()
           
 
Method Summary
 Document createDOMDocument()
          Creates a new DOM Document object with a Document element and no other children.
 Document createDOMDocument(String fullyQualifiedPersistableTypeClassName)
          Creates a new skeletal DOM Document object given the fully qualified name of the persistable type for which a skeletal DOM Document should be created.
 Document createDOMDocument(XMLSchemaInfo theXMLSchemaInfo)
          Creates a new DOM Document object and populates it with elements matching the data in an XMLSchemaInfo's elementIndex hashtable.
 XMLSchemaInfo createXMLSchemaInfo(String fullyQualifiedPersistableTypeClassName)
          Creates an XMLSchemaInfo object complete with introspection information for the creation of a DOM Document object.
private  XMLSchemaInfo defineElement(String attributeNameClassNamePair, XMLSchemaInfo theXMLSchemaInfo, boolean rootElement)
          Recursively traverses the "tree" of persistable attributes given a classname.
private  void expandDOMTree(DOMComponents dom, Hashtable elementIndex, String elementName, boolean root)
          Expands a new DOM Document's tree by adding elements until it matches the data in the XMLSchemaInfo's elementIndex.
 boolean getInstanceDebug()
           
static WTIntrospectorToDOMDocumentGenerator newWTIntrospectorToDOMDocumentGenerator()
          

Supported API: false
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(WTIntrospectorToDOMDocumentGenerator thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void setInstanceDebug(boolean state)
           
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class wt.xml.DOMDocumentGenerator
newDOMDocumentGenerator, readVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

INSTANCE_DEBUG

public boolean INSTANCE_DEBUG
Constructor Detail

WTIntrospectorToDOMDocumentGenerator

WTIntrospectorToDOMDocumentGenerator()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class DOMDocumentGenerator
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class DOMDocumentGenerator
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(WTIntrospectorToDOMDocumentGenerator thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

newWTIntrospectorToDOMDocumentGenerator

public static WTIntrospectorToDOMDocumentGenerator newWTIntrospectorToDOMDocumentGenerator()
                                                                                    throws XMLMechanismException


Supported API: false

Returns:
WTIntrospectorToDOMDocumentGenerator
Throws:
XMLMechanismException

createDOMDocument

public Document createDOMDocument(String fullyQualifiedPersistableTypeClassName)
                           throws XMLMechanismException
Creates a new skeletal DOM Document object given the fully qualified name of the persistable type for which a skeletal DOM Document should be created. Uses the createXMLSchemaInfo(String) : XMLSchemaInfo and createDOMDocument(XMLSchemaInfo) : Document methods.

Supported API: false

Specified by:
createDOMDocument in class DOMDocumentGenerator
Parameters:
fullyQualifiedPersistableTypeClassName - the fully qualified class name of the persistable type to be represented as a skeletal DOM Document.
Returns:
Document
Throws:
XMLMechanismException

createXMLSchemaInfo

public XMLSchemaInfo createXMLSchemaInfo(String fullyQualifiedPersistableTypeClassName)
                                  throws XMLMechanismException
Creates an XMLSchemaInfo object complete with introspection information for the creation of a DOM Document object. Requires the class name of the persistable object whose introspection information is to be stored.

Supported API: false

Specified by:
createXMLSchemaInfo in class DOMDocumentGenerator
Parameters:
fullyQualifiedPersistableTypeClassName - the fully qualified class name of the persistable type to be represented as a skeletal DOM Document.
Returns:
XMLSchemaInfo
Throws:
XMLMechanismException

createDOMDocument

public Document createDOMDocument(XMLSchemaInfo theXMLSchemaInfo)
                           throws XMLMechanismException
Creates a new DOM Document object and populates it with elements matching the data in an XMLSchemaInfo's elementIndex hashtable. Includes all elements except children of CharacterData. This serves as a skeletal DOM document, which can have the character data (CData Sections and/or Text elements) appended later.

Supported API: false

Specified by:
createDOMDocument in class DOMDocumentGenerator
Parameters:
theXMLSchemaInfo -
Returns:
Document
Throws:
XMLMechanismException

createDOMDocument

public Document createDOMDocument()
                           throws XMLMechanismException
Creates a new DOM Document object with a Document element and no other children. This Document is suitable for passing to the DOMTreeEncoder via its setDocument method for on-the-fly encoding (bypassing introspection).

Supported API: false

Specified by:
createDOMDocument in class DOMDocumentGenerator
Returns:
Document
Throws:
XMLMechanismException

defineElement

private XMLSchemaInfo defineElement(String attributeNameClassNamePair,
                                    XMLSchemaInfo theXMLSchemaInfo,
                                    boolean rootElement)
Recursively traverses the "tree" of persistable attributes given a classname. For each new Element definition, the attribute name and class name will be stored in a vector to be checked in order to avoid duplicate definitions.

Parameters:
attributeNameClassNamePair - the attribute name and class name of the persistable object to define.
theXMLSchemaInfo - object storing the necessary element information.
rootElement - true if the fullyQualifiedClassName given is for the root persistable object.
Returns:
XMLSchemaInfo

expandDOMTree

private void expandDOMTree(DOMComponents dom,
                           Hashtable elementIndex,
                           String elementName,
                           boolean root)
Expands a new DOM Document's tree by adding elements until it matches the data in the XMLSchemaInfo's elementIndex. Legitimate values for attributes are included where possible, otherwise the string "null" is used.

Parameters:
dom - an object with the attributes and methods for creating DOM Documents
elementIndex - The hashtable with the vector of children for each element.
elementName - The name of the last element created.
root -

setInstanceDebug

public void setInstanceDebug(boolean state)
Specified by:
setInstanceDebug in class DOMDocumentGenerator

getInstanceDebug

public boolean getInstanceDebug()
Specified by:
getInstanceDebug in class DOMDocumentGenerator