jgroup.core
Class ConfigManager

java.lang.Object
  extended by jgroup.core.ConfigManager

public final class ConfigManager
extends java.lang.Object

The configuration manager class is used initialize the required Jgroup system configuration data, including logging configuration. It will read the logging configuration and the Jgroup system configuration, by parsing the XML files supplied to the JVM using the following system properties:

jgroup.system.config: XML-based configuration file for specifying the required system configurations for Jgroup/ARM.

jgroup.system.services: XML-based configuration file for specifying the services required for Jgroup/ARM.

jgroup.system.applications: XML-based configuration file for specifying the applications used in a Jgroup/ARM system.

jgroup.log.config: XML-based configuration file for log4j, allows the user to limit the amount of debug information being sent to the console; among numerous other configuration options available through the log4j toolkit. For details concerning the format of the configuration file, please refer to the log4j documentation. The default for this property: config/log4j.xml

In addition, the following logging related system properties may be specified by the user:

jgroup.registry.locator: The registry locator class to be used by Jgroup. The default is jgroup.relacs.registry.RelacsRegistryLocator

jgroup.log.app: The application name that will be appended to the log filename. Note that, when using the ARM framework (the ExecDaemon) to create replicas, the log.app name for the replica will be given the name of the class (exclusive the package name).

jgroup.log.dir: The directory into which log files will be written. If not specified, the default is used (./log)

jgroup.log.msgcontent: True/False. Used to turn on/off the logging of message content at both the mss and daemon level.

The following system properties are initialized at runtime, allowing the log4j toolkit to use these properties in its XML based log file for constructing unique files. Passing these properties to the Java runtime will have no effect as they will be overwritten.

jgroup.log.machine: The local host of this replica.

jgroup.log.time: The time when this replica was initialized.

jgroup.log.date: The date when this replica was initialized.

Since:
Jgroup 1.2
Author:
Hein Meling

Field Summary
static java.lang.String DEFAULT_REGISTRY_LOCATOR
           
static java.lang.String DEFAULT_REPLICATION_MANAGER
           
static boolean logMsgContent
          Indicates if message content should be logged.
 
Constructor Summary
ConfigManager()
           
 
Method Summary
static void configureLogging()
          Method to set up log directory, and initialize the Log4j configuration.
static int getBootstrapPort()
          Returns the port for the bootstrap registry.
static java.lang.Object getConfig(java.lang.Class cl)
          Retrieve an instance of the given configuration class, that is containing the configuration information.
static DistributedSystemConfig getDistributedSystem()
          Returns the DistributedSystemConfig object.
static void init()
          Invoked to initialize various system configuration variables required by Jgroup/ARM.
static void init(java.lang.String urlConfig)
          Helper method to parse a specified configuration file instead of the system configured default.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REGISTRY_LOCATOR

public static final java.lang.String DEFAULT_REGISTRY_LOCATOR
See Also:
Constant Field Values

DEFAULT_REPLICATION_MANAGER

public static final java.lang.String DEFAULT_REPLICATION_MANAGER
See Also:
Constant Field Values

logMsgContent

public static boolean logMsgContent
Indicates if message content should be logged. To change this use the system property: jgroup.log.msgcontent.

Constructor Detail

ConfigManager

public ConfigManager()
Method Detail

init

public static void init()
                 throws ConfigurationException
Invoked to initialize various system configuration variables required by Jgroup/ARM. This includes reading and parsing the logging configuration and the distributed system configuration. The method is idempotent (it can be invoked many times without changing its behavior), meaning that no configuration files will be read and parsed several times.

Throws:
ConfigurationException - Raised if there was an error parsing the configuration files, or the system properties required to specify the configuration file names were unset.

init

public static void init(java.lang.String urlConfig)
                 throws ConfigurationException
Helper method to parse a specified configuration file instead of the system configured default. This is useful for the Java based experiment framework.

Parameters:
urlConfig -
Throws:
ConfigurationException

configureLogging

public static void configureLogging()
                             throws ConfigurationException
Method to set up log directory, and initialize the Log4j configuration. This can be used externally when custom configuration is required, such as the experiment framework.

Throws:
ConfigurationException - Thrown if the specified log directory could not be created, or if the log4j configuration URL was malformed.

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 init method was not invoked prior to invoking this method.

getDistributedSystem

public static DistributedSystemConfig getDistributedSystem()
Returns the DistributedSystemConfig object.


getBootstrapPort

public static int getBootstrapPort()
Returns the port for the bootstrap registry.



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