jgroup.relacs.config
Class ConfigParser

java.lang.Object
  extended by jgroup.relacs.config.ConfigParser

public final class ConfigParser
extends java.lang.Object

Parser code to read an XML configuration file, using the supplied URL.

Since:
Jgroup 1.2
Author:
Hein Meling

Constructor Summary
ConfigParser()
           
 
Method Summary
static boolean getBooleanAttrib(org.w3c.dom.Element elm, java.lang.String attrib, boolean required)
           
static java.lang.Object getConfig(java.lang.Class cl)
          Retrieve an instance of the given configuration class, that is containing the configuration information.
static void parse(java.lang.String urlConfig)
          The same as parse(urlConfig, false).
static void parse(java.lang.String urlConfig, boolean parseAgain)
          Parses the file obtained from the specified URL and inserts in an internal map, associations from class literals of configuration objects to configuration object instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigParser

public ConfigParser()
Method Detail

parse

public static void parse(java.lang.String urlConfig)
                  throws ConfigurationException
The same as parse(urlConfig, false).

Throws:
ConfigurationException

parse

public static void parse(java.lang.String urlConfig,
                         boolean parseAgain)
                  throws ConfigurationException
Parses the file obtained from the specified URL and inserts in an internal map, associations from class literals of configuration objects to configuration object instances.

Parameters:
urlConfig - the URL to the XML configuration file containing the description of the distributed system.
parseAgain - If false, all config-files will be parsed only once.
Throws:
ConfigurationException

getConfig

public static java.lang.Object getConfig(java.lang.Class cl)
Retrieve an instance of the given configuration class, that is containing the configuration information. For example, the configuration data object associated with the XML tag Transport, can be retreived using the class literal TransportConfig.class.

Parameters:
cl - The class literal of the configuration object to retreive.
Returns:
An instance of the configuration object retreived.
Throws:
java.lang.NullPointerException - If there is no such configuration object in the internal configuration map. This may occur for two reasons; (i) there is no such configuration tag specified in the configuration file, or (ii) the specified class literal is a non-existant class.
java.lang.IllegalStateException - If the parser was not invoked prior to invoking this method.

getBooleanAttrib

public static boolean getBooleanAttrib(org.w3c.dom.Element elm,
                                       java.lang.String attrib,
                                       boolean required)
                                throws ConfigurationException
Throws:
ConfigurationException


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.