org.openbp.jaspira.plugin
Class ConfigMgr

java.lang.Object
  extended by org.openbp.jaspira.plugin.ConfigMgr

public final class ConfigMgr
extends java.lang.Object

The configuration manager stores a number of configuration values that can be used to customize the application and its plugins. This class is a singleton.

Author:
Heiko Erhardt

Field Summary
static java.lang.String STD_CONFIG_FILE
          Standard Config.properties file in $rootdir/$appname
 
Method Summary
 boolean evaluate(java.lang.String cond)
          Evaluates a configuration expression.
 java.lang.String getConfigResourceName()
          Gets the config property resource name.
static ConfigMgr getInstance()
          Gets the singleton instance of this class.
 java.lang.String getValue(java.lang.String key)
          Gets the configuration value for the given key.
 void initialize()
          Initializes the configuration manager.
 boolean isDefined(java.lang.String key)
          checks if the given key defined.
 void readPropertyResource(java.lang.String propertyResourceName, boolean mandatory)
          Reads the specified property file.
 void setConfigResourceName(java.lang.String configResourceName)
          Sets the config property resource name.
 void setValue(java.lang.String key, java.lang.String value)
          Sets a configuration value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STD_CONFIG_FILE

public static final java.lang.String STD_CONFIG_FILE
Standard Config.properties file in $rootdir/$appname

See Also:
Constant Field Values
Method Detail

getInstance

public static ConfigMgr getInstance()
Gets the singleton instance of this class.


getConfigResourceName

public java.lang.String getConfigResourceName()
Gets the config property resource name.


setConfigResourceName

public void setConfigResourceName(java.lang.String configResourceName)
Sets the config property resource name.


initialize

public void initialize()
Initializes the configuration manager. Reads configuration values from the config.properties file in the application's root directory.


readPropertyResource

public void readPropertyResource(java.lang.String propertyResourceName,
                                 boolean mandatory)
Reads the specified property file.

Parameters:
propertyResourceName - Full path name of the property file

evaluate

public boolean evaluate(java.lang.String cond)
Evaluates a configuration expression.

Parameters:
cond - The condition expression may contain:
IDENT Configuration value
|| OR operator
&aamp;&aamp; AND operator
! NOT operator If the expression is null, the method evaluates to true.

isDefined

public boolean isDefined(java.lang.String key)
checks if the given key defined.


getValue

public java.lang.String getValue(java.lang.String key)
Gets the configuration value for the given key.

Returns:
The value or null

setValue

public void setValue(java.lang.String key,
                     java.lang.String value)
Sets a configuration value.



Copyright © 2011. All Rights Reserved.