mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
07.42.2014 5ebc166ce3a097cb12af659174559ccce867f64d
Checkpoint commit for OPENDJ-1308 Migrate schema support

Pass server context in constructor of managers :
AlertHandlerConfigManager, CertifacteMapperConfigManager,
EntryCacheConfigManager, IdentityMapperConfigManager,
KeyManagerProviderConfigManager, RootDNConfigManager,
TrustManagerProviderConfigManager

The server context will be needed to retrieve the configuration
when using new configuration framework.
9 files modified
191 ■■■■■ changed files
opendj3-server-dev/src/server/org/opends/server/admin/AdministrationConnector.java 7 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/AlertHandlerConfigManager.java 17 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/CertificateMapperConfigManager.java 12 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java 83 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/EntryCacheConfigManager.java 9 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/IdentityMapperConfigManager.java 13 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java 12 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/RootDNConfigManager.java 26 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java 12 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/admin/AdministrationConnector.java
@@ -27,6 +27,7 @@
package org.opends.server.admin;
import static org.opends.messages.AdminMessages.*;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
@@ -35,6 +36,7 @@
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.naming.ldap.Rdn;
import org.forgerock.opendj.ldap.AddressMask;
@@ -51,6 +53,7 @@
import org.opends.server.admin.std.server.LDAPConnectionHandlerCfg;
import org.opends.server.admin.std.server.RootCfg;
import org.opends.server.config.ConfigException;
import org.opends.server.core.ServerContext;
import org.opends.server.core.SynchronousStrategy;
import org.opends.server.protocols.ldap.LDAPConnectionHandler;
import org.opends.server.types.ConfigChangeResult;
@@ -592,11 +595,13 @@
  /**
   * Creates a self-signed JKS certificate if needed.
   *
   * @param serverContext
   *          The server context.
   * @throws InitializationException
   *           If an unexpected error occurred whilst trying to create the
   *           certificate.
   */
  public static void createSelfSignedCertificateIfNeeded()
  public static void createSelfSignedCertificateIfNeeded(ServerContext serverContext)
      throws InitializationException
  {
    try
opendj3-server-dev/src/server/org/opends/server/core/AlertHandlerConfigManager.java
@@ -66,22 +66,23 @@
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  // A mapping between the DNs of the config entries and the associated alert
  // handlers.
  private ConcurrentHashMap<DN,AlertHandler> alertHandlers;
  /** A mapping between the DNs of the config entries and the associated alert handlers. */
  private final ConcurrentHashMap<DN,AlertHandler> alertHandlers;
  private final ServerContext serverContext;
  /**
   * Creates a new instance of this alert handler config manager.
   *
   * @param serverContext
   *          The server context.
   */
  public AlertHandlerConfigManager()
  public AlertHandlerConfigManager(ServerContext serverContext)
  {
    alertHandlers = new ConcurrentHashMap<DN,AlertHandler>();
    this.serverContext = serverContext;
    alertHandlers = new ConcurrentHashMap<DN, AlertHandler>();
  }
  /**
   * Initializes all alert handlers currently defined in the Directory Server
   * configuration.  This should only be called at Directory Server startup.
opendj3-server-dev/src/server/org/opends/server/core/CertificateMapperConfigManager.java
@@ -72,18 +72,20 @@
  // certificate mappers.
  private ConcurrentHashMap<DN,CertificateMapper> certificateMappers;
  private final ServerContext serverContext;
  /**
   * Creates a new instance of this certificate mapper config manager.
   *
   * @param serverContext
   *          The server context.
   */
  public CertificateMapperConfigManager()
  public CertificateMapperConfigManager(ServerContext serverContext)
  {
    certificateMappers = new ConcurrentHashMap<DN,CertificateMapper>();
    this.serverContext = serverContext;
    certificateMappers = new ConcurrentHashMap<DN, CertificateMapper>();
  }
  /**
   * Initializes all certificate mappers currently defined in the Directory
   * Server configuration.  This should only be called at Directory Server
opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
@@ -1527,38 +1527,32 @@
      // registered.
      pluginConfigManager.initializePluginConfigManager();
      // Initialize all the virtual attribute handlers.
      // Virtual attribute handlers.
      virtualAttributeConfigManager.initializeVirtualAttributes();
      // Initialize the core Directory Server configuration.
      // The core Directory Server configuration.
      coreConfigManager = new CoreConfigManager(serverContext);
      coreConfigManager.initializeCoreConfig();
      // Initialize the Directory Server crypto manager.
      initializeCryptoManager();
      // Initialize the log rotation policies.
      rotationPolicyConfigManager = new LogRotationPolicyConfigManager(serverContext);
      rotationPolicyConfigManager.initializeLogRotationPolicyConfig();
      // Initialize the log retention policies.
      retentionPolicyConfigManager = new LogRetentionPolicyConfigManager(serverContext);
      retentionPolicyConfigManager.initializeLogRetentionPolicyConfig();
      // Initialize the server loggers.
      // The server loggers.
      loggerConfigManager = new LoggerConfigManager(serverContext);
      loggerConfigManager.initializeLoggerConfig();
      RuntimeInformation.logInfo();
      // Initialize the server alert handlers.
      initializeAlertHandlers();
      new AlertHandlerConfigManager(serverContext).initializeAlertHandlers();
      // Initialize the default entry cache. We have to have one before
      // <CODE>initializeBackends()</CODE> method kicks in further down.
      entryCacheConfigManager = new EntryCacheConfigManager();
      entryCacheConfigManager = new EntryCacheConfigManager(serverContext);
      entryCacheConfigManager.initializeDefaultEntryCache();
      // Initialize the administration connector self signed certificate if
@@ -1566,36 +1560,25 @@
      // picked up.
      if (startConnectionHandlers)
      {
        AdministrationConnector.createSelfSignedCertificateIfNeeded();
        AdministrationConnector.createSelfSignedCertificateIfNeeded(serverContext);
      }
      // Initialize the key manager provider.
      keyManagerProviderConfigManager = new KeyManagerProviderConfigManager();
      keyManagerProviderConfigManager = new KeyManagerProviderConfigManager(serverContext);
      keyManagerProviderConfigManager.initializeKeyManagerProviders();
      // Initialize the trust manager provider.
      trustManagerProviderConfigManager =
           new TrustManagerProviderConfigManager();
      trustManagerProviderConfigManager = new TrustManagerProviderConfigManager(serverContext);
      trustManagerProviderConfigManager.initializeTrustManagerProviders();
      // Initialize the certificate mapper.
      certificateMapperConfigManager = new CertificateMapperConfigManager();
      certificateMapperConfigManager = new CertificateMapperConfigManager(serverContext);
      certificateMapperConfigManager.initializeCertificateMappers();
      identityMapperConfigManager = new IdentityMapperConfigManager(serverContext);
      identityMapperConfigManager.initializeIdentityMappers();
      // Initialize the identity mappers.
      initializeIdentityMappers();
      initializeRootDNConfigManager();
      // Initialize the root DNs.
      rootDNConfigManager = new RootDNConfigManager();
      rootDNConfigManager.initializeRootDNs();
      // Initialize the subentry manager.
      initializeSubentryManager();
      // Initialize the group manager.
      initializeGroupManager();
      // Now we can initialize both subentry manager and group manager
@@ -1955,25 +1938,6 @@
  /**
   * Initializes the set of alert handlers defined in the Directory Server.
   *
   * @throws  ConfigException  If there is a configuration problem with any of
   *                           the alert handlers.
   *
   * @throws  InitializationException  If a problem occurs while initializing
   *                                   the alert handlers that is not related to
   *                                   the server configuration.
   */
  private void initializeAlertHandlers()
          throws ConfigException, InitializationException
  {
    new AlertHandlerConfigManager().initializeAlertHandlers();
  }
  /**
   * Initializes the schema elements for the Directory Server, including the
   * matching rules, attribute syntaxes, attribute types, and object classes.
   *
@@ -2735,25 +2699,6 @@
  /**
   * Initializes the set of identity mappers for the Directory Server.
   *
   * @throws  ConfigException  If there is a configuration problem with any of
   *                           the extended operation handlers.
   *
   * @throws  InitializationException  If a problem occurs while initializing
   *                                   the extended operation handlers that is
   *                                   not related to the server configuration.
   */
  private void initializeIdentityMappers()
          throws ConfigException, InitializationException
  {
    identityMapperConfigManager = new IdentityMapperConfigManager();
    identityMapperConfigManager.initializeIdentityMappers();
  }
  /**
   * Initializes the set of extended operation handlers for the Directory
   * Server.
   *
@@ -2841,8 +2786,6 @@
    }
    catch (DirectoryException de)
    {
      logger.traceException(de);
      throw new InitializationException(de.getMessageObject());
    }
  }
@@ -2949,7 +2892,7 @@
   */
  public void initializeRootDNConfigManager()
         throws ConfigException, InitializationException{
    rootDNConfigManager = new RootDNConfigManager();
    rootDNConfigManager = new RootDNConfigManager(serverContext);
    rootDNConfigManager.initializeRootDNs();
  }
opendj3-server-dev/src/server/org/opends/server/core/EntryCacheConfigManager.java
@@ -85,12 +85,17 @@
  private static final String
    DEFAULT_ENTRY_CACHE_MONITOR_PROVIDER = "Entry Caches";
  private final ServerContext serverContext;
  /**
   * Creates a new instance of this entry cache config manager.
   *
   * @param serverContext
   *          The server context.
   */
  public EntryCacheConfigManager()
  public EntryCacheConfigManager(ServerContext serverContext)
  {
    // No implementation is required.
    this.serverContext = serverContext;
  }
opendj3-server-dev/src/server/org/opends/server/core/IdentityMapperConfigManager.java
@@ -67,17 +67,20 @@
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  // A mapping between the DNs of the config entries and the associated identity
  // mappers.
  private ConcurrentHashMap<DN,IdentityMapper> identityMappers;
  /** A mapping between the DNs of the config entries and the associated identity mappers. */
  private final ConcurrentHashMap<DN,IdentityMapper> identityMappers;
  private final ServerContext serverContext;
  /**
   * Creates a new instance of this identity mapper config manager.
   *
   * @param serverContext
   *          The server context.
   */
  public IdentityMapperConfigManager()
  public IdentityMapperConfigManager(ServerContext serverContext)
  {
    this.serverContext = serverContext;
    identityMappers = new ConcurrentHashMap<DN,IdentityMapper>();
  }
opendj3-server-dev/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java
@@ -70,20 +70,22 @@
  // A mapping between the DNs of the config entries and the associated key
  // manager providers.
  private ConcurrentHashMap<DN,KeyManagerProvider> providers;
  private final ConcurrentHashMap<DN,KeyManagerProvider> providers;
  private final ServerContext serverContext;
  /**
   * Creates a new instance of this key manager provider config manager.
   *
   * @param serverContext
   *          The server context.
   */
  public KeyManagerProviderConfigManager()
  public KeyManagerProviderConfigManager(ServerContext serverContext)
  {
    this.serverContext = serverContext;
    providers = new ConcurrentHashMap<DN,KeyManagerProvider>();
  }
  /**
   * Initializes all key manager providers currently defined in the Directory
   * Server configuration.  This should only be called at Directory Server
opendj3-server-dev/src/server/org/opends/server/core/RootDNConfigManager.java
@@ -29,6 +29,8 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -73,30 +75,32 @@
  // "cn=Root DNs,cn=config" entry itself.
  private RootPrivilegeChangeListener rootPrivilegeChangeListener;
  private final ServerContext serverContext;
  /**
   * Creates a new instance of this root DN config manager.
   *
   * @param serverContext
   *          The server context.
   */
  public RootDNConfigManager()
  public RootDNConfigManager(ServerContext serverContext)
  {
    alternateBindDNs = new ConcurrentHashMap<DN,HashSet<DN>>();
    this.serverContext = serverContext;
    alternateBindDNs = new ConcurrentHashMap<DN, HashSet<DN>>();
    rootPrivilegeChangeListener = new RootPrivilegeChangeListener();
  }
  /**
   * Initializes all of the root users currently defined in the Directory Server
   * configuration, as well as the set of privileges that root users will
   * inherit by default.
   *
   * @throws  ConfigException  If a configuration problem causes the identity
   *                           mapper initialization process to fail.
   *
   * @throws  InitializationException  If a problem occurs while initializing
   *                                   the identity mappers that is not related
   *                                   to the server configuration.
   * @throws ConfigException
   *           If a configuration problem causes the identity mapper
   *           initialization process to fail.
   * @throws InitializationException
   *           If a problem occurs while initializing the identity mappers that
   *           is not related to the server configuration.
   */
  public void initializeRootDNs()
         throws ConfigException, InitializationException
opendj3-server-dev/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java
@@ -70,20 +70,22 @@
  // A mapping between the DNs of the config entries and the associated trust
  // manager providers.
  private ConcurrentHashMap<DN,TrustManagerProvider> providers;
  private final ConcurrentHashMap<DN,TrustManagerProvider> providers;
  private final ServerContext serverContext;
  /**
   * Creates a new instance of this trust manager provider config manager.
   *
   * @param serverContext
   *          The server context.
   */
  public TrustManagerProviderConfigManager()
  public TrustManagerProviderConfigManager(ServerContext serverContext)
  {
    this.serverContext = serverContext;
    providers = new ConcurrentHashMap<DN,TrustManagerProvider>();
  }
  /**
   * Initializes all trust manager providers currently defined in the Directory
   * Server configuration.  This should only be called at Directory Server