Class DirectoryEnvironmentConfig


  • @PublicAPI(stability=VOLATILE,
               mayInstantiate=true,
               mayInvoke=true)
    public final class DirectoryEnvironmentConfig
    extends 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 Detail

      • 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 - If true, prevent any change when server is running.
    • Method Detail

      • setProperty

        public void setProperty​(String name,
                                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.
        Throws:
        InitializationException - If the Directory Server is already running.
      • getServerRoot

        public File 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 null if it can't be determined.
      • getServerRootAsString

        public String getServerRootAsString()
        Retrieves the path of the directory that should be considered the server root.

        This method uses the same rules than getServerRoot method, but never returns null. 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

        public Path getInstanceRoot()
        Retrieves the directory that should be considered the instance root.
        Returns:
        The directory that should be considered the instance root or null if it can't be determined.
      • getInstanceRootOrUserDir

        public Path getInstanceRootOrUserDir()
        Retrieves the path of the directory that should be considered the instance root.

        This method uses the same rules than getInstanceRoot method, but never returns null. 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.
      • getInstanceRootAsString

        public String getInstanceRootAsString()
        Retrieves the path of the directory that should be considered the instance root.

        This method uses the same rules than getInstanceRoot method, but never returns null. 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

        public void setServerRoot​(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.
        Throws:
        InitializationException - If the Directory Server is already running or there is a problem with the provided server root.
      • setInstanceRoot

        public void setInstanceRoot​(File instanceRoot)
                             throws InitializationException
        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

        public void setConfigResolver​(PropertyResolver resolver)
        Specifies the PropertyResolver to resolve configuration expressions.
        Parameters:
        resolver - the property resolver
      • getConfigFile

        public Path 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 void setConfigFile​(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.
        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 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.
      • 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 void 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.
        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

        public Path getSchemaDirectory()
        Retrieves the directory that contains the server schema configuration files.
        Returns:
        The directory that contains the server schema configuration files, or null if none is defined.
      • getSchemaDirectory

        public static Path getSchemaDirectory​(Path instanceDir)
        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 null if none is defined.
      • setSchemaDirectory

        public void setSchemaDirectory​(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.
        Throws:
        InitializationException - If the Directory Server is already running or there is a problem with the provided schema directory.
      • getLockDirectory

        public Path 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.
      • getVarDirectory

        public Path getVarDirectory()
        Retrieves the directory in which mutable files should be placed.
        Returns:
        The directory in which variable files should be placed, or null if 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:
        true if the Directory Server should not start its connection handlers, or false if 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:
        true if the Directory Server should not start its synchronization provider, or false if 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:
        true if 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:
        true if all threads created by the Directory Server should be created as daemon threads, or false if not.
      • setForceDaemonThreads

        public void 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.
        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:
        true if the Directory Server should register a shutdown hook or false if not.
      • setRegisterShutdownHook

        public void setRegisterShutdownHook​(boolean registerShutdownHook)
                                     throws InitializationException
        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.