org.mortbay.xml
Class XmlConfiguration

java.lang.Object
  extended byorg.mortbay.xml.XmlConfiguration

public class XmlConfiguration
extends Object

Configure Objects from XML. This class reads an XML file conforming to the configure.dtd DTD and uses it to configure and object by calling set, put or other methods on the object.

Author:
Greg Wilkins (gregw)

Constructor Summary
XmlConfiguration(InputStream configuration)
          Constructor.
XmlConfiguration(String configuration)
          Constructor.
XmlConfiguration(URL configuration)
          Constructor.
 
Method Summary
 Object configure()
          Configure an object.
 void configure(Object obj)
          Configure an object.
 Map getIdMap()
           
static void main(String[] args)
           
 void setIdMap(Map map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlConfiguration

public XmlConfiguration(URL configuration)
                 throws SAXException,
                        IOException
Constructor. Reads the XML configuration file.

Parameters:
configuration -

XmlConfiguration

public XmlConfiguration(String configuration)
                 throws SAXException,
                        IOException
Constructor.

Parameters:
configuration - String of XML configuration commands excluding the normal XML preamble. The String should start with a " Throws:
SAXException
IOException

XmlConfiguration

public XmlConfiguration(InputStream configuration)
                 throws SAXException,
                        IOException
Constructor.

Parameters:
configuration - An input stream containing a complete e.g. configuration file
Throws:
SAXException
IOException
Method Detail

getIdMap

public Map getIdMap()

setIdMap

public void setIdMap(Map map)

configure

public void configure(Object obj)
               throws Exception
Configure an object. If the object is of the approprate class, the XML configuration script is applied to the object.

Parameters:
obj - The object to be configured.
Throws:
Exception

configure

public Object configure()
                 throws Exception
Configure an object. If the configuration has an ID, an object is looked up by ID and it's type check. Otherwise a new object is created.

Returns:
The newly created configured object.
Throws:
Exception

main

public static void main(String[] args)