org.apache.empire.xml
Class XMLConfiguration

java.lang.Object
  extended by org.apache.empire.xml.XMLConfiguration

public class XMLConfiguration
extends Object

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


Constructor Summary
XMLConfiguration()
           
 
Method Summary
 Element getRootNode()
          returns the configuration root element or null if init() has not been called.
 void init(String filename, boolean fromResource)
          Initialize the configuration.
protected  void readConfiguration(String fileName, boolean fromResource)
          Reads the configuration file and parses the XML Configuration.
 void readProperties(Object bean, Element propertiesNode)
          reads all properties from a given properties node and applies them to the given bean
 void readProperties(Object bean, String... propertiesNodeNames)
          reads all properties from a given properties node and applies them to the given bean
protected  void setPropertyValue(Object bean, Node item)
           
 
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 void init(String filename,
                 boolean fromResource)
Initialize the configuration.

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

getRootNode

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

Returns:
the configuration root element

readConfiguration

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


readProperties

public void readProperties(Object bean,
                           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
propertiesNodeNames - the name of the properties node below the root element

readProperties

public void readProperties(Object bean,
                           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

setPropertyValue

protected void setPropertyValue(Object bean,
                                Node item)


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