biz.hammurapi.config
Class XmlSource
java.lang.Object
biz.hammurapi.config.XmlSource
- All Implemented Interfaces:
- Parameterizable
public class XmlSource
- extends java.lang.Object
- implements Parameterizable
Helper class to read XML configuration from file, url or classloader
resource.
- Version:
- $Revision: 1.2 $
- Author:
- Pavel Vlasov
Constructor Summary |
XmlSource(java.lang.String prefix,
java.lang.Class masterClass,
java.lang.String defaultResourceExtension)
Constructor |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlSource
public XmlSource(java.lang.String prefix,
java.lang.Class masterClass,
java.lang.String defaultResourceExtension)
- Constructor
- Parameters:
prefix
- Prefix for configuration parameters. Parameter specifying
configruration file would be <prefix>-file, url -
<prefix>-url, resource - <prefix>-resourcemasterClass
- Master class' classloader will be used to load resources and
default resource would be masterClass name with
defaultResourceExtension. If master class is null then this
class classloader will be used and no default resource will be
loaded.defaultResourceExtension
- Extension for default resource. If it is null then default
resource will not be loaded.
getConfigDocument
public org.w3c.dom.Document getConfigDocument()
throws ConfigurationException
- Returns:
- parsed XML or null if config not found.
- Throws:
ConfigurationException
getStream
public java.io.InputStream getStream()
throws ConfigurationException
- Returns:
- Stream
- Throws:
java.io.FileNotFoundException
java.io.IOException
java.net.MalformedURLException
ConfigurationException
setParameter
public boolean setParameter(java.lang.String name,
java.lang.Object value)
throws ConfigurationException
- Description copied from interface:
Parameterizable
- Sets parameter
- Specified by:
setParameter
in interface Parameterizable
- Returns:
- true if parameter was recognized and processed
- Throws:
ConfigurationException
Copyright © 2003 Hammurapi Group. All Rights Reserved.