org.apache.empire.xml
Class XMLConfiguration

java.lang.Object
  extended by org.apache.empire.commons.ErrorObject
      extended by org.apache.empire.xml.XMLConfiguration
All Implemented Interfaces:
ErrorInfo

public class XMLConfiguration
extends ErrorObject

 This class manages the configuration of a Java Bean by an xml configuration file.
 It also supports configuration of Log4J.
 


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.empire.commons.ErrorObject
ErrorObject.ObjectErrorInfo
 
Constructor Summary
XMLConfiguration()
           
 
Method Summary
 org.w3c.dom.Element getRootNode()
          returns the configuration root element or null if init() has not been called.
 boolean init(java.lang.String filename, boolean fromResource)
          Initialize the configuration.
protected  boolean readConfiguration(java.lang.String fileName, boolean fromResource)
          Reads the configuration file and parses the XML Configuration.
 boolean readProperties(java.lang.Object bean, org.w3c.dom.Element propertiesNode)
          reads all properties from a given properties node and applies them to the given bean
 boolean readProperties(java.lang.Object bean, java.lang.String... propertiesNodeNames)
          reads all properties from a given properties node and applies them to the given bean
protected  void setPropertyValue(java.lang.Object bean, org.w3c.dom.Node item)
           
 
Methods inherited from class org.apache.empire.commons.ErrorObject
clearError, clearErrorInfo, error, error, error, error, error, getErrorInfo, getErrorMessage, getErrorParams, getErrorSource, getErrorType, getMessage, hasError, internalSetError, isExceptionsEnabled, setExceptionsEnabled, success
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLConfiguration

public XMLConfiguration()
Method Detail

init

public boolean init(java.lang.String filename,
                    boolean fromResource)
Initialize the configuration.

Parameters:
filename - the file
fromResource - will read from the classpath if true
Returns:
true on success

getRootNode

public org.w3c.dom.Element getRootNode()
returns the configuration root element or null if init() has not been called.

Returns:
the configuration root element

readConfiguration

protected boolean readConfiguration(java.lang.String fileName,
                                    boolean fromResource)
Reads the configuration file and parses the XML Configuration.


readProperties

public boolean readProperties(java.lang.Object bean,
                              java.lang.String... propertiesNodeNames)
reads all properties from a given properties node and applies them to the given bean

Parameters:
bean - the bean to which to apply the configuration
propertiesNodeName - the name of the properties node below the root element
Returns:
true of successful or false otherwise

readProperties

public boolean readProperties(java.lang.Object bean,
                              org.w3c.dom.Element propertiesNode)
reads all properties from a given properties node and applies them to the given bean

Parameters:
bean - the bean to which to apply the configuration
propertiesNode - the properties node
Returns:
true of successful or false otherwise

setPropertyValue

protected void setPropertyValue(java.lang.Object bean,
                                org.w3c.dom.Node item)


Copyright © 2008-2011 Apache Software Foundation. All Rights Reserved.