Class DirectoryEnvironmentConfig
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new directory environment configuration initialized from the system properties defined in the JVM.DirectoryEnvironmentConfig(boolean checkIfServerIsRunning) Creates a new directory environment configuration initialized from the system properties defined in the JVM. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether the Directory Server startup process should skip the synchronization between admin data and the configuration.booleanIndicates whether the Directory Server startup process should skip the connection handler creation and initialization phases.booleanIndicates whether the Directory Server startup process should skip the synchronization provider creation and initialization phases.booleanIndicates whether all threads created by the Directory Server should be created as daemon threads.Retrieves the configuration file that should be used to initialize the Directory Server config handler.getFileForPath(String path) Retrieves aPathobject corresponding to the specified path.getFileForPath(Path path) Retrieves aPathobject corresponding to the specified path.Retrieves the directory that should be considered the instance root.Retrieves the path of the directory that should be considered the instance root.Retrieves the directory that should be used to hold the server lock files.intRetrieves the maximum number of archived configurations that the Directory Server should maintain.Returns thePropertyResolverto be used by Directory Server when resolving configuration expressions to values.Retrieves the directory that contains the server schema configuration files.static PathgetSchemaDirectory(Path instanceDir) Retrieves the directory that contains the server schema configuration files.Retrieves the directory that should be considered the server root.Retrieves the path of the directory that should be considered the server root.Retrieves the directory in which mutable files should be placed.booleanIndicates whether the Directory Server should maintain an archive of previous configurations.booleanIndicates whether the Directory Server should register a virtual-machine shutdown hook.voidsetConfigFile(Path configFile) Specifies the configuration file that should be used to initialize the Directory Server config handler.voidsetConfigResolver(PropertyResolver resolver) Specifies thePropertyResolverto resolve configuration expressions.voidsetDisableConnectionHandlers(boolean disableConnectionHandlers) Specifies whether the Directory Server startup process should skip the connection handler creation and initialization phases.voidsetForceDaemonThreads(boolean forceDaemonThreads) Specifies whether all threads created by the Directory Server should be created as daemon threads.voidsetInstanceRoot(Path instanceRoot) Specifies the directory that should be considered the instance root.voidsetMaintainConfigArchive(boolean maintainConfigArchive) Specifies whether the Directory Server should maintain an archive of previous configurations.voidsetProperty(String name, String value) Specifies a property with the given name and value.voidsetRegisterShutdownHook(boolean registerShutdownHook) Specifies whether a virtual-machine shutdown hook should be registered.voidsetSchemaDirectory(Path schemaDirectory) Specifies the directory that should contain the server schema configuration files.voidsetServerRoot(Path serverRoot) Specifies the directory that should be considered the server root.booleanIndicates whether the Directory Server should attempt to start with the "last known good" configuration rather than the current active configuration file.
-
Constructor Details
-
DirectoryEnvironmentConfig
public DirectoryEnvironmentConfig()Creates a new directory environment configuration initialized from the system properties defined in the JVM. -
DirectoryEnvironmentConfig
public DirectoryEnvironmentConfig(boolean checkIfServerIsRunning) Creates a new directory environment configuration initialized from the system properties defined in the JVM.- Parameters:
checkIfServerIsRunning- Iftrue, prevent any change when server is running.
-
-
Method Details
-
setProperty
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 isnull.- Parameters:
name- The name of the property to set.value- The value of the property to set, ornullif the property is to be removed.- Throws:
InitializationException- If the Directory Server is already running.
-
getServerRoot
Retrieves the directory that should be considered the server root.The determination will first be based on the properties defined in this object. If no value is found there, then the JVM system properties will be checked, followed by an environment variable. If there is still no value, then the location of the config file, if available, is used to determine the root.
- Returns:
- The directory that should be considered the server root, or
nullif it can't be determined.
-
getServerRootOrUserDir
Retrieves the path of the directory that should be considered the server root.This method uses the same rules than
getServerRootmethod, but never returnsnull. If no directory can be found it returns as a last resort the value of "user.dir" system property.- Returns:
- the path of the directory that should be considered the server root.
-
getInstanceRoot
Retrieves the directory that should be considered the instance root.- Returns:
- The directory that should be considered the instance root or
nullif it can't be determined.
-
getInstanceRootOrUserDir
Retrieves the path of the directory that should be considered the instance root.This method uses the same rules than
getInstanceRootmethod, but never returnsnull. If no directory can be found it returns as a last resort the value of "user.dir" system property.- Returns:
- the path of the directory that should be considered the instance root.
-
setServerRoot
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.- Throws:
InitializationException- If the Directory Server is already running or there is a problem with the provided server root.
-
setInstanceRoot
Specifies the directory that should be considered the instance root. Any relative path used in the server should be considered relative to the instance root.- Parameters:
instanceRoot- The directory that should be considered the instanceRoot root.- Throws:
InitializationException- If the Directory Server is already running or there is a problem with the provided server root.
-
setConfigResolver
Specifies thePropertyResolverto resolve configuration expressions.- Parameters:
resolver- the property resolver
-
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
nullif no configuration file is defined.
-
getPropertyResolver
Returns thePropertyResolverto be used by Directory Server when resolving configuration expressions to values. If no resolvers have been defined, the default property resolver for the stack is used.- Returns:
- the list of
PropertyResolver - Throws:
InitializationException- If the resolver can't be created
-
setConfigFile
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.- Throws:
InitializationException- If the Directory Server is already running or there is a problem with the provided configuration file.
-
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 offalsewill be returned.- Returns:
trueif the Directory Server should attempt to start using the "last known good" configuration, orfalseif it should try to start using the active configuration.
-
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 oftruewill be returned.- Returns:
trueif the Directory Server should maintain an archive of previous configurations, orfalseif not.
-
setMaintainConfigArchive
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.- 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.
-
getSchemaDirectory
Retrieves the directory that contains the server schema configuration files.- Returns:
- The directory that contains the server schema configuration files, or
nullif none is defined.
-
getSchemaDirectory
Retrieves the directory that contains the server schema configuration files. If a default directory of "db/schema" or "config/schema" exists below the instance directory, then that will be returned.This code is copied to LdifManagementContextFactory#getSchemaDirectory().
- Parameters:
instanceDir- The instance directory inside which the schema directory is searched- Returns:
- The directory that contains the server schema configuration files, or
nullif none is defined.
-
setSchemaDirectory
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.- Throws:
InitializationException- If the Directory Server is already running or there is a problem with the provided schema directory.
-
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
nullif it cannot be determined.
-
getVarDirectory
Retrieves the directory in which mutable files should be placed.- Returns:
- The directory in which variable files should be placed, or
nullif it cannot be determined
-
disableConnectionHandlers
public boolean disableConnectionHandlers()Indicates whether the Directory Server startup process should skip the connection handler creation and initialization phases.- Returns:
trueif the Directory Server should not start its connection handlers, orfalseif the connection handlers should be enabled.
-
disableSynchronization
public boolean disableSynchronization()Indicates whether the Directory Server startup process should skip the synchronization provider creation and initialization phases.- Returns:
trueif the Directory Server should not start its synchronization provider, orfalseif the synchronization provider should be enabled.
-
disableAdminDataSynchronization
public boolean disableAdminDataSynchronization()Indicates whether the Directory Server startup process should skip the synchronization between admin data and the configuration.- Returns:
trueif the Directory Server should start synchronization between admin data and the configuration.
-
setDisableConnectionHandlers
public void 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.- 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:
trueif all threads created by the Directory Server should be created as daemon threads, orfalseif not.
-
setForceDaemonThreads
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.- Throws:
InitializationException- If the Directory Server is already running.
-
registerShutdownHook
public boolean registerShutdownHook()Indicates whether the Directory Server should register a virtual-machine shutdown hook.- Returns:
trueif the Directory Server should register a shutdown hook orfalseif not.
-
setRegisterShutdownHook
Specifies whether a virtual-machine shutdown hook should be registered.- Parameters:
registerShutdownHook- Indicates whether the Directory Server should register a virtual-machine shutdown hook.- Throws:
InitializationException- If the Directory Server is already running.
-
getFileForPath
Retrieves aPathobject corresponding to the specified path. If the given path is an absolute path, then it will be used. If the path is relative, then it will be interpreted as if it were relative to the Directory Server root.- Parameters:
path- The path object to be retrieved as an absolutePath- Returns:
- A
Pathobject that corresponds to the specified path.
-
getFileForPath
Retrieves aPathobject corresponding to the specified path. If the given path is an absolute path, then it will be used. If the path is relative, then it will be interpreted as if it were relative to the Directory Server root.- Parameters:
path- The path object to be retrieved as an absolutePath- Returns:
- A
Pathobject that corresponds to the specified path.
-