Package org.forgerock.opendj.config
Class ConfigurationFramework
- java.lang.Object
-
- org.forgerock.opendj.config.ConfigurationFramework
-
public final class ConfigurationFramework extends Object
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassLoadergetClassLoader()Returns the class loader which should be used for loading classes and resources.StringgetInstallPath()Returns the installation path.static ConfigurationFrameworkgetInstance()Returns the single application wide configuration framework instance.StringgetInstancePath()Returns the instance path.static StringgetPrintableExtensionInformation(String installPath, String instancePath)Returns a string representing all information about extensions.ConfigurationFrameworkinitialize()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.ConfigurationFrameworkinitialize(String installAndInstancePath)Initializes the configuration framework using the application's class loader as the parent class loader, and the provided install/instance path.ConfigurationFrameworkinitialize(String installPath, String instancePath)Initializes the configuration framework using the application's class loader as the parent class loader, and the provided install and instance paths.ConfigurationFrameworkinitialize(String installPath, String instancePath, ClassLoader parent)Initializes the configuration framework using the provided parent class loader and install and instance paths.booleanisClient()Returnstrueif the configuration framework is being used within a client application.booleanisInitialized()Returnstrueif the configuration framework has been initialized.voidreload()Reloads the configuration framework.ConfigurationFrameworksetIsClient(boolean isClient)Specifies whether the configuration framework is being used within a client application.
-
-
-
Method Detail
-
getInstance
public static ConfigurationFramework getInstance()
Returns the single application wide configuration framework instance.- Returns:
- The single application wide configuration framework instance.
-
getPrintableExtensionInformation
public static String getPrintableExtensionInformation(String installPath, String instancePath)
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;
nullif there is no information available.
-
getClassLoader
public ClassLoader 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
public ConfigurationFramework initialize() throws ConfigException
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.- Returns:
- The configuration framework.
- Throws:
ConfigException- If the configuration framework could not initialize successfully.IllegalStateException- If the configuration framework has already been initialized.
-
initialize
public ConfigurationFramework initialize(String installAndInstancePath) throws ConfigException
Initializes the configuration framework using the application's class loader as the parent class loader, and the provided install/instance path.- Parameters:
installAndInstancePath- The path where application binaries and data are located.- Returns:
- The configuration framework.
- Throws:
ConfigException- If the configuration framework could not initialize successfully.IllegalStateException- If the configuration framework has already been initialized.
-
initialize
public ConfigurationFramework initialize(String installPath, String instancePath) 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:
installPath- The path where application binaries are located.instancePath- The path where application data are located.- Returns:
- The configuration framework.
- Throws:
ConfigException- If the configuration framework could not initialize successfully.IllegalStateException- If the configuration framework has already been initialized.
-
initialize
public ConfigurationFramework initialize(String installPath, String instancePath, ClassLoader parent) throws ConfigException
Initializes the configuration framework using the provided parent class loader and install and instance paths.- Parameters:
installPath- The path where application binaries are located.instancePath- The path where application data are located.parent- The parent class loader.- Returns:
- The 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()
Returnstrueif 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:
trueif the configuration framework is being used within a client application.
-
isInitialized
public boolean isInitialized()
Returnstrueif the configuration framework has been initialized.- Returns:
trueif the configuration framework has been initialized.
-
reload
public void reload() throws ConfigExceptionReloads the configuration framework.- Throws:
ConfigException- If the configuration framework could not initialize successfully.IllegalStateException- If the configuration framework has not yet been initialized.
-
setIsClient
public ConfigurationFramework setIsClient(boolean isClient)
Specifies whether 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.- Parameters:
isClient-trueif the configuration framework is being used within a client application.- Returns:
- The configuration framework.
-
getInstallPath
public String getInstallPath()
Returns the installation path.- Returns:
- The installation path of this instance.
-
getInstancePath
public String getInstancePath()
Returns the instance path.- Returns:
- The instance path.
-
-