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

Jean-Noël Rouvignac
04.30.2016 470936255a009dd659e3736df92ce1a6c2767362
Extracted method ServerContext.getRootConfig()
44 files modified
432 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteBaseDNAndBackendTask.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java 4 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java 12 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/AdministrationConnector.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/AccessControlConfigManager.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/AlertHandlerConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/AttributeSyntaxConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/CertificateMapperConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/ConnectionHandlerConfigManager.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java 18 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/ExtendedOperationConfigManager.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/GroupManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/IdentityMapperConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/KeyManagerProviderConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/LogRetentionPolicyConfigManager.java 29 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/LogRotationPolicyConfigManager.java 30 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/LoggerConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/MonitorConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordGeneratorConfigManager.java 5 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyConfigManager.java 60 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordStorageSchemeConfigManager.java 5 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordValidatorConfigManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/PluginConfigManager.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/RootDNConfigManager.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/SASLConfigManager.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/SchemaHandler.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/ServerContext.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/SynchronizationProviderConfigManager.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/TrustManagerProviderConfigManager.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/VirtualAttributeConfigManager.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/WorkQueueConfigManager.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/loggers/CommonAudit.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java 55 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java 2 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/EncodePassword.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/tools/ImportLDIFTestCase.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteBaseDNAndBackendTask.java
@@ -633,8 +633,7 @@
        }
        else
        {
          RootCfg root =
              DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration();
          RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig();
          ReplicationSynchronizationProviderCfg sync = null;
          try
          {
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
@@ -151,9 +151,7 @@
      final Set<BackendDescriptor> backendDescriptors, final Set<DN> alternateBindDNs,
      final List<OpenDsException> errors) throws OpenDsException, ConfigException
  {
    // Get the Directory Server configuration handler and use it.
    final RootCfg root =
        DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration();
    final RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig();
    readAdminConnector(root, errors);
    readConnectionHandlers(connectionHandlers, root, errors);
    isSchemaEnabled = root.getGlobalConfiguration().isCheckSchema();
opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
@@ -437,9 +437,7 @@
    }
    if (couldInitializeConfig)
    {
      // Get the Directory Server configuration handler and use it.
      RootCfg root =
          DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration();
      RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig();
      administrationConnectorCfg = root.getAdministrationConnector();
      String trustManagerStr = administrationConnectorCfg.getTrustManagerProvider();
@@ -496,8 +494,7 @@
    }
    if (couldInitializeConfiguration)
    {
      RootCfg root =
          DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration();
      RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig();
      return root.getAdministrationConnector().getListenPort();
    }
    else
@@ -511,10 +508,9 @@
    // check if the initialization is required
    try
    {
      DirectoryServer.getInstance().getServerContext().getServerManagementContext()
        .getRootConfiguration().getAdministrationConnector();
      DirectoryServer.getInstance().getServerContext().getRootConfig().getAdministrationConnector();
    }
    catch (java.lang.Throwable th)
    catch (Throwable th)
    {
      try
      {
opendj-server-legacy/src/main/java/org/opends/server/config/AdministrationConnector.java
@@ -447,7 +447,7 @@
  {
    try
    {
      RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
      RootCfg root = serverContext.getRootConfig();
      AdministrationConnectorCfg config = root.getAdministrationConnector();
      // Check if certificate generation is needed
opendj-server-legacy/src/main/java/org/opends/server/core/AccessControlConfigManager.java
@@ -34,7 +34,6 @@
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.meta.AccessControlHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.AccessControlHandlerCfg;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.opends.server.api.AccessControlHandler;
import org.opends.server.api.AlertGenerator;
import org.forgerock.opendj.config.server.ConfigChangeResult;
@@ -145,14 +144,12 @@
         throws ConfigException, InitializationException
  {
    this.serverContext = serverContext;
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Don't register as an add and delete listener with the root configuration
    // as we can have only one object at a given time.
    // //Initialize the current Access control.
    AccessControlHandlerCfg accessControlConfiguration =
           rootConfiguration.getAccessControlHandler();
    // Initialize the current Access control.
    AccessControlHandlerCfg accessControlConfiguration = serverContext.getRootConfig().getAccessControlHandler();
    // We have a valid usable entry, so register a change listener in
    // order to handle configuration changes.
opendj-server-legacy/src/main/java/org/opends/server/core/AccountStatusNotificationHandlerConfigManager.java
@@ -91,11 +91,7 @@
  public void initializeNotificationHandlers()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so
    // we can be notified if any account status notification handler entry
    // is added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addAccountStatusNotificationHandlerAddListener (this);
    rootConfiguration.addAccountStatusNotificationHandlerDeleteListener (this);
opendj-server-legacy/src/main/java/org/opends/server/core/AlertHandlerConfigManager.java
@@ -86,11 +86,7 @@
  public void initializeAlertHandlers()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any alert handler entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addAlertHandlerAddListener(this);
    rootConfiguration.addAlertHandlerDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/AttributeSyntaxConfigManager.java
@@ -95,11 +95,7 @@
  public void initializeAttributeSyntaxes()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any attribute syntax entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addAttributeSyntaxAddListener(this);
    rootConfiguration.addAttributeSyntaxDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
@@ -91,12 +91,8 @@
  public void initializeBackendConfig()
         throws ConfigException, InitializationException
  {
    // Create an internal server management context and retrieve
    // the root configuration.
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    // Register add and delete listeners.
    RootCfg root = serverContext.getRootConfig();
    root.addBackendAddListener(this);
    root.addBackendDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/CertificateMapperConfigManager.java
@@ -91,11 +91,7 @@
  public void initializeCertificateMappers()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any certificate mapper entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addCertificateMapperAddListener(this);
    rootConfiguration.addCertificateMapperDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/ConnectionHandlerConfigManager.java
@@ -231,11 +231,8 @@
    initializeAdministrationConnectorConfig();
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener so that we can
    // be notified if new connection handlers are added or existing
    // connection handlers are removed.
    RootCfg root = serverContext.getRootConfig();
    root.addConnectionHandlerAddListener(this);
    root.addConnectionHandlerDeleteListener(this);
@@ -272,10 +269,8 @@
  private void initializeAdministrationConnectorConfig()
    throws ConfigException, InitializationException {
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    AdministrationConnectorCfg administrationConnectorCfg =
      root.getAdministrationConnector();
      serverContext.getRootConfig().getAdministrationConnector();
    AdministrationConnector ac = new AdministrationConnector(serverContext);
    ac.initializeAdministrationConnector(administrationConnectorCfg);
opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java
@@ -29,7 +29,6 @@
import org.forgerock.opendj.server.config.meta.GlobalCfgDefn.InvalidAttributeSyntaxBehavior;
import org.forgerock.opendj.server.config.meta.GlobalCfgDefn.SingleStructuralObjectclassBehavior;
import org.forgerock.opendj.server.config.server.GlobalCfg;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.opends.server.api.AuthenticationPolicy;
import org.opends.server.loggers.CommonAudit;
import org.opends.server.types.*;
@@ -74,17 +73,12 @@
  public void initializeCoreConfig()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Get the global configuration and register with it as a change listener.
    GlobalCfg globalConfig = rootConfiguration.getGlobalConfiguration();
    GlobalCfg globalConfig = serverContext.getRootConfig().getGlobalConfiguration();
    globalConfig.addChangeListener(this);
    // If there are any STMP servers specified, then make sure that if the value
    // contains a colon that the portion after it is an integer between 1 and
    // 65535.
    // contains a colon that the portion after it is an integer between 1 and 65535.
    Set<String> smtpServers = globalConfig.getSMTPServer();
    if (smtpServers != null)
    {
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -728,6 +728,12 @@
    }
    @Override
    public RootCfg getRootConfig()
    {
      return getServerManagementContext().getRootConfiguration();
    }
    @Override
    public MemoryQuota getMemoryQuota()
    {
      return directoryServer.memoryQuota;
@@ -1432,8 +1438,7 @@
  public void initializeCryptoManager()
         throws ConfigException, InitializationException
  {
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    CryptoManagerCfg cryptoManagerCfg = root.getCryptoManager();
    CryptoManagerCfg cryptoManagerCfg = serverContext.getRootConfig().getCryptoManager();
    cryptoManager = new CryptoManagerImpl(serverContext, cryptoManagerCfg);
  }
@@ -1596,13 +1601,11 @@
    backendConfigManager = new BackendConfigManager(serverContext);
    backendConfigManager.initializeBackendConfig();
    // Make sure to initialize the root DSE backend separately after all other
    // backends.
    // Make sure to initialize the root DSE backend separately after all other backends.
    RootDSEBackendCfg rootDSECfg;
    try
    {
      RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
      rootDSECfg = root.getRootDSEBackend();
      rootDSECfg = serverContext.getRootConfig().getRootDSEBackend();
    }
    catch (Exception e)
    {
@@ -1910,8 +1913,7 @@
         throws ConfigException, InitializationException {
  RootDSEBackendCfg rootDSECfg;
  try {
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    rootDSECfg = root.getRootDSEBackend();
    rootDSECfg = serverContext.getRootConfig().getRootDSEBackend();
  }  catch (Exception e) {
    logger.traceException(e);
    LocalizableMessage message = ERR_CANNOT_GET_ROOT_DSE_CONFIG_ENTRY.get(
opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java
@@ -125,14 +125,11 @@
  public void initializeEntryCache()
         throws ConfigException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Default entry cache should be already installed with
    // <CODE>initializeDefaultEntryCache()</CODE> method so
    // that there will be one even if we encounter a problem later.
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any entry cache entry is added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addEntryCacheAddListener(this);
    rootConfiguration.addEntryCacheDeleteListener(this);
@@ -461,8 +458,6 @@
    )
    throws InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Load the entry cache class...
    EntryCache<? extends EntryCacheCfg> entryCache =
      loadEntryCache (className, configuration, true);
@@ -481,9 +476,9 @@
        new EntryCacheMonitorProvider(configuration.dn().
            rdn().getFirstAVA().getAttributeValue().toString(), entryCache);
    try {
      RootCfg rootConfiguration = serverContext.getRootConfig();
      monitor.initializeMonitorProvider((EntryCacheMonitorProviderCfg)
        rootConfiguration.getMonitorProvider(
        DEFAULT_ENTRY_CACHE_MONITOR_PROVIDER));
        rootConfiguration.getMonitorProvider(DEFAULT_ENTRY_CACHE_MONITOR_PROVIDER));
    } catch (ConfigException ce) {
      // ConfigException here means that either the entry cache monitor
      // config entry is not present or the monitor is not enabled. In
opendj-server-legacy/src/main/java/org/opends/server/core/ExtendedOperationConfigManager.java
@@ -86,12 +86,7 @@
  public void initializeExtendedOperationHandlers()
         throws ConfigException, InitializationException
  {
    // Create an internal server management context and retrieve
    // the root configuration which has the extended operation handler relation.
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    // Register add and delete listeners.
    RootCfg root = serverContext.getRootConfig();
    root.addExtendedOperationHandlerAddListener(this);
    root.addExtendedOperationHandlerDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/GroupManager.java
@@ -172,11 +172,7 @@
  public void initializeGroupImplementations()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any group implementation entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addGroupImplementationAddListener(this);
    rootConfiguration.addGroupImplementationDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/IdentityMapperConfigManager.java
@@ -88,11 +88,7 @@
  public void initializeIdentityMappers()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any identity mapper entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addIdentityMapperAddListener(this);
    rootConfiguration.addIdentityMapperDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/KeyManagerProviderConfigManager.java
@@ -92,11 +92,7 @@
  public void initializeKeyManagerProviders()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any key manager provider entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addKeyManagerProviderAddListener(this);
    rootConfiguration.addKeyManagerProviderDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/LogRetentionPolicyConfigManager.java
@@ -73,9 +73,7 @@
   */
  public void initializeLogRetentionPolicyConfig() throws ConfigException, InitializationException
  {
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    RootCfg root = serverContext.getRootConfig();
    root.addLogRetentionPolicyAddListener(this);
    root.addLogRetentionPolicyDeleteListener(this);
@@ -83,13 +81,11 @@
    {
      LogRetentionPolicyCfg config = root.getLogRetentionPolicy(name);
      RetentionPolicy RetentionPolicy = getRetentionPolicy(config);
      RetentionPolicy<LogRetentionPolicyCfg> RetentionPolicy = getRetentionPolicy(config);
      DirectoryServer.registerRetentionPolicy(config.dn(), RetentionPolicy);
    }
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAddAcceptable(
      LogRetentionPolicyCfg configuration,
@@ -98,7 +94,6 @@
    return isJavaClassAcceptable(configuration, unacceptableReasons);
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationDeleteAcceptable(
      LogRetentionPolicyCfg configuration,
@@ -108,7 +103,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationAdd(LogRetentionPolicyCfg config)
  {
@@ -116,9 +110,8 @@
    try
    {
      RetentionPolicy RetentionPolicy = getRetentionPolicy(config);
      DirectoryServer.registerRetentionPolicy(config.dn(), RetentionPolicy);
      RetentionPolicy<LogRetentionPolicyCfg> retentionPolicy = getRetentionPolicy(config);
      DirectoryServer.registerRetentionPolicy(config.dn(), retentionPolicy);
    }
    catch (ConfigException e) {
      logger.traceException(e);
@@ -135,14 +128,13 @@
    return ccr;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationDelete(
      LogRetentionPolicyCfg config)
  {
    final ConfigChangeResult ccr = new ConfigChangeResult();
    RetentionPolicy policy = DirectoryServer.getRetentionPolicy(config.dn());
    RetentionPolicy<?> policy = DirectoryServer.getRetentionPolicy(config.dn());
    if(policy != null)
    {
      DirectoryServer.deregisterRetentionPolicy(config.dn());
@@ -156,7 +148,6 @@
    return ccr;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationChangeAcceptable(
      LogRetentionPolicyCfg configuration,
@@ -165,7 +156,6 @@
    return isJavaClassAcceptable(configuration, unacceptableReasons);
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationChange(
      LogRetentionPolicyCfg configuration)
@@ -193,7 +183,7 @@
      Class<? extends RetentionPolicy> theClass =
          pd.loadClass(className, RetentionPolicy.class);
      // Explicitly cast to check that implementation implements the correct interface.
      RetentionPolicy retentionPolicy = theClass.newInstance();
      RetentionPolicy<?> retentionPolicy = theClass.newInstance();
      // next line is here to ensure that eclipse does not remove the cast in the line above
      retentionPolicy.hashCode();
      return true;
@@ -204,7 +194,7 @@
    }
  }
  private RetentionPolicy getRetentionPolicy(LogRetentionPolicyCfg config)
  private RetentionPolicy<LogRetentionPolicyCfg> getRetentionPolicy(LogRetentionPolicyCfg config)
      throws ConfigException {
    String className = config.getJavaClass();
    LogRetentionPolicyCfgDefn d = LogRetentionPolicyCfgDefn.getInstance();
@@ -212,10 +202,8 @@
    try {
      Class<? extends RetentionPolicy> theClass =
          pd.loadClass(className, RetentionPolicy.class);
      RetentionPolicy retentionPolicy = theClass.newInstance();
      RetentionPolicy<LogRetentionPolicyCfg> retentionPolicy = theClass.newInstance();
      retentionPolicy.initializeLogRetentionPolicy(config);
      return retentionPolicy;
    } catch (Exception e) {
      LocalizableMessage message = ERR_CONFIG_RETENTION_POLICY_INVALID_CLASS.get(
@@ -224,4 +212,3 @@
    }
  }
}
opendj-server-legacy/src/main/java/org/opends/server/core/LogRotationPolicyConfigManager.java
@@ -72,23 +72,18 @@
   */
  public void initializeLogRotationPolicyConfig() throws ConfigException, InitializationException
  {
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    RootCfg root = serverContext.getRootConfig();
    root.addLogRotationPolicyAddListener(this);
    root.addLogRotationPolicyDeleteListener(this);
    for(String name : root.listLogRotationPolicies())
    {
      LogRotationPolicyCfg config = root.getLogRotationPolicy(name);
      RotationPolicy rotationPolicy = getRotationPolicy(config);
      RotationPolicy<LogRotationPolicyCfg> rotationPolicy = getRotationPolicy(config);
      DirectoryServer.registerRotationPolicy(config.dn(), rotationPolicy);
    }
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAddAcceptable(
      LogRotationPolicyCfg configuration,
@@ -97,7 +92,6 @@
    return isJavaClassAcceptable(configuration, unacceptableReasons);
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationDeleteAcceptable(
      LogRotationPolicyCfg configuration,
@@ -107,7 +101,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationAdd(LogRotationPolicyCfg config)
  {
@@ -115,8 +108,7 @@
    try
    {
      RotationPolicy rotationPolicy = getRotationPolicy(config);
      RotationPolicy<LogRotationPolicyCfg> rotationPolicy = getRotationPolicy(config);
      DirectoryServer.registerRotationPolicy(config.dn(), rotationPolicy);
    }
    catch (ConfigException e) {
@@ -134,14 +126,13 @@
    return ccr;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationDelete(
      LogRotationPolicyCfg config)
  {
    final ConfigChangeResult ccr = new ConfigChangeResult();
    RotationPolicy policy = DirectoryServer.getRotationPolicy(config.dn());
    RotationPolicy<?> policy = DirectoryServer.getRotationPolicy(config.dn());
    if(policy != null)
    {
      DirectoryServer.deregisterRotationPolicy(config.dn());
@@ -155,7 +146,6 @@
    return ccr;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationChangeAcceptable(
      LogRotationPolicyCfg configuration,
@@ -164,15 +154,13 @@
    return isJavaClassAcceptable(configuration, unacceptableReasons);
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationChange(
      LogRotationPolicyCfg configuration)
  {
    final ConfigChangeResult ccr = new ConfigChangeResult();
    RotationPolicy policy =
        DirectoryServer.getRotationPolicy(configuration.dn());
    RotationPolicy<?> policy = DirectoryServer.getRotationPolicy(configuration.dn());
    String className = configuration.getJavaClass();
    if(!className.equals(policy.getClass().getName()))
    {
@@ -192,7 +180,7 @@
      Class<? extends RotationPolicy> theClass =
          pd.loadClass(className, RotationPolicy.class);
      // Explicitly cast to check that implementation implements the correct interface.
      RotationPolicy retentionPolicy = theClass.newInstance();
      RotationPolicy<?> retentionPolicy = theClass.newInstance();
      // next line is here to ensure that eclipse does not remove the cast in the line above
      retentionPolicy.hashCode();
      return true;
@@ -203,7 +191,7 @@
    }
  }
  private RotationPolicy getRotationPolicy(LogRotationPolicyCfg config)
  private RotationPolicy<LogRotationPolicyCfg> getRotationPolicy(LogRotationPolicyCfg config)
      throws ConfigException {
    String className = config.getJavaClass();
    LogRotationPolicyCfgDefn d = LogRotationPolicyCfgDefn.getInstance();
@@ -211,10 +199,8 @@
    try {
      Class<? extends RotationPolicy> theClass =
          pd.loadClass(className, RotationPolicy.class);
      RotationPolicy rotationPolicy = theClass.newInstance();
      RotationPolicy<LogRotationPolicyCfg> rotationPolicy = theClass.newInstance();
      rotationPolicy.initializeLogRotationPolicy(config);
      return rotationPolicy;
    } catch (Exception e) {
      LocalizableMessage message = ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(
opendj-server-legacy/src/main/java/org/opends/server/core/LoggerConfigManager.java
@@ -174,11 +174,7 @@
   */
  public void initializeLoggerConfig() throws ConfigException, InitializationException
  {
    // Create an internal server management context and retrieve
    // the root configuration which has the log publisher relation.
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    RootCfg root = serverContext.getRootConfig();
    root.addLogPublisherAddListener(this);
    root.addLogPublisherDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java
@@ -96,11 +96,7 @@
  public void initializeMatchingRules()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any matching rule entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addMatchingRuleAddListener(this);
    rootConfiguration.addMatchingRuleDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/MonitorConfigManager.java
@@ -87,11 +87,7 @@
  public void initializeMonitorProviders()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any monitor provider entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addMonitorProviderAddListener(this);
    rootConfiguration.addMonitorProviderDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordGeneratorConfigManager.java
@@ -90,10 +90,7 @@
  public void initializePasswordGenerators()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any password generator entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addPasswordGeneratorAddListener(this);
    rootConfiguration.addPasswordGeneratorDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyConfigManager.java
@@ -65,8 +65,6 @@
    this.serverContext = serverContext;
  }
  /**
   * Initializes all authentication policies currently defined in the Directory
   * Server configuration. This should only be called at Directory Server
@@ -82,10 +80,7 @@
  public void initializeAuthenticationPolicies() throws ConfigException,
      InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any password policy entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addPasswordPolicyAddListener(this);
    rootConfiguration.addPasswordPolicyDeleteListener(this);
@@ -152,27 +147,19 @@
    DirectoryServer.getSubentryManager().registerChangeListener(this);
  }
  /**
   * Perform any required finalization tasks for all authentication policies
   * currently defined. This should only be called at Directory Server shutdown.
   */
  public void finalizeAuthenticationPolicies()
  {
    // Deregister this as subentry change listener with SubentryManager.
    DirectoryServer.getSubentryManager().deregisterChangeListener(this);
    // Deregister as configuration change listeners.
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.removePasswordPolicyAddListener(this);
    rootConfiguration.removePasswordPolicyDeleteListener(this);
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAddAcceptable(
      AuthenticationPolicyCfg configuration, List<LocalizableMessage> unacceptableReason)
@@ -183,9 +170,6 @@
        unacceptableReason);
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationAdd(AuthenticationPolicyCfg configuration)
  {
@@ -215,9 +199,6 @@
    return ccr;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationDeleteAcceptable(
      AuthenticationPolicyCfg configuration, List<LocalizableMessage> unacceptableReason)
@@ -235,9 +216,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationDelete(AuthenticationPolicyCfg configuration)
  {
@@ -259,9 +237,6 @@
    return ccr;
  }
  /** {@inheritDoc} */
  @Override
  public void checkSubentryAddAcceptable(Entry entry) throws DirectoryException
  {
@@ -271,9 +246,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void checkSubentryDeleteAcceptable(Entry entry)
      throws DirectoryException
@@ -283,9 +255,6 @@
    // either directly or via a virtual attribute).
  }
  /** {@inheritDoc} */
  @Override
  public void checkSubentryModifyAcceptable(Entry oldEntry, Entry newEntry)
      throws DirectoryException
@@ -296,9 +265,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void checkSubentryModifyDNAcceptable(Entry oldEntry, Entry newEntry)
      throws DirectoryException
@@ -308,9 +274,6 @@
    // either directly or via a virtual attribute).
  }
  /** {@inheritDoc} */
  @Override
  public void handleSubentryAdd(Entry entry)
  {
@@ -329,9 +292,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void handleSubentryDelete(Entry entry)
  {
@@ -341,9 +301,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void handleSubentryModify(Entry oldEntry, Entry newEntry)
  {
@@ -369,9 +326,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void handleSubentryModifyDN(Entry oldEntry, Entry newEntry)
  {
@@ -397,12 +351,7 @@
    }
  }
  /**
   * Creates and registers the provided authentication policy
   * configuration.
   */
  /** Creates and registers the provided authentication policy configuration. */
  private <T extends AuthenticationPolicyCfg> void createAuthenticationPolicy(
      T policyConfiguration) throws ConfigException, InitializationException
  {
@@ -454,8 +403,6 @@
    }
  }
  /**
   * Determines whether or not the new authentication policy configuration's
   * implementation class is acceptable.
@@ -497,5 +444,4 @@
      return false;
    }
  }
}
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordStorageSchemeConfigManager.java
@@ -87,10 +87,7 @@
  public void initializePasswordStorageSchemes()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any entry cache entry is added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addPasswordStorageSchemeAddListener (this);
    rootConfiguration.addPasswordStorageSchemeDeleteListener (this);
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordValidatorConfigManager.java
@@ -91,11 +91,7 @@
  public void initializePasswordValidators()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any password validator entries are added or removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addPasswordValidatorAddListener(this);
    rootConfiguration.addPasswordValidatorDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/PluginConfigManager.java
@@ -46,7 +46,6 @@
import org.forgerock.opendj.server.config.meta.PluginCfgDefn;
import org.forgerock.opendj.server.config.server.PluginCfg;
import org.forgerock.opendj.server.config.server.PluginRootCfg;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.InternalDirectoryServerPlugin;
@@ -293,11 +292,7 @@
  {
    registeredPlugins.clear();
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Get the plugin root configuration and register with it as an add and
    // delete listener so we can be notified if any plugin entries are added or removed.
    pluginRootConfig = rootConfiguration.getPluginRoot();
    pluginRootConfig = serverContext.getRootConfig().getPluginRoot();
    pluginRootConfig.addPluginAddListener(this);
    pluginRootConfig.addPluginDeleteListener(this);
  }
opendj-server-legacy/src/main/java/org/opends/server/core/RootDNConfigManager.java
@@ -15,6 +15,7 @@
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.core;
import static org.opends.messages.ConfigMessages.*;
import java.util.HashSet;
@@ -28,7 +29,6 @@
import org.forgerock.opendj.config.server.ConfigurationAddListener;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.config.server.ConfigurationDeleteListener;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.forgerock.opendj.server.config.server.RootDNCfg;
import org.forgerock.opendj.server.config.server.RootDNUserCfg;
import org.forgerock.opendj.config.server.ConfigChangeResult;
@@ -88,17 +88,11 @@
  public void initializeRootDNs()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Get the root DN configuration object, use it to set the default root
    // privileges, and register a change listener for it.
    RootDNCfg rootDNCfg = rootConfiguration.getRootDN();
    RootDNCfg rootDNCfg = serverContext.getRootConfig().getRootDN();
    rootPrivilegeChangeListener.setDefaultRootPrivileges(rootDNCfg);
    rootDNCfg.addChangeListener(rootPrivilegeChangeListener);
    // Register as an add and delete listener for new root DN users.
    rootDNCfg.addRootDNUserAddListener(this);
    rootDNCfg.addRootDNUserDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/SASLConfigManager.java
@@ -92,12 +92,7 @@
  public void initializeSASLMechanismHandlers()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any SASL mechanism handler entries are added or
    // removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addSASLMechanismHandlerAddListener(this);
    rootConfiguration.addSASLMechanismHandlerDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/SchemaHandler.java
@@ -96,7 +96,6 @@
  {
    this.serverContext = serverContext;
    final RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    final org.opends.server.types.Schema schema = serverContext.getSchema();
    schema.exclusiveLock();
@@ -106,7 +105,7 @@
      final SchemaBuilder schemaBuilder = new SchemaBuilder(Schema.getCoreSchema());
      // Take providers into account.
      loadSchemaFromProviders(rootConfiguration, schemaBuilder);
      loadSchemaFromProviders(serverContext.getRootConfig(), schemaBuilder);
      // Take schema files into account (TODO : or load files using provider mechanism ?)
      completeSchemaFromFiles(schemaBuilder);
opendj-server-legacy/src/main/java/org/opends/server/core/ServerContext.java
@@ -16,6 +16,7 @@
package org.opends.server.core;
import org.forgerock.opendj.config.server.ServerManagementContext;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.opends.server.extensions.DiskSpaceMonitor;
import org.opends.server.loggers.CommonAudit;
import org.opends.server.types.DirectoryEnvironmentConfig;
@@ -72,6 +73,15 @@
  ServerManagementContext getServerManagementContext();
  /**
   * Returns the root configuration object.
   * <p>
   * Equivalent to calling {@code getServerManagementContext().getRootConfiguration()}.
   *
   * @return the root configuration object
   */
  RootCfg getRootConfig();
  /**
   * Returns the memory quota system for reserving long term memory.
   *
   * @return the memory quota system
opendj-server-legacy/src/main/java/org/opends/server/core/SynchronizationProviderConfigManager.java
@@ -88,14 +88,7 @@
  public void initializeSynchronizationProviders()
         throws ConfigException, InitializationException
  {
    // Create an internal server management context and retrieve
    // the root configuration which has the synchronization provider relation.
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener so that we can
    // be notified when new synchronization providers are added or existing
    // synchronization providers are removed.
    RootCfg root = serverContext.getRootConfig();
    root.addSynchronizationProviderAddListener(this);
    root.addSynchronizationProviderDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/TrustManagerProviderConfigManager.java
@@ -92,12 +92,7 @@
  public void initializeTrustManagerProviders()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any trust manager provider entries are added or
    // removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addTrustManagerProviderAddListener(this);
    rootConfiguration.addTrustManagerProviderDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/VirtualAttributeConfigManager.java
@@ -99,12 +99,7 @@
  public void initializeVirtualAttributes()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Register as an add and delete listener with the root configuration so we
    // can be notified if any virtual attribute provider entries are added or
    // removed.
    RootCfg rootConfiguration = serverContext.getRootConfig();
    rootConfiguration.addVirtualAttributeAddListener(this);
    rootConfiguration.addVirtualAttributeDeleteListener(this);
opendj-server-legacy/src/main/java/org/opends/server/core/WorkQueueConfigManager.java
@@ -21,7 +21,6 @@
import org.forgerock.opendj.config.ClassPropertyDefinition;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.meta.WorkQueueCfgDefn;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.forgerock.opendj.server.config.server.WorkQueueCfg;
import org.opends.server.api.WorkQueue;
import org.forgerock.opendj.config.server.ConfigException;
@@ -69,12 +68,8 @@
  public WorkQueue initializeWorkQueue()
         throws ConfigException, InitializationException
  {
    RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration();
    // Get the work queue configuration and register with it as a change
    // listener.
    WorkQueueCfg workQueueConfig = rootConfiguration.getWorkQueue();
    // Get the work queue configuration and register with it as a change listener.
    WorkQueueCfg workQueueConfig = serverContext.getRootConfig().getWorkQueue();
    workQueueConfig.addChangeListener(this);
opendj-server-legacy/src/main/java/org/opends/server/loggers/CommonAudit.java
@@ -72,7 +72,6 @@
import org.forgerock.opendj.server.config.server.LogPublisherCfg;
import org.forgerock.opendj.server.config.server.LogRetentionPolicyCfg;
import org.forgerock.opendj.server.config.server.LogRotationPolicyCfg;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.forgerock.opendj.server.config.server.SizeLimitLogRetentionPolicyCfg;
import org.forgerock.opendj.server.config.server.SizeLimitLogRotationPolicyCfg;
import org.forgerock.opendj.server.config.server.TimeLimitLogRotationPolicyCfg;
@@ -511,7 +510,6 @@
  private void addCsvHandlerRotationConfig(PublisherConfig publisher, CsvConfigData config,
      CsvAuditEventHandlerConfiguration auditConfig) throws ConfigException
  {
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    SortedSet<String> rotationPolicies = config.getRotationPolicies();
    if (rotationPolicies.isEmpty())
    {
@@ -522,7 +520,7 @@
    fileRotation.setRotationEnabled(true);
    for (final String policy : rotationPolicies)
    {
      LogRotationPolicyCfg policyConfig = root.getLogRotationPolicy(policy);
      LogRotationPolicyCfg policyConfig = serverContext.getRootConfig().getLogRotationPolicy(policy);
      if (policyConfig instanceof FixedTimeLogRotationPolicyCfg)
      {
        List<String> times = convertTimesOfDay(publisher, (FixedTimeLogRotationPolicyCfg) policyConfig);
@@ -549,7 +547,6 @@
  private void addCsvHandlerRetentionConfig(PublisherConfig publisher, CsvConfigData config,
      CsvAuditEventHandlerConfiguration auditConfig) throws ConfigException
  {
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    SortedSet<String> retentionPolicies = config.getRetentionPolicies();
    if (retentionPolicies.isEmpty())
    {
@@ -559,7 +556,7 @@
    FileRetention fileRetention = new FileRetention();
    for (final String policy : retentionPolicies)
    {
      LogRetentionPolicyCfg policyConfig = root.getLogRetentionPolicy(policy);
      LogRetentionPolicyCfg policyConfig = serverContext.getRootConfig().getLogRetentionPolicy(policy);
      if (policyConfig instanceof FileCountLogRetentionPolicyCfg)
      {
        fileRetention.setMaxNumberOfHistoryFiles(((FileCountLogRetentionPolicyCfg) policyConfig).getNumberOfFiles());
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java
@@ -170,7 +170,7 @@
   */
  private static FractionalConfig getStaticReplicationDomainFractionalConfig(ServerContext serverContext,
        Entry entry) throws Exception {
    RootCfg root = serverContext.getServerManagementContext().getRootConfiguration();
    RootCfg root = serverContext.getRootConfig();
    ReplicationSynchronizationProviderCfg sync =
      (ReplicationSynchronizationProviderCfg)
      root.getSynchronizationProvider("Multimaster Synchronization");
opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java
@@ -23,14 +23,13 @@
import java.util.List;
import java.util.Map;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.adapter.server3x.Converters;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.forgerock.opendj.config.server.ServerManagementContext;
import org.forgerock.opendj.server.config.server.BackendCfg;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.opends.server.api.Backend;
@@ -150,10 +149,9 @@
   */
  public static BackendCfg getConfigEntry(Backend<?> backend)
  {
    RootCfg root = getServerManagementContext().getRootConfiguration();
    try
    {
      return root.getBackend(backend.getBackendID());
      return getRootConfig().getBackend(backend.getBackendID());
    }
    catch (ConfigException e)
    {
@@ -161,9 +159,9 @@
    }
  }
  private static ServerManagementContext getServerManagementContext()
  private static RootCfg getRootConfig()
  {
    return DirectoryServer.getInstance().getServerContext().getServerManagementContext();
    return DirectoryServer.getInstance().getServerContext().getRootConfig();
  }
  /**
@@ -176,29 +174,7 @@
  public static void enableBackend(String backendID)
       throws DirectoryException
  {
    DN configEntryDN;
    RootCfg root = getServerManagementContext().getRootConfiguration();
    try
    {
      BackendCfg cfg = root.getBackend(backendID);
      configEntryDN = cfg.dn();
    }
    catch (ConfigException e)
    {
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                   e.getMessageObject(), e);
    }
    ModifyRequest modifyRequest = newModifyRequest(configEntryDN)
        .addModification(REPLACE, ATTR_BACKEND_ENABLED, TRUE_VALUE);
    ModifyOperation internalModify = getRootConnection().processModify(modifyRequest);
    ResultCode resultCode = internalModify.getResultCode();
    if (resultCode != ResultCode.SUCCESS)
    {
      LocalizableMessage message = ERR_TASK_CANNOT_ENABLE_BACKEND.get(configEntryDN);
      throw new DirectoryException(resultCode, message);
    }
    enableBackend(backendID, TRUE_VALUE, ERR_TASK_CANNOT_ENABLE_BACKEND);
  }
@@ -212,28 +188,29 @@
   */
  public static void disableBackend(String backendID) throws DirectoryException
  {
    enableBackend(backendID, FALSE_VALUE, ERR_TASK_CANNOT_DISABLE_BACKEND);
  }
  private static void enableBackend(String backendID, ByteString enableValue, Arg1<Object> errorMsg)
        throws DirectoryException {
    DN configEntryDN;
    RootCfg root = getServerManagementContext().getRootConfiguration();
    try
    {
      BackendCfg cfg = root.getBackend(backendID);
      configEntryDN = cfg.dn();
      configEntryDN = getRootConfig().getBackend(backendID).dn();
    }
    catch (ConfigException e)
    {
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                   e.getMessageObject(), e);
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), e.getMessageObject(), e);
    }
    ModifyRequest modifyRequest = newModifyRequest(configEntryDN)
        .addModification(REPLACE, ATTR_BACKEND_ENABLED, FALSE_VALUE);
    ModifyOperation internalModify = getRootConnection().processModify(modifyRequest);
        .addModification(REPLACE, ATTR_BACKEND_ENABLED, enableValue);
    ModifyOperation modifyOp = getRootConnection().processModify(modifyRequest);
    ResultCode resultCode = internalModify.getResultCode();
    ResultCode resultCode = modifyOp.getResultCode();
    if (resultCode != ResultCode.SUCCESS)
    {
      LocalizableMessage message = ERR_TASK_CANNOT_DISABLE_BACKEND.get(configEntryDN);
      throw new DirectoryException(resultCode, message);
      throw new DirectoryException(resultCode, errorMsg.get(configEntryDN));
    }
  }
opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
@@ -66,8 +66,7 @@
    try
    {
      // Iterate through the immediate children, attempting to parse them as backends.
      final RootCfg root =
          DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration();
      final RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig();
      ConfigurationHandler configHandler = DirectoryServer.getConfigurationHandler();
      final DN backendBaseDN = getBackendBaseDN();
      for (final DN childrenDn : configHandler.getChildren(backendBaseDN))
opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
@@ -308,8 +308,6 @@
      final DN rootDN = parseRootDN();
      final String rootPW = parseRootDNPassword();
      // Get the Directory Server configuration handler and use it to make the
      // appropriate configuration changes.
      configHandler = DirectoryServer.getConfigurationHandler();
      checkManagerProvider(keyManagerProviderDN, JCKES_KEY_MANAGER_DN, JCKES_KEY_MANAGER_LDIF_ENTRY, true);
opendj-server-legacy/src/main/java/org/opends/server/tools/EncodePassword.java
@@ -701,7 +701,6 @@
  throws InitializationException, ConfigException {
    directoryServer.initializeRootDSE();
    RootCfg root = directoryServer.getServerContext().getServerManagementContext().getRootConfiguration();
    Entry backendRoot;
    try {
      DN configEntryDN = DN.valueOf(ConfigConstants.DN_BACKEND_BASE);
@@ -715,6 +714,8 @@
      LocalizableMessage message = ERR_CONFIG_BACKEND_BASE_DOES_NOT_EXIST.get();
      throw new ConfigException(message);
    }
    RootCfg root = directoryServer.getServerContext().getRootConfig();
    for (String name : root.listBackends()) {
      BackendCfg backendCfg = root.getBackend(name);
      String backendID = backendCfg.getBackendId();
opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java
@@ -78,12 +78,12 @@
   * Ensure that configuration is fully bootstrapped. Only use when necessary as
   * it will impact test performance.
   */
  public ServerContextBuilder withConfigurationBootstrapped()
      throws InitializationException
  public ServerContextBuilder withConfigurationBootstrapped() throws InitializationException
  {
    final ConfigurationHandler configHandler = ConfigurationHandler.bootstrapConfiguration(serverContext);
    final ServerManagementContext serverManagementContext = new ServerManagementContext(configHandler);
    when(serverContext.getServerManagementContext()).thenReturn(serverManagementContext);
    when(serverContext.getRootConfig()).thenReturn(serverManagementContext.getRootConfiguration());
    return this;
  }
opendj-server-legacy/src/test/java/org/opends/server/tools/ImportLDIFTestCase.java
@@ -462,8 +462,7 @@
  {
    try
    {
      final RootCfg root =
          DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration();
      final RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig();
      final String errorMsg = "Unexpected content in reject file:\n\n" + readFile(reject)
          + "\n\nThe backend was configured with the following base DNs: "
          + root.getBackend(beID).getBaseDN() + "\n\n";