org.apache.beehive.netui.util.config
Class ConfigUtil

Object
  extended by ConfigUtil

public class ConfigUtil
extends Object

Utility class for reading properties from the NetUI configuration file.

The webapp runtime is read from the InputStream passed to the init(InputStream) method. The configuration should be initialized with this method and a valid InputStream before the first time the getConfig() method is called. If the configuration has not been initialized, getConfig() will initialize a bare bones runtime configuration. Depending on the web application, this default configuration may lead to runtime errors.


Constructor Summary
protected ConfigUtil()
           
 
Method Summary
static NetuiConfigDocument.NetuiConfig getConfig()
          Get the NetUI configuration object.
static void init(InputStream is)
          

Initialize the NetUI configuration data.

protected static void internalInit(InputStream is)
          Internal method used to re-initialize the static class member that holds the ConfigDocument.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigUtil

protected ConfigUtil()
Method Detail

init

public static final void init(InputStream is)
                       throws ConfigInitializationException

Initialize the NetUI configuration data.

This method can be called exactly once in a J2EE web application. The InputStream parameter should reference a netui-config.xml file. If an error occurs loading the configuration file, a ConfigInitializationException will be thrown.

Parameters:
is - the InputStream from which to read the configuration file
Throws:
ConfigInitializationException - thrown when an error occurs loading the configuration file or when the configuration is reinitialized.

internalInit

protected static final void internalInit(InputStream is)
                                  throws ConfigInitializationException
Internal method used to re-initialize the static class member that holds the ConfigDocument. Note, this method does no checks to ensure that an existing document is being overwritten. The behavior of ConfigUtil clients is undefined if their initial configuration is re-loaded.

Parameters:
is - The InputStream that contains the config document to load
Throws:
ConfigInitializationException - thrown when an error occurs loading the configuration file.

getConfig

public static NetuiConfigDocument.NetuiConfig getConfig()
Get the NetUI configuration object.

Returns:
a configuration bean that contains data parsed from the netui-config.xml file.