org.opends.server.types
Class DirectoryEnvironmentConfig

java.lang.Object
  extended by org.opends.server.types.DirectoryEnvironmentConfig

@PublicAPI(stability=VOLATILE,
           mayInstantiate=true,
           mayExtend=false,
           mayInvoke=true)
public final class DirectoryEnvironmentConfig
extends java.lang.Object

This class provides a set of properties that may control various aspects of the server environment. Note that these properties may only be altered before the Directory Server is started. Any attempt to change an environment configuration property while the server is running will be rejected.


Constructor Summary
DirectoryEnvironmentConfig()
          Creates a new directory environment configuration initialized from the system properties defined in the JVM.
DirectoryEnvironmentConfig(java.util.Map<java.lang.String,java.lang.String> properties)
          Creates a new directory environment configuration initialized with a copy of the provided set of properties.
DirectoryEnvironmentConfig(java.util.Properties properties)
          Creates a new directory environment configuration initialized with a copy of the provided set of properties.
 
Method Summary
 boolean disableConnectionHandlers()
          Indicates whether the Directory Server startup process should skip the connection handler creation and initialization phases.
 boolean disableExec()
          Indicates whether the Directory Server should be allowed to use the Runtime.exec() method to be able to launch external commands on the underlying system.
 boolean forceDaemonThreads()
          Indicates whether all threads created by the Directory Server should be created as daemon threads.
 java.lang.Class getConfigClass()
          Retrieves the class that provides the Directory Server configuration handler implementation.
 java.io.File getConfigFile()
          Retrieves the configuration file that should be used to initialize the Directory Server config handler.
 java.io.File getLockDirectory()
          Retrieves the directory that should be used to hold the server lock files.
 int getLockManagerConcurrencyLevel()
          Retrieves the concurrency level for the Directory Server lock table.
 boolean getLockManagerFairOrdering()
          Retrieves whether a fair ordering should be used for the lock manager.
 int getLockManagerTableSize()
          Retrieves the initial table size for the server lock table.
 int getMaxConfigArchiveSize()
          Retrieves the maximum number of archived configurations that the Directory Server should maintain.
 java.lang.String getProperty(java.lang.String name)
          Retrieves the property with the specified name.
 java.io.File getSchemaDirectory()
          Retrieves the directory that contains the server schema configuration files.
 java.io.File getServerRoot()
          Retrieves the directory that should be considered the server root.
 boolean maintainConfigArchive()
          Indicates whether the Directory Server should maintain an archive of previous configurations.
 java.lang.Class setConfigClass(java.lang.Class configClass)
          Specifies the class that provides the Directory Server configuration handler implementation.
 java.io.File setConfigFile(java.io.File configFile)
          Specifies the configuration file that should be used to initialize the Directory Server config handler.
 boolean setDisableConnectionHandlers(boolean disableConnectionHandlers)
          Specifies whether the Directory Server startup process should skip the connection handler creation and initialization phases.
 boolean setDisableExec(boolean disableExec)
          Specifies whether the Directory Server should be allowed to use the Runtime.exec() method to be able to launch external commands on the underlying system.
 boolean setForceDaemonThreads(boolean forceDaemonThreads)
          Specifies whether all threads created by the Directory Server should be created as daemon threads.
 java.io.File setLockDirectory(java.io.File lockDirectory)
          Specifies the directory that should be used to hold the server lock files.
 int setLockManagerConcurrencyLevel(int concurrencyLevel)
          Specifies the concurrency level for the Directory Server lock table.
 boolean setLockManagerFairOrdering(boolean fairOrdering)
          Specifies whether a fair ordering should be used for the lock manager.
 int setLockManagerTableSize(int lockTableSize)
          Specifies the initial table size for the server lock table.
 boolean setMaintainConfigArchive(boolean maintainConfigArchive)
          Specifies whether the Directory Server should maintain an archive of previous configurations.
 int setMaxConfigArchiveSize(int maxConfigArchiveSize)
          Specifies the maximum number of archived configurations that the Directory Server should maintain.
 java.lang.String setProperty(java.lang.String name, java.lang.String value)
          Specifies a property with the given name and value.
 java.io.File setSchemaDirectory(java.io.File schemaDirectory)
          Specifies the directory that should contain the server schema configuration files.
 java.io.File setServerRoot(java.io.File serverRoot)
          Specifies the directory that should be considered the server root.
 boolean setUseLastKnownGoodConfiguration(boolean useLastKnownGoodConfiguration)
          Specifies whether the Directory Server should attempt to start using the last known good configuration rather than the current active configuration.
 boolean useLastKnownGoodConfiguration()
          Indicates whether the Directory Server should attempt to start with the "last known good" configuration rather than the current active configuration file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryEnvironmentConfig

