com.sleepycat.je.dbi
Class DbConfigManager

java.lang.Object
  extended by com.sleepycat.je.dbi.DbConfigManager

public class DbConfigManager
extends java.lang.Object

DbConfigManager holds the configuration parameters for an environment. In general, all configuration parameters are represented by a ConfigParam defined in com.sleepycat.je.config.EnvironmentParams and can be represented by a property described in the top level example.properties. Environment parameters have some interesting twists because there are some attributes that are scoped by handle, such as the commit durability (txnSync, txnNoSync, etc) parameters. DbConfigManager is instantiated first by the EnvironmentImpl, and is loaded with the base configuration parameters. If replication is enabled, additional properties are added when the Replicator is instantiated. In order to keep replication code out of the base code, replication parameters are loaded by way of the addConfigurations method.


Constructor Summary
DbConfigManager(EnvironmentConfig config)
           
 
Method Summary
 void addConfigurations(java.util.Properties additionalProps)
          Add all configuration properties in the specified property bag to this environment's configuration.
static void applyFileConfig(java.io.File envHome, java.util.Properties props, boolean forReplication, java.lang.String errorClassName)
          Apply the configurations specified in the je.properties file to override the programatically set configuration values held in the property bag.
 java.lang.String get(ConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
 java.lang.String get(java.lang.String configParamName)
          Get this parameter from the environment wide configuration settings.
 boolean getBoolean(BooleanConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
static java.lang.String getConfigParam(java.util.Properties props, java.lang.String paramName)
          Helper method for environment and replicator configuration classes.
 EnvironmentConfig getEnvironmentConfig()
           
 int getInt(IntConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
 long getLong(LongConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
static java.lang.String getVal(java.util.Properties props, ConfigParam param)
          Helper method for environment and replicator configuration classes.
static void setConfigParam(java.util.Properties props, java.lang.String paramName, java.lang.String value, boolean requireMutability, boolean validateValue, boolean forReplication)
          Helper method for environment and replicator configuration classes.
static void setVal(java.util.Properties props, ConfigParam param, java.lang.String val, boolean validateValue)
          Helper method for environment and replicator configuration classes.
static void validateProperties(java.util.Properties props, boolean forReplication, java.lang.String configClassName)
          Validate a collection of configurations at Environment and Replicator startup time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbConfigManager

public DbConfigManager(EnvironmentConfig config)
                throws DbConfigException
Throws:
DbConfigException
Method Detail

addConfigurations

public void addConfigurations(java.util.Properties additionalProps)
Add all configuration properties in the specified property bag to this environment's configuration. Used to add replication specific configurations from ReplicatorConfig without referring to replication classes.


getEnvironmentConfig

public EnvironmentConfig getEnvironmentConfig()

get

public java.lang.String get(ConfigParam configParam)
                     throws java.lang.IllegalArgumentException
Get this parameter from the environment wide configuration settings.

Parameters:
configParam -
Returns:
default for param if param wasn't explicitly set
Throws:
java.lang.IllegalArgumentException

get

public java.lang.String get(java.lang.String configParamName)
                     throws java.lang.IllegalArgumentException
Get this parameter from the environment wide configuration settings.

Parameters:
configParam -
Returns:
default for param if param wasn't explicitly set
Throws:
java.lang.IllegalArgumentException

getBoolean

public boolean getBoolean(BooleanConfigParam configParam)
                   throws DatabaseException
Get this parameter from the environment wide configuration settings.

Parameters:
configParam -
Returns:
default for param if it wasn't explicitly set.
Throws:
DatabaseException

getInt

public int getInt(IntConfigParam configParam)
           throws DatabaseException
Get this parameter from the environment wide configuration settings.

Parameters:
configParam -
Returns:
default for param if it wasn't explicitly set.
Throws:
DatabaseException

getLong

public long getLong(LongConfigParam configParam)
             throws DatabaseException
Get this parameter from the environment wide configuration settings.

Parameters:
configParam -
Returns:
default for param if it wasn't explicitly set
Throws:
DatabaseException

validateProperties

public static void validateProperties(java.util.Properties props,
                                      boolean forReplication,
                                      java.lang.String configClassName)
                               throws java.lang.IllegalArgumentException
Validate a collection of configurations at Environment and Replicator startup time. Check for valid configuration names and values.

Throws:
java.lang.IllegalArgumentException

applyFileConfig

public static void applyFileConfig(java.io.File envHome,
                                   java.util.Properties props,
                                   boolean forReplication,
                                   java.lang.String errorClassName)
                            throws java.lang.IllegalArgumentException
Apply the configurations specified in the je.properties file to override the programatically set configuration values held in the property bag.

Throws:
java.lang.IllegalArgumentException

setConfigParam

public static void setConfigParam(java.util.Properties props,
                                  java.lang.String paramName,
                                  java.lang.String value,
                                  boolean requireMutability,
                                  boolean validateValue,
                                  boolean forReplication)
                           throws java.lang.IllegalArgumentException
Helper method for environment and replicator configuration classes. Set a configuration parameter. Check that the name is valid. If specified, also check that the value is valid.Value checking may be disabled for unit testing.

Parameters:
props - Property bag held within the configuration object.
Throws:
java.lang.IllegalArgumentException

getConfigParam

public static java.lang.String getConfigParam(java.util.Properties props,
                                              java.lang.String paramName)
                                       throws java.lang.IllegalArgumentException
Helper method for environment and replicator configuration classes. Get the configuration value for the specified parameter, checking that the parameter name is valid.

Parameters:
props - Property bag held within the configuration object.
Throws:
java.lang.IllegalArgumentException

getVal

public static java.lang.String getVal(java.util.Properties props,
                                      ConfigParam param)
Helper method for environment and replicator configuration classes. Gets either the value stored in this configuration or the default value for this param.


setVal

public static void setVal(java.util.Properties props,
                          ConfigParam param,
                          java.lang.String val,
                          boolean validateValue)
                   throws java.lang.IllegalArgumentException
Helper method for environment and replicator configuration classes. Set and validate the value for the specified parameter.

Throws:
java.lang.IllegalArgumentException


Copyright 2004,2008 Oracle. All rights reserved.