com.sleepycat.je.dbi
Class DbConfigManager

java.lang.Object
  extended by com.sleepycat.je.dbi.DbConfigManager
Direct Known Subclasses:
RepConfigManager

public class DbConfigManager
extends 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 by the EnvironmentConfig String constants. 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 ReplicatedEnvironment is instantiated. In order to keep replication code out of the base code, replication parameters are loaded by way of the addConfigurations method.


Field Summary
protected  Properties props
           
 
Constructor Summary
DbConfigManager(EnvironmentConfig config)
           
 
Method Summary
static void applyFileConfig(File envHome, Properties props, boolean forReplication)
          Apply the configurations specified in the je.properties file to override the programmatically set configuration values held in the property bag.
 String get(ConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
 String get(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 boolean getBooleanVal(Properties props, BooleanConfigParam param)
          Helper method for getting boolean values.
static String getConfigParam(Properties props, String paramName)
          Helper method for environment and replication configuration classes.
 int getDuration(DurationConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
static long getDurationVal(Properties props, DurationConfigParam param, TimeUnit unit)
          Helper method for getting duration values.
 EnvironmentConfig getEnvironmentConfig()
           
 int getInt(IntConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
static int getIntVal(Properties props, IntConfigParam param)
          Helper method for getting integer values.
 long getLong(LongConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
 short getShort(ShortConfigParam configParam)
          Get this parameter from the environment wide configuration settings.
static String getVal(Properties props, ConfigParam param)
          Helper method for environment and replication configuration classes.
static String getVal(Properties props, ConfigParam param, String paramName)
          Helper method for environment and replication configuration classes.
static void setBooleanVal(Properties props, BooleanConfigParam param, boolean val, boolean validateValue)
          Helper method for setting boolean values.
static void setConfigParam(Properties props, String paramName, String value, boolean requireMutability, boolean validateValue, boolean forReplication, boolean verifyForReplication)
          Helper method for environment and replication configuration classes.
static void setDurationVal(Properties props, DurationConfigParam param, long val, TimeUnit unit, boolean validateValue)
          Helper method for setting duration values.
static void setIntVal(Properties props, IntConfigParam param, int val, boolean validateValue)
          Helper method for setting integer values.
static void setVal(Properties props, ConfigParam param, String val, boolean validateValue)
          Helper method for environment and replication configuration classes.
static void setVal(Properties props, ConfigParam param, String paramName, String val, boolean validateValue)
          Helper method for environment and replication configuration classes.
static void validateProperties(Properties props, boolean isRepConfigInstance, String configClassName)
          Validate a collection of configurations, checking that - the name and value are valid - a replication param is not being set through an EnvironmentConfig class, and a non-rep param is not set through a ReplicationConfig instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

props

protected Properties props
Constructor Detail

DbConfigManager

public DbConfigManager(EnvironmentConfig config)
Method Detail

getEnvironmentConfig

public EnvironmentConfig getEnvironmentConfig()

get

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

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

get

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

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

getBoolean

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

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

getShort

public short getShort(ShortConfigParam configParam)
Get this parameter from the environment wide configuration settings.

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

getInt

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

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

getLong

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

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

getDuration

public int getDuration(DurationConfigParam configParam)
Get this parameter from the environment wide configuration settings.

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

validateProperties

public static void validateProperties(Properties props,
                                      boolean isRepConfigInstance,
                                      String configClassName)
                               throws IllegalArgumentException
Validate a collection of configurations, checking that - the name and value are valid - a replication param is not being set through an EnvironmentConfig class, and a non-rep param is not set through a ReplicationConfig instance. This may happen at Environment start time, or when configurations have been mutated. The configurations have been collected from a file, or from a Properties object, and haven't gone through the usual validation path that occurs when XXXConfig.setConfigParam is called. SuppressWarnings is used here because Enumeration doesn't work well with Properties in Java 1.5

Throws:
IllegalArgumentException - via XxxConfig(Properties) ctor.

applyFileConfig

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

Throws:
IllegalArgumentException - via XxxConfig(Properties) ctor.

setConfigParam

public static void setConfigParam(Properties props,
                                  String paramName,
                                  String value,
                                  boolean requireMutability,
                                  boolean validateValue,
                                  boolean forReplication,
                                  boolean verifyForReplication)
                           throws IllegalArgumentException
Helper method for environment and replication 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:
IllegalArgumentException - via XxxConfig.setXxx methods and XxxConfig(Properties) ctor.

getConfigParam

public static String getConfigParam(Properties props,
                                    String paramName)
                             throws IllegalArgumentException
Helper method for environment and replication 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:
IllegalArgumentException - via XxxConfig.getConfigParam.

getVal

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


getVal

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


setVal

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

Throws:
IllegalArgumentException

setVal

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

Throws:
IllegalArgumentException

getIntVal

public static int getIntVal(Properties props,
                            IntConfigParam param)
Helper method for getting integer values.


setIntVal

public static void setIntVal(Properties props,
                             IntConfigParam param,
                             int val,
                             boolean validateValue)
Helper method for setting integer values.


getBooleanVal

public static boolean getBooleanVal(Properties props,
                                    BooleanConfigParam param)
Helper method for getting boolean values.


setBooleanVal

public static void setBooleanVal(Properties props,
                                 BooleanConfigParam param,
                                 boolean val,
                                 boolean validateValue)
Helper method for setting boolean values.


getDurationVal

public static long getDurationVal(Properties props,
                                  DurationConfigParam param,
                                  TimeUnit unit)
Helper method for getting duration values.


setDurationVal

public static void setDurationVal(Properties props,
                                  DurationConfigParam param,
                                  long val,
                                  TimeUnit unit,
                                  boolean validateValue)
Helper method for setting duration values.



Copyright (c) 2004-2012 Oracle. All rights reserved.