public DirectoryEnvironmentConfig()
Creates a new directory environment configuration initialized from the system properties defined in the JVM.


DirectoryEnvironmentConfig

public DirectoryEnvironmentConfig(java.util.Properties properties)
Creates a new directory environment configuration initialized with a copy of the provided set of properties.

Parameters:
properties - The properties to use when initializing this environment configuration, or null to use an empty set of properties.

DirectoryEnvironmentConfig

public DirectoryEnvironmentConfig(java.util.Map<java.lang.String,java.lang.String> properties)
Creates a new directory environment configuration initialized with a copy of the provided set of properties.

Parameters:
properties - The properties to use when initializing this environment configuration, or null to use an empty set of properties.
Method Detail

getProperty

public java.lang.String getProperty(java.lang.String name)
Retrieves the property with the specified name. The check will first be made in the local config properties, but if no value is found then the JVM system properties will be checked.

Parameters:
name - The name of the property to retrieve.
Returns:
The property with the specified name, or null if no such property is defined.

setProperty

public java.lang.String setProperty(java.lang.String name,
                                    java.lang.String value)
                             throws InitializationException
Specifies a property with the given name and value. If a property is already defined with the given name, then its value will be replaced with the provided value, or the property will be removed if the given value is null.

Parameters:
name - The name of the property to set.
value - The value of the property to set, or null if the property is to be removed.
Returns:
The previous value held for the property, or null if it was not previously set.
Throws:
InitializationException - If the Directory Server is already running.

getServerRoot

public java.io.File getServerRoot()
Retrieves the directory that should be considered the server root. The determination will first be based on the properties defined in this config object. If no value is found there, then the JVM system properties will be checked, followed by an environment variable.

Returns:
The directory that should be considered the server root, or null if it is not defined.

setServerRoot

public java.io.File setServerRoot(java.io.File serverRoot)
                           throws InitializationException
Specifies the directory that should be considered the server root. Any relative path used in the server should be considered relative to the server root.

Parameters:
serverRoot - The directory that should be considered the server root.
Returns:
The previous server root, or null if there was none.
Throws:
InitializationException - If the Directory Server is already running or there is a problem with the provided server root.

getConfigFile

public java.io.File getConfigFile()
Retrieves the configuration file that should be used to initialize the Directory Server config handler. If no default configuration file is specified, then the server will attempt to use "config/config.ldif" below the server root if it exists.

Returns:
The configuration file that should be used to initialize the Directory Server config handler, or null if no configuration file is defined.

setConfigFile

public java.io.File setConfigFile(java.io.File configFile)
                           throws InitializationException
Specifies the configuration file that should be used to initialize the Directory Server config handler.

Parameters:
configFile - The configuration file that should be used to initialize the Directory Server config handler.
Returns:
The previously-defined configuration file, or null if none was defined.
Throws:
InitializationException - If the Directory Server is already running or there is a problem with the provided configuration file.

getConfigClass

public java.lang.Class getConfigClass()
Retrieves the class that provides the Directory Server configuration handler implementation. If no config handler class is defined, or if a problem occurs while attempting to determine the config handler class, then a default class of org.opends.server.extensions.ConfigFileHandler will be returned.

Returns:
The class that provides the Directory Server configuration handler implementation.

setConfigClass

public java.lang.Class setConfigClass(java.lang.Class configClass)
                               throws InitializationException
Specifies the class that provides the Directory Server configuration handler implementation. The class must be a subclass of the org.opends.server.api.ConfigHandler superclass.

Parameters:
configClass - The class that proviedes the Directory Server configuration handler implementation.
Returns:
The class that was previously configured to provide the Directory Server configuration handler implementation, or null if none was defined.
Throws:
InitializationException - If the Directory Server is already running or there is a problem with the provided config handler class.

