net.larsan.urd.impl
Class ParameterDispatcher

java.lang.Object
  |
  +--net.larsan.urd.impl.ParameterDispatcher
All Implemented Interfaces:
Parameters
Direct Known Subclasses:
FileParameters

public abstract class ParameterDispatcher
extends java.lang.Object
implements Parameters

The parameter dispatcher handles service parameters as read from a Urd XML config file.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson

Constructor Summary
ParameterDispatcher(ErrorHandler handler)
          Create a parameter dispatcher.
 
Method Summary
 InitParameters getParameters(java.net.URL codebase)
          Get init parameters for a service at a URL.
 boolean isAutoStart(java.net.URL codebase)
          Check is a service from a codebase is marked as an auto-start service.
protected abstract  org.w3c.dom.Document loadParameters()
          Read the parameters file and load it into an XML document.
protected abstract  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
 

Constructor Detail

ParameterDispatcher

public ParameterDispatcher(ErrorHandler handler)
Create a parameter dispatcher.

Parameters:
handler - Error handler to report exceptions to
Method Detail

getParameters

public InitParameters getParameters(java.net.URL codebase)
Get init parameters for a service at a URL. Return an empty InitParameters object if no parameters are found.

Specified by:
getParameters in interface Parameters
Parameters:
codebase - Service to find parameters for
Returns:
Init parameters for the service, never null

isAutoStart

public boolean isAutoStart(java.net.URL codebase)
                    throws NotConfiguredException
Check is a service from a codebase is marked as an auto-start service.

Specified by:
isAutoStart in interface Parameters
Parameters:
codebase - Service to check
Returns:
true If the service should be auto-started
Throws:
NotConfiguredException

loadParameters

protected abstract org.w3c.dom.Document loadParameters()
                                                throws java.io.IOException,
                                                       XMLException
Read the parameters file and load it into an XML document.

Returns:
The paramers document
Throws:
java.io.IOException - on IO errors
XMLException - on malformed XML

resolveSource

protected abstract 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 source of the parameters is:
   /usr/norna/conf/
 
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.

Parameters:
source - Source string to resolve into a URL