org.mortbay.xml

Class XmlConfiguration


public class XmlConfiguration
extends java.lang.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.
Version:
$Id: XmlConfiguration.java,v 1.28 2005/08/13 08:12:14 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Constructor Summary

XmlConfiguration(InputStream configuration)
Constructor.
XmlConfiguration(String configuration)
Constructor.
XmlConfiguration(URL configuration)
Constructor.

Method Summary

void
configure(Object obj)
Configure an object.
static void
main(String[] arg)
Object
newInstance()
Create a new object and configure it.

Constructor Details

XmlConfiguration

public XmlConfiguration(InputStream configuration)
            throws SAXException,
                   IOException
Constructor.
Parameters:
configuration - An input stream containing a complete e.g. configuration file

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 "

XmlConfiguration

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

Method Details

configure

public void configure(Object obj)
            throws ClassNotFoundException,
                   NoSuchMethodException,
                   InvocationTargetException,
                   InstantiationException,
                   IllegalAccessException
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.

main

public static void main(String[] arg)

newInstance

public Object newInstance()
            throws ClassNotFoundException,
                   NoSuchMethodException,
                   InvocationTargetException,
                   InstantiationException,
                   IllegalAccessException
Create a new object and configure it. A new object is created and configured.
Returns:
The newly created configured object.

Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.