useLastKnownGoodConfiguration

public boolean useLastKnownGoodConfiguration()
Indicates whether the Directory Server should attempt to start with the "last known good" configuration rather than the current active configuration file. Note that if there is no "last known good" configuration file available, then the server should try to start using the current, active configuration file. If no explicit value is defined, then a default result of false will be returned.

Returns:
true if the Directory Server should attempt to start using the "last known good" configuration, or false if it should try to start using the active configuration.

setUseLastKnownGoodConfiguration

public boolean setUseLastKnownGoodConfiguration(boolean useLastKnownGoodConfiguration)
                                         throws InitializationException
Specifies whether the Directory Server should attempt to start using the last known good configuration rather than the current active configuration.

Parameters:
useLastKnownGoodConfiguration - Indicates whether the Directory Server should attempt to start using the last known good configuration.
Returns:
The previous setting for this configuration option. If no previous value was specified, then false will be returned.
Throws:
InitializationException - If the Directory Server is already running.

maintainConfigArchive

public boolean maintainConfigArchive()
Indicates whether the Directory Server should maintain an archive of previous configurations. If no explicit value is defined, then a default result of true will be returned.

Returns:
true if the Directory Server should maintain an archive of previous configurations, or false if not.

setMaintainConfigArchive

public boolean setMaintainConfigArchive(boolean maintainConfigArchive)
                                 throws InitializationException
Specifies whether the Directory Server should maintain an archive of previous configurations.

Parameters:
maintainConfigArchive - Indicates whether the Directory Server should maintain an archive of previous configurations.
Returns:
The previous setting for this configuration option. If no previous value was specified, then true will be returned.
Throws:
InitializationException - If the Directory Server is already running.

getMaxConfigArchiveSize

public int getMaxConfigArchiveSize()
Retrieves the maximum number of archived configurations that the Directory Server should maintain. If no value is defined, then a value of zero will be returned.

Returns:
The maximum number of archived configurations that the Directory Server should maintain, or zero if there should not be any limit.

setMaxConfigArchiveSize

public int setMaxConfigArchiveSize(int maxConfigArchiveSize)
                            throws InitializationException
Specifies the maximum number of archived configurations that the Directory Server should maintain. A value that is less than or equal to zero may be used to indicate that there should not be any limit to the number of archived configurations.

Parameters:
maxConfigArchiveSize - The maximum number of archived configurations that the Directory Server should maintain.
Returns:
The previous setting for this configuration option. If no previous value was specified, then zero will be returned.
Throws:
InitializationException - If the Directory Server is already running.

getSchemaDirectory

public java.io.File getSchemaDirectory()
Retrieves the directory that contains the server schema configuration files. If no value is defined, but a default directory of "config/schema" exists below the server root, then that will be returned.

Returns:
The directory that contains the server schema configuration files, or null if none is defined.

setSchemaDirectory

public java.io.File setSchemaDirectory(java.io.File schemaDirectory)
                                throws InitializationException
Specifies the directory that should contain the server schema configuration files. It must exist and must be a directory.

Parameters:
schemaDirectory - The directory that should contain the server schema configuration files.
Returns:
The previously-defined schema configuration directory, or null if none was defined.
Throws:
InitializationException - If the Directory Server is already running or there is a problem with the provided schema directory.

getLockDirectory

public java.io.File getLockDirectory()
Retrieves the directory that should be used to hold the server lock files. If no value is defined, then the server will attempt to use a default directory of "locks" below the server root.

Returns:
The directory that should be used to hold the server lock files, or null if it cannot be determined.

setLockDirectory

public java.io.File setLockDirectory(java.io.File lockDirectory)
                              throws InitializationException
Specifies the directory that should be used to hold the server lock files. If the specified path already exists, then it must be a directory and its contents must be writable by the server. If it does not exist, then its parent directory must exist and the server should have permission to create a new subdirectory in it.

Parameters:
lockDirectory - The directory that should be used to hold the server lock files.
Returns:
The previously-defined lock directory, or null if none was defined.
Throws:
InitializationException - If the Directory Server is already running or there is a problem with the provided lock directory.

disableConnectionHandlers

