Package org.forgerock.opendj.config
Class ConfigurationFramework
java.lang.Object
org.forgerock.opendj.config.ConfigurationFramework
This class is responsible for managing the configuration framework including:
- loading core components during application initialization
- loading extensions during and after application initialization
- changing the property validation strategy based on whether the application is a client or server.
Initially the configuration framework is disabled, and calls to the getClassLoader()
will return the system default class loader.
Applications MUST NOT maintain persistent references to the class loader as it can change at run-time.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Represents parameters used for initializing aConfigurationFramework
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
forceInitialize
(ConfigurationFramework.InitParameters initParameters) Initializes the configuration framework using the application's class loader as the parent class loader, and the provided install and instance paths.Returns the class loader which should be used for loading classes and resources.Returns the installation path.static ConfigurationFramework
Returns the single application wide configuration framework instance.Returns the instance path.static String
getPrintableExtensionInformation
(Path installPath, Path instancePath) Returns a string representing all information about extensions.com.forgerock.opendj.util.Version
Returns the version of this configuration framework.void
Initializes the configuration framework using the application's class loader as the parent class loader, and the current working directory as the install and instance path.void
initialize
(ConfigurationFramework.InitParameters initParameters) Initializes the configuration framework using the application's class loader as the parent class loader, and the current working directory as the install and instance path.void
Silently initialize the configuration framework.boolean
isClient()
Returnstrue
if the configuration framework is being used within a client application.boolean
isConfigFile
(Path file) Returnstrue
if the provided file is the configuration file used by this instance.
-
Method Details
-
getInstance
Returns the single application wide configuration framework instance.- Returns:
- The single application wide configuration framework instance.
-
getPrintableExtensionInformation
Returns a string representing all information about extensions.- Parameters:
installPath
- The path where application binaries are located.instancePath
- The path where application data are located.- Returns:
- A string representing all information about extensions;
null
if there is no information available.
-
getClassLoader
Returns the class loader which should be used for loading classes and resources. When this configuration framework is disabled, the system default class loader will be returned by default.Applications MUST NOT maintain persistent references to the class loader as it can change at run-time.
- Returns:
- Returns the class loader which should be used for loading classes and resources.
-
initialize
Initializes the configuration framework using the application's class loader as the parent class loader, and the current working directory as the install and instance path.- Throws:
ConfigException
- If the configuration framework could not initialize successfully.IllegalStateException
- If the configuration framework has already been initialized.
-
initialize
Initializes the configuration framework using the application's class loader as the parent class loader, and the current working directory as the install and instance path.- Parameters:
initParameters
- Theparameters
used for initializing this configuration framework.- Throws:
ConfigException
- If the configuration framework could not initialize successfully.IllegalStateException
- If the configuration framework has already been initialized.
-
initializeSilently
public void initializeSilently()Silently initialize the configuration framework.Do not log anything during the initialization. Catch
ConfigException
which may occurs and convert it to aRuntimeException
. This method should be used by client tools who need to initialize the framework. -
forceInitialize
public void forceInitialize(ConfigurationFramework.InitParameters initParameters) throws ConfigException Initializes the configuration framework using the application's class loader as the parent class loader, and the provided install and instance paths.- Parameters:
initParameters
- Theparameters
used for initializing this configuration framework.- Throws:
ConfigException
- If the configuration framework could not initialize successfully.IllegalStateException
- If the configuration framework has already been initialized.
-
isClient
public boolean isClient()Returnstrue
if the configuration framework is being used within a client application. Client applications will perform less property value validation than server applications because they do not have resources available such as the server schema.- Returns:
true
if the configuration framework is being used within a client application.
-
getInstallPath
Returns the installation path.- Returns:
- The installation path of this instance.
-
getInstancePath
Returns the instance path.- Returns:
- The instance path.
-
getVersion
public com.forgerock.opendj.util.Version getVersion()Returns the version of this configuration framework.- Returns:
- a
Version
object representing the version of thisConfigurationFramework
-
isConfigFile
Returnstrue
if the provided file is the configuration file used by this instance.If an IO exception occurs, this method will return
false
instead of throwing it.- Parameters:
file
- The file to be compared against this instance configuration file.- Returns:
true
if the provided file is the configuration file used by this instance,false
otherwise.
-