From 78b4564207562bc0f2ee5ad7dc3fef2174c8e568 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 07 Mar 2014 15:10:46 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1308 Migrate schema support

---
 opendj3-server-dev/src/server/org/opends/server/core/ExtendedOperationConfigManager.java                |   20 +-
 opendj3-server-dev/src/server/org/opends/server/core/GroupManager.java                                  |   34 +-
 opendj3-server-dev/src/server/org/opends/server/core/MonitorConfigManager.java                          |   18 +
 opendj3-server-dev/src/server/org/opends/server/core/AccessControlConfigManager.java                    |   22 +-
 opendj3-server-dev/src/server/org/opends/server/core/SubentryManager.java                               |    3 
 opendj3-server-dev/src/server/org/opends/server/core/PasswordStorageSchemeConfigManager.java            |   15 +
 opendj3-server-dev/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java                |   21 +-
 opendj3-server-dev/src/server/org/opends/server/tools/EncodePassword.java                               |    2 
 opendj3-server-dev/src/server/org/opends/server/core/WorkflowConfigManager.java                         |   18 +
 opendj3-server-dev/src/server/org/opends/server/core/PasswordValidatorConfigManager.java                |   18 +
 opendj3-server-dev/src/server/org/opends/server/core/SynchronizationProviderConfigManager.java          |   27 +-
 opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java                               |  141 +++++----------
 opendj3-server-dev/src/server/org/opends/server/workflowelement/WorkflowElementConfigManager.java       |   11 
 opendj3-server-dev/src/server/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java |   18 +
 opendj3-server-dev/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java                |   18 +
 opendj3-server-dev/src/server/org/opends/server/core/BackendConfigManager.java                          |   45 ++--
 opendj3-server-dev/src/server/org/opends/server/core/SASLConfigManager.java                             |   18 +
 opendj3-server-dev/src/server/org/opends/server/core/ExtensionConfigManager.java                        |   19 +
 opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroupConfigManager.java       |   18 +
 19 files changed, 242 insertions(+), 244 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/core/AccessControlConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/AccessControlConfigManager.java