public boolean disableConnectionHandlers()
Indicates whether the Directory Server startup process should skip the connection handler creation and initialization phases.

Returns:
true if the Directory Server should not start its connection handlers, or false if the connection handlers should be enabled.

setDisableConnectionHandlers

public boolean setDisableConnectionHandlers(boolean disableConnectionHandlers)
                                     throws InitializationException
Specifies whether the Directory Server startup process should skip the connection handler creation and initialization phases.

Parameters:
disableConnectionHandlers - Indicates whether the Directory Server should skip the connection handler creation and initialization phases.
Returns:
The previous setting for this configuration option. If no previous value was specified, then false will be returned.
Throws:
InitializationException - If the Directory Server is already running.

forceDaemonThreads

public boolean forceDaemonThreads()
Indicates whether all threads created by the Directory Server should be created as daemon threads.

Returns:
true if all threads created by the Directory Server should be created as daemon threads, or false if not.

setForceDaemonThreads

public boolean setForceDaemonThreads(boolean forceDaemonThreads)
                              throws InitializationException
Specifies whether all threads created by the Directory Server should be created as daemon threads.

Parameters:
forceDaemonThreads - Indicates whether all threads created by the Directory Server should be created as daemon threads.
Returns:
The previous setting for this configuration option. If no previous value was specified, then false will be returned.
Throws:
InitializationException - If the Directory Server is already running.

disableExec

public boolean disableExec()
Indicates whether the Directory Server should be allowed to use the Runtime.exec() method to be able to launch external commands on the underlying system.

Returns:
true if the Directory Server should be allowed to use Runtime.exec(), or false if not.

setDisableExec

public boolean setDisableExec(boolean disableExec)
                       throws InitializationException
Specifies whether the Directory Server should be allowed to use the Runtime.exec() method to be able to launch external commands on the underlying system.

Parameters:
disableExec - Indicates whether the Directory Server should be allowed to launch external commands on the underlying system.
Returns:
The previous setting for this configuration option. If no previous value was specified, then false will be returned.
Throws:
InitializationException - If the Directory Server is already running.

getLockManagerConcurrencyLevel

public int getLockManagerConcurrencyLevel()
Retrieves the concurrency level for the Directory Server lock table.

Returns:
The concurrency level for the Directory Server lock table.

setLockManagerConcurrencyLevel

public int setLockManagerConcurrencyLevel(int concurrencyLevel)
                                   throws InitializationException
Specifies the concurrency level for the Directory Server lock table. This should be set to the maximum number of threads that could attempt to interact with the lock table at any given time.

Parameters:
concurrencyLevel - The concurrency level for the Directory Server lock manager.
Returns:
The previously-configured concurrency level. If there was no previously-configured value, then the default concurrency level will be returned.
Throws:
InitializationException - If the Directory Server is already running or there is a problem with the provided concurrency level value.

getLockManagerFairOrdering

public boolean getLockManagerFairOrdering()
Retrieves whether a fair ordering should be used for the lock manager.

Returns:
True if fair orderin should be used or false otherwise

setLockManagerFairOrdering

public boolean setLockManagerFairOrdering(boolean fairOrdering)
                                   throws InitializationException
Specifies whether a fair ordering should be used for the lock manager.

Parameters:
fairOrdering - true if fair ordering should be used, or false if not.
Returns:
The previously-configured setting for fair ordering. If there was no previously-configured value, then the default initial setting will be returned.
Throws:
InitializationException - If the Directory Server is already running.

getLockManagerTableSize

public int getLockManagerTableSize()
Retrieves the initial table size for the server lock table. This can be used to ensure that the lock table has the appropriate size for the expected number of locks that will be held at any given time.

Returns:
The initial table size for the server lock table.

setLockManagerTableSize

public int setLockManagerTableSize(int lockTableSize)
                            throws InitializationException
Specifies the initial table size for the server lock table. This can be used to ensure taht the lock table has the appropriate size for the expected number of locks that will be held at any given time.

Parameters:
lockTableSize - The initial table size for the server lock table.
Returns:
The previously-configured initial lock table size. If there was no previously-configured value, then the default initial table size will be returned.
Throws:
InitializationException - If the Directory Server is already running or there is a problem with the provided initial table size.