org.opends.server.admin
Class ClassLoaderProvider

java.lang.Object
  extended by org.opends.server.admin.ClassLoaderProvider

public final class ClassLoaderProvider
extends java.lang.Object

Manages the class loader which should be used for loading configuration definition classes and associated extensions.

For extensions which define their own extended configuration definitions, the class loader will make sure that the configuration definition classes are loaded and initialized.

Initially the class loader provider 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
 void addExtension(java.lang.String... extensions)
          Add the named extensions to this class loader provider.
 void disable()
          Disable this class loader provider and removed any registered extensions.
 void enable()
          Enable this class loader provider using the application's class loader as the parent class loader.
 void enable(java.lang.ClassLoader parent)
          Enable this class loader provider using the provided parent class loader.
 java.lang.ClassLoader getClassLoader()
          Gets the class loader which should be used for loading classes and resources.
static ClassLoaderProvider getInstance()
          Get the single application wide class loader provider instance.
 boolean isEnabled()
          Indicates whether this class loader provider is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ClassLoaderProvider getInstance()
Get the single application wide class loader provider instance.

Returns:
Returns the single application wide class loader provider instance.

addExtension

public void addExtension(java.lang.String... extensions)
                  throws InitializationException,
                         java.lang.IllegalStateException,
                         java.lang.IllegalArgumentException
Add the named extensions to this class loader provider.

Parameters:
extensions - The names of the extensions to be loaded. The names should not contain any path elements and must be located within the extensions folder.
Throws:
InitializationException - If one of the extensions could not be loaded and initialized.
java.lang.IllegalStateException - If this class loader provider is disabled.
java.lang.IllegalArgumentException - If one of the extension names was not a single relative path name element or was an absolute path.

disable

public void disable()
             throws java.lang.IllegalStateException
Disable this class loader provider and removed any registered extensions.

Throws:
java.lang.IllegalStateException - If this class loader provider is already disabled.

enable

public void enable()
            throws InitializationException,
                   java.lang.IllegalStateException
Enable this class loader provider using the application's class loader as the parent class loader.

Throws:
InitializationException - If the class loader provider could not initialize successfully.
java.lang.IllegalStateException - If this class loader provider is already enabled.

enable

public void enable(java.lang.ClassLoader parent)
            throws InitializationException,
                   java.lang.IllegalStateException
Enable this class loader provider using the provided parent class loader.

Parameters:
parent - The parent class loader.
Throws:
InitializationException - If the class loader provider could not initialize successfully.
java.lang.IllegalStateException - If this class loader provider is already enabled.

getClassLoader

public java.lang.ClassLoader getClassLoader()
Gets the class loader which should be used for loading classes and resources. When this class loader provider 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.

isEnabled

public boolean isEnabled()
Indicates whether this class loader provider is enabled.

Returns:
Returns true if this class loader provider is enabled.