org.codehaus.dna.impl
Class ConfigurationUtil

java.lang.Object
  extended byorg.codehaus.dna.impl.ConfigurationUtil

public class ConfigurationUtil
extends java.lang.Object

Class containing utility methods to work with Configuration objects.

Version:
$Revision: 1.2 $ $Date: 2004/05/01 09:51:48 $

Field Summary
static java.lang.String PATH_SEPARATOR
          Constant defining separator for paths in document.
static java.lang.String ROOT_PATH
          Constant defining root path of document.
 
Constructor Summary
ConfigurationUtil()
           
 
Method Summary
static Configuration buildFromXML(org.xml.sax.InputSource input)
          Create a configuration object from specified XML InputSource.
static boolean equals(Configuration configuration1, Configuration configuration2)
          Test if two configuration objects are equal.
static void serializeToResult(javax.xml.transform.Result result, Configuration configuration)
          Serialize Configuration object to sepcified Result object.
static Configuration toConfiguration(org.w3c.dom.Element element)
          Convert specified Element into a configuration object.
static org.w3c.dom.Element toElement(Configuration configuration)
          Convert specified Configuration object into a Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH_SEPARATOR

public static final java.lang.String PATH_SEPARATOR
Constant defining separator for paths in document.

See Also:
Constant Field Values

ROOT_PATH

public static final java.lang.String ROOT_PATH
Constant defining root path of document.

See Also:
Constant Field Values
Constructor Detail

ConfigurationUtil

public ConfigurationUtil()
Method Detail

serializeToResult

public static void serializeToResult(javax.xml.transform.Result result,
                                     Configuration configuration)
                              throws java.lang.Exception
Serialize Configuration object to sepcified Result object. The developer can serialize to a system out by using javax.xml.transform.stream.StreamResult in code such as;
  ConfigurationUtil.
     serializeToResult( new StreamResult( System.out ),
                        configuration );
 

The developer can also output to SAX stream or DOM trees via SAXResult and javax.xml.transform.dom.DOMResult.

Parameters:
result - the result object to serialize configuration to
configuration - the configuration
Throws:
java.lang.Exception - if unable to serialize configuration

buildFromXML

public static Configuration buildFromXML(org.xml.sax.InputSource input)
                                  throws java.lang.Exception
Create a configuration object from specified XML InputSource.

Parameters:
input - the InputSource
Returns:
the configuration object
Throws:
java.lang.Exception - if unable to create configuration object from input

toConfiguration

public static Configuration toConfiguration(org.w3c.dom.Element element)
Convert specified Element into a configuration object.

Parameters:
element - the Element
Returns:
the Configuration object

toElement

public static org.w3c.dom.Element toElement(Configuration configuration)
Convert specified Configuration object into a Element.

Parameters:
configuration - the Configuration
Returns:
the Element object

equals

public static boolean equals(Configuration configuration1,
                             Configuration configuration2)
Test if two configuration objects are equal. To be equal the configuration objects must have equal child configuration objects in identical orders or identical content values and must have the same attributes with the same values.

Parameters:
configuration1 - a configuration object
configuration2 - a configuration object
Returns:
true if the configuration objects are equal


Copyright © 2003-2004 Codehaus. All Rights Reserved.