index f1d9e05..267b0c1 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/AccessControlConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/AccessControlConfigManager.java
@@ -65,7 +65,6 @@
 {
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  // Fully qualified class name.
   private static final String CLASS_NAME =
     "org.opends.server.core.AccessControlConfigManager";
 
@@ -78,7 +77,7 @@
   // The current configuration.
   private AccessControlHandlerCfg currentConfiguration;
 
-
+  private ServerContext serverContext;
 
   /**
    * Creates a new instance of this access control configuration
@@ -140,22 +139,23 @@
 
 
   /**
-   * Initializes the access control sub-system. This should only be
-   * called at Directory Server startup. If an error occurs then an
-   * exception will be thrown and the Directory Server will fail to
-   * start (this prevents accidental exposure of user data due to
-   * misconfiguration).
+   * Initializes the access control sub-system. This should only be called at
+   * Directory Server startup. If an error occurs then an exception will be
+   * thrown and the Directory Server will fail to start (this prevents
+   * accidental exposure of user data due to misconfiguration).
    *
+   * @param serverContext
+   *          The server context.
    * @throws ConfigException
    *           If an access control configuration error is detected.
    * @throws InitializationException
-   *           If a problem occurs while initializing the access control
-   *           handler that is not related to the Directory Server
-   *           configuration.
+   *           If a problem occurs while initializing the access control handler
+   *           that is not related to the Directory Server configuration.
    */
-  public void initializeAccessControl()
+  public void initializeAccessControl(ServerContext serverContext)
          throws ConfigException, InitializationException
   {
+    this.serverContext = serverContext;
     // Get the root configuration object.
     ServerManagementContext managementContext =
          ServerManagementContext.getInstance();
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java
index 6119695..1334c84 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java
@@ -64,20 +64,24 @@
           ConfigurationDeleteListener <AccountStatusNotificationHandlerCfg>
 {
 
-  // A mapping between the DNs of the config entries and the associated
-  // notification handlers.
-  private ConcurrentHashMap<DN,AccountStatusNotificationHandler>
-          notificationHandlers;
+  /**
+   * A mapping between the DNs of the config entries and the associated
+   * notification handlers.
+   */
+  private final ConcurrentHashMap<DN,AccountStatusNotificationHandler> notificationHandlers;
 
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this account status notification handler config
    * manager.
+   * @param serverContext
+   *            The server context.
    */
-  public AccountStatusNotificationHandlerConfigManager()
+  public AccountStatusNotificationHandlerConfigManager(ServerContext serverContext)
   {
-    notificationHandlers =
-         new ConcurrentHashMap<DN,AccountStatusNotificationHandler>();
+    this.serverContext = serverContext;
+    notificationHandlers = new ConcurrentHashMap<DN,AccountStatusNotificationHandler>();
   }
 
 
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/BackendConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/BackendConfigManager.java
index 3f554ad..e2b3db6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/BackendConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/BackendConfigManager.java
@@ -29,6 +29,8 @@
 
 
 
+
+
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
@@ -42,13 +44,13 @@
 import org.opends.server.config.ConfigException;
 import org.opends.server.config.ConfigEntry;
 import org.opends.server.config.ConfigConstants;
-
 import org.opends.server.types.*;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
-import static org.opends.messages.ConfigMessages.*;
 
+import static org.opends.messages.ConfigMessages.*;
 import static org.opends.server.util.StaticUtils.*;
+
 import org.opends.server.admin.server.ConfigurationChangeListener;
 import org.opends.server.admin.server.ConfigurationAddListener;
 import org.opends.server.admin.server.ConfigurationDeleteListener;
@@ -73,41 +75,40 @@
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
 
+  /**
+   * The mapping between configuration entry DNs and their corresponding backend
+   * implementations.
+   */
+  private final ConcurrentHashMap<DN,Backend> registeredBackends;
 
-
-  // The mapping between configuration entry DNs and their corresponding
-  // backend implementations.
-  private ConcurrentHashMap<DN,Backend> registeredBackends;
-
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this backend config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public BackendConfigManager()
+  public BackendConfigManager(ServerContext serverContext)
   {
-    // No implementation is required.
+    this.serverContext = serverContext;
+    registeredBackends = new ConcurrentHashMap<DN,Backend>();
   }
 
-
-
   /**
    * Initializes the configuration associated with the Directory Server
-   * backends.  This should only be called at Directory Server startup.
+   * backends. This should only be called at Directory Server startup.
    *
-   * @throws  ConfigException  If a critical configuration problem prevents the
-   *                           backend initialization from succeeding.
-   *
-   * @throws  InitializationException  If a problem occurs while initializing
-   *                                   the backends that is not related to the
-   *                                   server configuration.
+   * @throws ConfigException
+   *           If a critical configuration problem prevents the backend
+   *           initialization from succeeding.
+   * @throws InitializationException
+   *           If a problem occurs while initializing the backends that is not
+   *           related to the server configuration.
    */
   public void initializeBackendConfig()
          throws ConfigException, InitializationException
   {
-    registeredBackends = new ConcurrentHashMap<DN,Backend>();
-
-
     // Create an internal server management context and retrieve
     // the root configuration.
     ServerManagementContext context = ServerManagementContext.getInstance();
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java
index 6e8c541..bb84410 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java
@@ -69,22 +69,25 @@
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
 
-  // The mapping between configuration entry DNs and their
-  // corresponding connection handler implementations.
-  private final Map<DN, ConnectionHandler<?>> connectionHandlers =
-        new ConcurrentHashMap<DN, ConnectionHandler<?>>();
+  /**
+   * The mapping between configuration entry DNs and their corresponding
+   * connection handler implementations.
+   */
+  private final Map<DN, ConnectionHandler<?>> connectionHandlers;
 
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this connection handler config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public ConnectionHandlerConfigManager() {
-    // No implementation is required.
+  public ConnectionHandlerConfigManager(ServerContext serverContext) {
+    this.serverContext = serverContext;
+    connectionHandlers = new ConcurrentHashMap<DN, ConnectionHandler<?>>();
   }
 
-
-
   /**
    * {@inheritDoc}
    */
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
index 988d939..542dbef 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
@@ -1520,14 +1520,11 @@
       // Determine whether or not we should start the connection handlers.
       boolean startConnectionHandlers = !environmentConfig.disableConnectionHandlers();
 
-      // Initialize all the schema elements.
       initializeSchema();
 
-      // Initialize the plugin manager so that internal plugins can be
-      // registered.
+      // Allow internal plugins to be registered.
       pluginConfigManager.initializePluginConfigManager();
 
-      // Virtual attribute handlers.
       virtualAttributeConfigManager.initializeVirtualAttributes();
 
       // The core Directory Server configuration.
@@ -1542,7 +1539,6 @@
       retentionPolicyConfigManager = new LogRetentionPolicyConfigManager(serverContext);
       retentionPolicyConfigManager.initializeLogRetentionPolicyConfig();
 
-      // The server loggers.
       loggerConfigManager = new LoggerConfigManager(serverContext);
       loggerConfigManager.initializeLoggerConfig();
 
@@ -1581,13 +1577,13 @@
 
       initializeGroupManager();
 
-      // Now we can initialize both subentry manager and group manager
-      // for this backend.
+      // Initialize both subentry manager and group manager
+      // for the configuration backend.
+      // TODO : why do we initialize these now ? Can't we do them after backend initialization ?
       subentryManager.performBackendInitializationProcessing(configHandler);
       groupManager.performBackendInitializationProcessing(configHandler);
 
-      // Initialize the access control handler.
-      AccessControlConfigManager.getInstance().initializeAccessControl();
+      AccessControlConfigManager.getInstance().initializeAccessControl(serverContext);
 
       // Initialize all the backends and their associated suffixes
       // and initialize the workflows when workflow configuration mode is auto.
@@ -1605,65 +1601,44 @@
         configureWorkflowsManual();
       }
 
-      // Check for and initialize user configured entry cache if any,
-      // if not stick with default entry cache initialized earlier.
+      // Check for and initialize user configured entry cache if any.
+      // If not then stick with default entry cache initialized earlier.
       entryCacheConfigManager.initializeEntryCache();
 
       // Reset the map as we can no longer guarantee offline state.
       directoryServer.offlineBackendsStateIDs.clear();
 
-      // Register the supported controls and supported features.
       initializeSupportedControls();
       initializeSupportedFeatures();
 
-
-      // Initialize all the extended operation handlers.
       initializeExtendedOperations();
 
-
-      // Initialize all the SASL mechanism handlers.
       initializeSASLMechanisms();
 
-
-      // Initialize all the connection handlers
-      // (including the administration connector).
       if (startConnectionHandlers)
       {
+        // Includes the administration connector.
         initializeConnectionHandlers();
       }
 
-
-      // Initialize all the monitor providers.
-      monitorConfigManager = new MonitorConfigManager();
+      monitorConfigManager = new MonitorConfigManager(serverContext);
       monitorConfigManager.initializeMonitorProviders();
 
-
-      // Initialize all the authentication policy components.
       initializeAuthenticationPolicyComponents();
 
-
-      // Load and initialize the user plugins.
       pluginConfigManager.initializeUserPlugins(null);
 
-
-      // Initialize the extensions.
-      extensionConfigManager = new ExtensionConfigManager();
+      extensionConfigManager = new ExtensionConfigManager(serverContext);
       extensionConfigManager.initializeExtensions();
 
-
-      // Initialize any synchronization providers that may be defined.
       if (!environmentConfig.disableSynchronization())
       {
-        synchronizationProviderConfigManager =
-          new SynchronizationProviderConfigManager();
-        synchronizationProviderConfigManager
-            .initializeSynchronizationProviders();
+        synchronizationProviderConfigManager = new SynchronizationProviderConfigManager(serverContext);
+        synchronizationProviderConfigManager.initializeSynchronizationProviders();
       }
 
-      // Create and initialize the work queue.
       workQueue = new WorkQueueConfigManager().initializeWorkQueue();
 
-
       // Invoke the startup plugins.
       PluginResult.Startup startupPluginResult =
            pluginConfigManager.invokeStartupPlugins();
@@ -2178,10 +2153,9 @@
    *                                   the backends that is not related to the
    *                                   server configuration.
    */
-  public void initializeBackends()
-          throws ConfigException, InitializationException
+  public void initializeBackends() throws ConfigException, InitializationException
   {
-    backendConfigManager = new BackendConfigManager();
+    backendConfigManager = new BackendConfigManager(serverContext);
     backendConfigManager.initializeBackendConfig();
 
 
@@ -2190,17 +2164,14 @@
     RootDSEBackendCfg rootDSECfg;
     try
     {
-      RootCfg root =
-           ServerManagementContext.getInstance().getRootConfiguration();
+      RootCfg root = ServerManagementContext.getInstance().getRootConfiguration();
       rootDSECfg = root.getRootDSEBackend();
     }
     catch (Exception e)
     {
       logger.traceException(e);
-
-      LocalizableMessage message = ERR_CANNOT_GET_ROOT_DSE_CONFIG_ENTRY.get(
-          stackTraceToSingleLineString(e));
-      throw new InitializationException(message, e);
+      throw new InitializationException(ERR_CANNOT_GET_ROOT_DSE_CONFIG_ENTRY.get(
+          stackTraceToSingleLineString(e)), e);
     }
 
     rootDSEBackend = new RootDSEBackend();
@@ -2417,8 +2388,8 @@
   {
     try
     {
-      createAndRegisterWorkflowsWithDefaultNetworkGroup (configHandler);
-      createAndRegisterWorkflowsWithDefaultNetworkGroup (rootDSEBackend);
+      createAndRegisterWorkflowsWithDefaultNetworkGroup(configHandler);
+      createAndRegisterWorkflowsWithDefaultNetworkGroup(rootDSEBackend);
     }
     catch (DirectoryException de)
     {
@@ -2519,15 +2490,15 @@
     createAndRegisterRemainingWorkflows();
 
     // Then configure the workflows
-    workflowElementConfigManager = new WorkflowElementConfigManager();
+    workflowElementConfigManager = new WorkflowElementConfigManager(serverContext);
     workflowElementConfigManager.initializeWorkflowElements();
 
-    workflowConfigManager = new WorkflowConfigManager();
+    workflowConfigManager = new WorkflowConfigManager(serverContext);
     workflowConfigManager.initializeWorkflows();
 
     if (networkGroupConfigManager == null)
     {
-      networkGroupConfigManager = new NetworkGroupConfigManager();
+      networkGroupConfigManager = new NetworkGroupConfigManager(serverContext);
       networkGroupConfigManager.initializeNetworkGroups();
     }
   }
@@ -2599,7 +2570,7 @@
   {
     try
     {
-      groupManager = new GroupManager();
+      groupManager = new GroupManager(serverContext);
     }
     catch (DirectoryException de)
     {
@@ -2646,15 +2617,14 @@
   /**
    * Initializes the set of supported controls for the Directory Server.
    *
-   * @throws  ConfigException  If there is a configuration problem with the
-   *                           list of supported controls.
-   *
-   * @throws  InitializationException  If a problem occurs while initializing
-   *                                   the set of supported controls that is not
-   *                                   related to the server configuration.
+   * @throws ConfigException
+   *           If there is a configuration problem with the list of supported
+   *           controls.
+   * @throws InitializationException
+   *           If a problem occurs while initializing the set of supported
+   *           controls that is not related to the server configuration.
    */
-  private void initializeSupportedControls()
-          throws ConfigException, InitializationException
+  private void initializeSupportedControls() throws ConfigException, InitializationException
   {
     supportedControls.add(OID_LDAP_ASSERTION);
     supportedControls.add(OID_LDAP_READENTRY_PREREAD);
@@ -2676,28 +2646,23 @@
     supportedControls.add(OID_NS_PASSWORD_EXPIRING);
   }
 
-
-
   /**
    * Initializes the set of supported features for the Directory Server.
    *
-   * @throws  ConfigException  If there is a configuration problem with the
-   *                           list of supported features.
-   *
-   * @throws  InitializationException  If a problem occurs while initializing
-   *                                   the set of supported features that is not
-   *                                   related to the server configuration.
+   * @throws ConfigException
+   *           If there is a configuration problem with the list of supported
+   *           features.
+   * @throws InitializationException
+   *           If a problem occurs while initializing the set of supported
+   *           features that is not related to the server configuration.
    */
-  private void initializeSupportedFeatures()
-          throws ConfigException, InitializationException
+  private void initializeSupportedFeatures() throws ConfigException, InitializationException
   {
     supportedFeatures.add(OID_ALL_OPERATIONAL_ATTRS_FEATURE);
     supportedFeatures.add(OID_MODIFY_INCREMENT_FEATURE);
     supportedFeatures.add(OID_TRUE_FALSE_FILTERS_FEATURE);
   }
 
-
-
   /**
    * Initializes the set of extended operation handlers for the Directory
    * Server.
@@ -2712,7 +2677,7 @@
   private void initializeExtendedOperations()
           throws ConfigException, InitializationException
   {
-    extendedOperationConfigManager = new ExtendedOperationConfigManager();
+    extendedOperationConfigManager = new ExtendedOperationConfigManager(serverContext);
     extendedOperationConfigManager.initializeExtendedOperationHandlers();
   }
 
@@ -2731,7 +2696,7 @@
   private void initializeSASLMechanisms()
           throws ConfigException, InitializationException
   {
-    saslConfigManager = new SASLConfigManager();
+    saslConfigManager = new SASLConfigManager(serverContext);
     saslConfigManager.initializeSASLMechanismHandlers();
   }
 
@@ -2752,7 +2717,7 @@
           throws ConfigException, InitializationException
   {
     if (connectionHandlerConfigManager == null) {
-      connectionHandlerConfigManager = new ConnectionHandlerConfigManager();
+      connectionHandlerConfigManager = new ConnectionHandlerConfigManager(serverContext);
     }
     connectionHandlerConfigManager.initializeConnectionHandlerConfig();
   }
@@ -2790,8 +2755,6 @@
     }
   }
 
-
-
   /**
    * Initializes the set of authentication policy components for use by the
    * Directory Server.
@@ -2803,32 +2766,20 @@
    *           If a problem occurs while initializing the authentication policy
    *           components that is not related to the server configuration.
    */
-  public void initializeAuthenticationPolicyComponents()
-         throws ConfigException, InitializationException
+  public void initializeAuthenticationPolicyComponents() throws ConfigException, InitializationException
   {
-    // Initialize all the password storage schemes.
-    storageSchemeConfigManager = new PasswordStorageSchemeConfigManager();
+    storageSchemeConfigManager = new PasswordStorageSchemeConfigManager(serverContext);
     storageSchemeConfigManager.initializePasswordStorageSchemes();
 
-
-    // Initialize all the password validators.
-    passwordValidatorConfigManager = new PasswordValidatorConfigManager();
+    passwordValidatorConfigManager = new PasswordValidatorConfigManager(serverContext);
     passwordValidatorConfigManager.initializePasswordValidators();
 
-
-    // Initialize all the password generators.
-    passwordGeneratorConfigManager = new PasswordGeneratorConfigManager();
+    passwordGeneratorConfigManager = new PasswordGeneratorConfigManager(serverContext);
     passwordGeneratorConfigManager.initializePasswordGenerators();
 
+    accountStatusNotificationHandlerConfigManager = new AccountStatusNotificationHandlerConfigManager(serverContext);
+    accountStatusNotificationHandlerConfigManager.initializeNotificationHandlers();
 
-    // Initialize the account status notification handlers.
-    accountStatusNotificationHandlerConfigManager =
-         new AccountStatusNotificationHandlerConfigManager();
-    accountStatusNotificationHandlerConfigManager.
-         initializeNotificationHandlers();
-
-
-    // Initialize all the authentication policies.
     authenticationPolicyConfigManager = new PasswordPolicyConfigManager(serverContext);
     authenticationPolicyConfigManager.initializeAuthenticationPolicies();
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/ExtendedOperationConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/ExtendedOperationConfigManager.java
index 8d38199..8b60f29 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/ExtendedOperationConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/ExtendedOperationConfigManager.java
@@ -64,24 +64,26 @@
 {
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
+  /**
+   * A mapping between the DNs of the config entries and the associated extended
+   * operation handlers.
+   */
+  private final ConcurrentHashMap<DN,ExtendedOperationHandler> handlers;
 
-
-  // A mapping between the DNs of the config entries and the associated extended
-  // operation handlers.
-  private ConcurrentHashMap<DN,ExtendedOperationHandler> handlers;
-
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this extended operation config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public ExtendedOperationConfigManager()
+  public ExtendedOperationConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     handlers = new ConcurrentHashMap<DN,ExtendedOperationHandler>();
   }
 
-
-
   /**
    * Initializes all extended operation handlers currently defined in the
    * Directory Server configuration.  This should only be called at Directory
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/ExtensionConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/ExtensionConfigManager.java
index 47c09be..6ff352a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/ExtensionConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/ExtensionConfigManager.java
@@ -63,27 +63,30 @@
        implements ConfigurationChangeListener<ExtensionCfg>,
                   ConfigurationAddListener<ExtensionCfg>,
                   ConfigurationDeleteListener<ExtensionCfg>
-
 {
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  // A mapping between the DNs of the config entries and the associated
-  // extensions.
-  private ConcurrentHashMap<DN,Extension> extensions;
+  /**
+   * A mapping between the DNs of the config entries and the associated
+   * extensions.
+   */
+  private final ConcurrentHashMap<DN,Extension> extensions;
 
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this extension config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public ExtensionConfigManager()
+  public ExtensionConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     extensions = new ConcurrentHashMap<DN,Extension>();
   }
 
-
-
   /**
    * Initializes all extensions currently defined in the Directory
    * Server configuration.  This should only be called at Directory Server
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/GroupManager.java b/opendj3-server-dev/src/server/org/opends/server/core/GroupManager.java
index 8abc45a..a868131 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/GroupManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/GroupManager.java
@@ -110,30 +110,30 @@
   /** Dummy configuration DN for Group Manager. */
   private static final String CONFIG_DN = "cn=Group Manager,cn=config";
 
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this group manager.
    *
-   * @throws DirectoryException If a problem occurs while
-   *                            creating an instance of
-   *                            the group manager.
+   * @param serverContext
+   *          The server context.
+   * @throws DirectoryException
+   *           If a problem occurs while creating an instance of the group
+   *           manager.
    */
-  public GroupManager() throws DirectoryException
+  public GroupManager(ServerContext serverContext) throws DirectoryException
   {
-    super(DN.valueOf(CONFIG_DN), EnumSet.of(
-          PluginType.POST_OPERATION_ADD,
-          PluginType.POST_OPERATION_DELETE,
-          PluginType.POST_OPERATION_MODIFY,
-          PluginType.POST_OPERATION_MODIFY_DN,
-          PluginType.POST_SYNCHRONIZATION_ADD,
-          PluginType.POST_SYNCHRONIZATION_DELETE,
-          PluginType.POST_SYNCHRONIZATION_MODIFY,
-          PluginType.POST_SYNCHRONIZATION_MODIFY_DN),
-          true);
+    super(DN.valueOf(CONFIG_DN), EnumSet.of(PluginType.POST_OPERATION_ADD,
+        PluginType.POST_OPERATION_DELETE, PluginType.POST_OPERATION_MODIFY,
+        PluginType.POST_OPERATION_MODIFY_DN,
+        PluginType.POST_SYNCHRONIZATION_ADD,
+        PluginType.POST_SYNCHRONIZATION_DELETE,
+        PluginType.POST_SYNCHRONIZATION_MODIFY,
+        PluginType.POST_SYNCHRONIZATION_MODIFY_DN), true);
+    this.serverContext = serverContext;
 
-    groupImplementations = new ConcurrentHashMap<DN,Group>();
-    groupInstances       = new DITCacheMap<Group>();
+    groupImplementations = new ConcurrentHashMap<DN, Group>();
+    groupInstances = new DITCacheMap<Group>();
 
     lock = new ReentrantReadWriteLock();
 
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/MonitorConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/MonitorConfigManager.java
index a4e96a6..29db27b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/MonitorConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/MonitorConfigManager.java
@@ -68,22 +68,26 @@
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  // A mapping between the DNs of the config entries and the associated monitor
-  // providers.
-  private ConcurrentHashMap<DN,MonitorProvider<?>> monitors;
+  /**
+   * A mapping between the DNs of the config entries and the associated monitor
+   * providers.
+   */
+  private final ConcurrentHashMap<DN,MonitorProvider<?>> monitors;
 
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this monitor provider config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public MonitorConfigManager()
+  public MonitorConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     monitors = new ConcurrentHashMap<DN,MonitorProvider<?>>();
   }
 
-
-
   /**
    * Initializes all monitor providers currently defined in the Directory Server
    * configuration.  This should only be called at Directory Server startup.
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java
index ab743b9..697ed29 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java
@@ -67,22 +67,26 @@
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
+  /**
+   * A mapping between the DNs of the config entries and the associated password
+   * generators.
+   */
+  private final ConcurrentHashMap<DN,PasswordGenerator> passwordGenerators;
 
-  // A mapping between the DNs of the config entries and the associated password
-  // generators.
-  private ConcurrentHashMap<DN,PasswordGenerator> passwordGenerators;
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this password generator config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public PasswordGeneratorConfigManager()
+  public PasswordGeneratorConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     passwordGenerators = new ConcurrentHashMap<DN,PasswordGenerator>();
   }
 
-
-
   /**
    * Initializes all password generators currently defined in the Directory
    * Server configuration.  This should only be called at Directory Server
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/PasswordStorageSchemeConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/PasswordStorageSchemeConfigManager.java
index 56f019d..2288ac1 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/PasswordStorageSchemeConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/PasswordStorageSchemeConfigManager.java
@@ -63,16 +63,23 @@
           ConfigurationAddListener    <PasswordStorageSchemeCfg>,
           ConfigurationDeleteListener <PasswordStorageSchemeCfg>
 {
-  // A mapping between the DNs of the config entries and the associated password
-  // storage schemes.
-  private ConcurrentHashMap<DN,PasswordStorageScheme> storageSchemes;
+  /**
+   * A mapping between the DNs of the config entries and the associated password
+   * storage schemes.
+   */
+  private final ConcurrentHashMap<DN,PasswordStorageScheme> storageSchemes;
 
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this password storage scheme config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public PasswordStorageSchemeConfigManager()
+  public PasswordStorageSchemeConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     storageSchemes = new ConcurrentHashMap<DN,PasswordStorageScheme>();
   }
 
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/PasswordValidatorConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/PasswordValidatorConfigManager.java
index 0d50dcd..7679507 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/PasswordValidatorConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/PasswordValidatorConfigManager.java
@@ -68,22 +68,26 @@
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  // A mapping between the DNs of the config entries and the associated
-  // password validators.
-  private ConcurrentHashMap<DN,PasswordValidator> passwordValidators;
+  /**
+   * A mapping between the DNs of the config entries and the associated password
+   * validators.
+   */
+  private final ConcurrentHashMap<DN,PasswordValidator> passwordValidators;
 
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this password validator config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public PasswordValidatorConfigManager()
+  public PasswordValidatorConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     passwordValidators = new ConcurrentHashMap<DN,PasswordValidator>();
   }
 
-
-
   /**
    * Initializes all password validators currently defined in the Directory
    * Server configuration.  This should only be called at Directory Server
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/SASLConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/SASLConfigManager.java
index 19e6456..2553bd2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/SASLConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/SASLConfigManager.java
@@ -63,23 +63,27 @@
     ConfigurationChangeListener<SASLMechanismHandlerCfg>,
     ConfigurationAddListener<SASLMechanismHandlerCfg>,
     ConfigurationDeleteListener<SASLMechanismHandlerCfg>
-
 {
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  // A mapping between the DNs of the config entries and the
-  // associated SASL
-  // mechanism handlers.
-  private ConcurrentHashMap<DN,SASLMechanismHandler> handlers;
+  /**
+   * A mapping between the DNs of the config entries and the associated SASL
+   * mechanism handlers.
+   */
+  private final ConcurrentHashMap<DN, SASLMechanismHandler> handlers;
 
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this SASL mechanism handler config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public SASLConfigManager()
+  public SASLConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     handlers = new ConcurrentHashMap<DN,SASLMechanismHandler>();
   }
 
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/SubentryManager.java b/opendj3-server-dev/src/server/org/opends/server/core/SubentryManager.java
index 91fbcd9..5829848 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/SubentryManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/SubentryManager.java
@@ -304,8 +304,7 @@
   @Override
   public void performBackendInitializationProcessing(Backend backend)
   {
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    InternalClientConnection conn = InternalClientConnection.getRootConnection();
 
     LinkedList<Control> requestControls = new LinkedList<Control>();
     requestControls.add(new SubentriesControl(true, true));
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/SynchronizationProviderConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/SynchronizationProviderConfigManager.java
index 03b4d29..6ee20c6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/SynchronizationProviderConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/SynchronizationProviderConfigManager.java
@@ -64,29 +64,26 @@
 {
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
+  /**
+   * The mapping between configuration entry DNs and their corresponding
+   * synchronization provider implementations.
+   */
+  private final ConcurrentHashMap<DN,SynchronizationProvider<SynchronizationProviderCfg>> registeredProviders;
 
-
-
-  // The mapping between configuration entry DNs and their corresponding
-  // synchronization provider implementations.
-  private ConcurrentHashMap<DN,
-    SynchronizationProvider<SynchronizationProviderCfg>> registeredProviders =
-      new ConcurrentHashMap<DN,
-        SynchronizationProvider<SynchronizationProviderCfg>>();
-
-
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this synchronization provider config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public SynchronizationProviderConfigManager()
+  public SynchronizationProviderConfigManager(ServerContext serverContext)
   {
-    // No implementation is required.
+    this.serverContext = serverContext;
+    registeredProviders = new ConcurrentHashMap<DN,SynchronizationProvider<SynchronizationProviderCfg>>();
   }
 
-
-
   /**
    * Initializes the configuration associated with the Directory Server
    * synchronization providers.  This should only be called at Directory Server
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/WorkflowConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/WorkflowConfigManager.java
index 07e0c5c..e10a136 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/WorkflowConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/WorkflowConfigManager.java
@@ -63,22 +63,26 @@
                   ConfigurationDeleteListener<WorkflowCfg>
 
 {
-  // A mapping between the DNs of the config entries and the associated
-  // workflows.
-  private ConcurrentHashMap<DN, WorkflowImpl> workflows;
+  /**
+   * A mapping between the DNs of the config entries and the associated
+   * workflows.
+   */
+  private final ConcurrentHashMap<DN, WorkflowImpl> workflows;
 
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this workflow config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public WorkflowConfigManager()
+  public WorkflowConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     workflows = new ConcurrentHashMap<DN, WorkflowImpl>();
   }
 
-
-
   /**
    * Initializes all workflows currently defined in the Directory
    * Server configuration.  This should only be called at Directory Server
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroupConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroupConfigManager.java
index e73d432..e840c25 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroupConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroupConfigManager.java
@@ -27,6 +27,7 @@
 package org.opends.server.core.networkgroups;
 
 import static org.opends.messages.ConfigMessages.*;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
@@ -40,6 +41,7 @@
 import org.opends.server.admin.std.server.RootCfg;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.ServerContext;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.forgerock.util.Utils;
 import org.opends.server.types.ConfigChangeResult;
@@ -62,22 +64,26 @@
 {
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  // A mapping between the DNs of the config entries and the associated
-  // network groups.
+  /**
+   * A mapping between the DNs of the config entries and the associated
+   * network groups.
+   */
   private final ConcurrentHashMap<DN, NetworkGroup> networkGroups;
 
-
+  private final ServerContext serverContext;
 
   /**
    * Creates a new instance of this network group config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public NetworkGroupConfigManager()
+  public NetworkGroupConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
     networkGroups = new ConcurrentHashMap<DN, NetworkGroup>();
   }
 
-
-
   /**
    * {@inheritDoc}
    */
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/EncodePassword.java b/opendj3-server-dev/src/server/org/opends/server/tools/EncodePassword.java
index 3387d1d..c9c7c30 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/EncodePassword.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/EncodePassword.java
@@ -467,7 +467,7 @@
       try
       {
         PasswordStorageSchemeConfigManager storageSchemeConfigManager =
-             new PasswordStorageSchemeConfigManager();
+             new PasswordStorageSchemeConfigManager(directoryServer.getServerContext());
         storageSchemeConfigManager.initializePasswordStorageSchemes();
       }
       catch (ConfigException ce)
diff --git a/opendj3-server-dev/src/server/org/opends/server/workflowelement/WorkflowElementConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/workflowelement/WorkflowElementConfigManager.java
index 23b0070..86a6264 100644
--- a/opendj3-server-dev/src/server/org/opends/server/workflowelement/WorkflowElementConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/workflowelement/WorkflowElementConfigManager.java
@@ -43,6 +43,7 @@
 import org.opends.server.admin.std.server.WorkflowElementCfg;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.ServerContext;
 import org.opends.server.types.ConfigChangeResult;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.InitializationException;
@@ -64,15 +65,19 @@
 
 {
 
+  private final ServerContext serverContext;
+
   /**
    * Creates a new instance of this workflow config manager.
+   *
+   * @param serverContext
+   *            The server context.
    */
-  public WorkflowElementConfigManager()
+  public WorkflowElementConfigManager(ServerContext serverContext)
   {
+    this.serverContext = serverContext;
   }
 
-
-
   /**
    * Initializes all workflow elements currently defined in the Directory
    * Server configuration.  This should only be called at Directory Server

--
Gitblit v1.10.0