org.openejb.alt.assembler.classic.xml
Class DomTools

java.lang.Object
  extended by org.openejb.alt.assembler.classic.xml.DomTools

public class DomTools
extends java.lang.Object

Author:
David Blevins, Richard Monson-Haefel

Field Summary
static boolean debug
          If true debug data will be printed to the System.out containing the data in the XML config file being parsed.
static int debugRecursionDepth
           
static java.lang.String PROPERTIES
          Represents the properties element in the XML config file.
static java.lang.String PROPERTY
          Represents the property element in the XML config file.
static java.lang.String PROPERTY_NAME
          Represents the property-name element in the XML config file.
static java.lang.String PROPERTY_VALUE
          Represents the property-value element in the XML config file.
static SafeToolkit toolkit
           
 
Constructor Summary
DomTools()
           
 
Method Summary
protected static DomObject collectChildElementByType(org.w3c.dom.Node node, java.lang.Class classType, java.lang.String elementType)
          Convenience method for obtaining a single child element from the node passed in.
protected static DomObject[] collectChildElementsByType(org.w3c.dom.Node node, java.lang.Class classType, java.lang.String elementType)
          Convenience method for obtaining all the child elements of the node passed in.
protected static org.w3c.dom.Node getChildElement(org.w3c.dom.Node node, java.lang.String childName)
          Returns the child element of the node passed in that matches the element name passed in.
protected static java.lang.String getChildElementPCData(org.w3c.dom.Node node, java.lang.String elementType)
          Returns the PCDATA of a child element in the node passed in.
protected static org.w3c.dom.Node[] getChildElements(org.w3c.dom.Node node, java.lang.String childName)
          Returns the child elements of the node passed in that match the element name passed in.
protected static java.lang.String[] getChildElementsPCData(org.w3c.dom.Node node, java.lang.String elementType)
          Returns the PCDATA of all child elements to the node passed in.
protected static java.util.Properties getElementAttributes(org.w3c.dom.Node node)
          Returns the named attributes of the node passed in.
protected static java.lang.String getElementPCData(org.w3c.dom.Node node)
          Returns the PCDATA of the node passed in.
static java.util.Properties readProperties(org.w3c.dom.Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toolkit

public static final SafeToolkit toolkit

PROPERTIES

public static final java.lang.String PROPERTIES
Represents the properties element in the XML config file.

See Also:
Constant Field Values

PROPERTY

public static final java.lang.String PROPERTY
Represents the property element in the XML config file.

See Also:
Constant Field Values

PROPERTY_NAME

public static final java.lang.String PROPERTY_NAME
Represents the property-name element in the XML config file.

See Also:
Constant Field Values

PROPERTY_VALUE

public static final java.lang.String PROPERTY_VALUE
Represents the property-value element in the XML config file.

See Also:
Constant Field Values

debug

public static final boolean debug
If true debug data will be printed to the System.out containing the data in the XML config file being parsed.

See Also:
Constant Field Values

debugRecursionDepth

public static int debugRecursionDepth
Constructor Detail

DomTools

public DomTools()
Method Detail

readProperties

public static java.util.Properties readProperties(org.w3c.dom.Node node)

collectChildElementsByType

protected static DomObject[] collectChildElementsByType(org.w3c.dom.Node node,
                                                        java.lang.Class classType,
                                                        java.lang.String elementType)
                                                 throws OpenEJBException
Convenience method for obtaining all the child elements of the node passed in. When a child element with a name matching the elementType is found in the node a new instance of classType is created, cast to DomObject, then initializeFromDOM is called on the new instance and the child element is passed in as the parameter.

Parameters:
node - the node in the DOM containing the child elements needed.
classType - the subclass of DomObject that will parse the data in the child elements.
elementType - the name of the child element as it appears in the DTD.
Returns:
an array of the DomObject subclasses initialized with the child elements.
Throws:
OpenEJBException
See Also:
Node

collectChildElementByType

protected static DomObject collectChildElementByType(org.w3c.dom.Node node,
                                                     java.lang.Class classType,
                                                     java.lang.String elementType)
                                              throws OpenEJBException
Convenience method for obtaining a single child element from the node passed in. When a child element with a name matching the elementType is found in the node a new instance of classType is created, cast to DomObject, then initializeFromDOM is called on the new instance and the child element is passed in as the parameter.

Parameters:
node - the node in the DOM containing the child elements needed.
classType - the subclass of DomObject that will parse the data in the child elements.
elementType - the name of the child element as it appears in the DTD.
Returns:
an DomObject subclass of type classType initialized with the child element.
Throws:
OpenEJBException
See Also:
Node

getChildElementsPCData

protected static java.lang.String[] getChildElementsPCData(org.w3c.dom.Node node,
                                                           java.lang.String elementType)
Returns the PCDATA of all child elements to the node passed in. A child elements PCDATA will be collected if its name matches the elementType specified.

Parameters:
node - the node in the DOM containing the child element.
elementType - the name of the child element as it appears in the DTD.
Returns:
an array of String containing the PCDATA of the child elements.

getChildElementPCData

protected static java.lang.String getChildElementPCData(org.w3c.dom.Node node,
                                                        java.lang.String elementType)
Returns the PCDATA of a child element in the node passed in. A child elements PCDATA will be returned if its name matches the elementType specified.

Parameters:
node - the node in the DOM containing the child element.
elementType - the name of the child element as it appears in the DTD.
Returns:
the PCDATA of the child elements.

getElementPCData

protected static java.lang.String getElementPCData(org.w3c.dom.Node node)
Returns the PCDATA of the node passed in.

Parameters:
node - the node in the DOM containing the PCDATA.
Returns:
the PCDATA of the node.

getElementAttributes

protected static java.util.Properties getElementAttributes(org.w3c.dom.Node node)
Returns the named attributes of the node passed in.

Parameters:
node - the node in the DOM containing the attributes.
Returns:
a Properties object containing the attributes of the node.

getChildElement

protected static org.w3c.dom.Node getChildElement(org.w3c.dom.Node node,
                                                  java.lang.String childName)
Returns the child element of the node passed in that matches the element name passed in.

Parameters:
node - the node in the DOM containing the PCDATA.
childName - the element name of the desired child element as defined in the DTD.
Returns:
the desired child element. OR null if the child element is not present

getChildElements

protected static org.w3c.dom.Node[] getChildElements(org.w3c.dom.Node node,
                                                     java.lang.String childName)
Returns the child elements of the node passed in that match the element name passed in.

Parameters:
node - the node in the DOM containing the PCDATA.
childName - the element name of the desired child element as defined in the DTD.
Returns:
an array of Node containing all the desired child elements.


Copyright © 1999-2011 OpenEJB. All Rights Reserved.