net.larsan.urd.impl
Class FileParameters
java.lang.Object
|
+--net.larsan.urd.impl.ParameterDispatcher
|
+--net.larsan.urd.impl.FileParameters
- All Implemented Interfaces:
- Parameters
- public class FileParameters
- extends ParameterDispatcher
A parameter dispatcher working on for a configuration file. This dispatcher
caches the document between invocations but reloads on changes. It is also
localized to one container.
- Version:
- Alpha-0.1 / 2002-10-06 21:37
- Author:
- Lars J. Nilsson
|
Constructor Summary |
FileParameters(java.io.File configFile,
java.io.File containerRoot,
ErrorHandler handler)
Create parameters object. |
|
Method Summary |
protected org.w3c.dom.Document |
loadParameters()
Read the parameters file and load it into an XML document. |
protected java.net.URL |
resolveSource(java.lang.String source)
Resove a string into a URL. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileParameters
public FileParameters(java.io.File configFile,
java.io.File containerRoot,
ErrorHandler handler)
throws java.io.IOException
- Create parameters object. The file argument must exists.
- Parameters:
configFile - Configuration file, must existcontainerRoot - Container root foldern must existhandler - Error handler to report exceptions to
- Throws:
java.io.IOException - If the file does not exist
loadParameters
protected org.w3c.dom.Document loadParameters()
throws java.io.IOException,
XMLException
- Read the parameters file and load it into an XML document.
- Specified by:
loadParameters in class ParameterDispatcher
- Returns:
- The paramers document
- Throws:
java.io.IOException - on IO errors
XMLException - on malformed XML
resolveSource
protected java.net.URL resolveSource(java.lang.String source)
- Resove a string into a URL. Currently we accept only file and
and http URLs. For example, if the source is:
../lib/http.jar
and the container root is:
/usr/norna/serv/
then this method should return:
file://usr/norna/lib/http.jar
This method should return null if it cannot parse the source into
a valid URL object.
- Specified by:
resolveSource in class ParameterDispatcher
- Parameters:
source - Source string to resolve into a URL, or null if failed