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

Jean-Noël Rouvignac
04.53.2016 85f51e5a07aa823b2b363304007ed812c73ecc59
Changed Backend.getBaseDNs() return type from DN[] to Set<DN>

Removed code that how now become useless.

We are using a lot Set.iterator().next(). Using SortedSet instead of Set could help.
But this would require more custom code or using TreeSet which may be overkill here.
22 files modified
465 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java 17 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java 39 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/MemoryBackend.java 38 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java 13 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java 32 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java 30 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java 45 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java 62 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java 30 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java 27 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationBackend.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/monitors/BackendMonitor.java 23 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java 1 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java 4 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java 51 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/GenericBackendTestCase.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
@@ -31,6 +31,7 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.config.Configuration;
import org.opends.server.backends.RebuildConfig;
@@ -45,7 +46,6 @@
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
import org.opends.server.monitors.BackendMonitor;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.CanceledOperationException;
@@ -198,7 +198,7 @@
   * @return  The set of base-level DNs that may be used within this
   *          backend.
   */
  public abstract DN[] getBaseDNs();
  public abstract Set<DN> getBaseDNs();
  /**
   * Indicates whether search operations which target the specified
opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
@@ -42,6 +42,8 @@
import org.forgerock.opendj.ldap.AVA;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.RDN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
@@ -61,7 +63,6 @@
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.BackupInfo;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.IndexType;
@@ -70,7 +71,6 @@
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.LDIFImportResult;
import org.opends.server.types.ObjectClass;
import org.forgerock.opendj.ldap.RDN;
import org.opends.server.types.RestoreConfig;
import org.opends.server.types.SearchFilter;
@@ -97,7 +97,7 @@
  private DN backupBaseDN;
  /** The set of base DNs for this backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /** The backup base entry. */
  private Entry backupBaseEntry;
@@ -208,8 +208,7 @@
      throw new InitializationException(message, e);
    }
    // FIXME -- Deal with this more correctly.
    this.baseDNs = new DN[] { backupBaseDN };
    this.baseDNs = Collections.singleton(backupBaseDN);
    // Determine the set of backup directories that we will use by default.
@@ -276,18 +275,12 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
  /** {@inheritDoc} */
  @Override
  public long getEntryCount()
  {
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
@@ -198,7 +198,7 @@
  public static final DN CHANGELOG_BASE_DN = DN.valueOf(DN_EXTERNAL_CHANGELOG_ROOT);
  /** The set of base DNs for this backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /** The set of supported controls for this backend. */
  private final Set<String> supportedControls = Collections.singleton(OID_ECL_COOKIE_EXCHANGE_CONTROL);
  /** Whether the base changelog entry has subordinates. */
@@ -257,7 +257,7 @@
  @Override
  public void openBackend() throws InitializationException
  {
    baseDNs = new DN[] { CHANGELOG_BASE_DN };
    baseDNs = Collections.singleton(CHANGELOG_BASE_DN);
    try
    {
@@ -284,7 +284,7 @@
  }
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java
@@ -22,7 +22,6 @@
import static org.opends.server.util.StaticUtils.*;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -88,14 +87,11 @@
  /** The base DNs for this backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /** The mapping between parent DNs and their immediate children. */
  private final Map<DN, Set<DN>> childDNs = new HashMap<>();
  /** The base DNs for this backend, in a hash set. */
  private Set<DN> baseDNSet;
  /** The set of supported controls for this backend. */
  private final Set<String> supportedControls =
      Collections.singleton(OID_SUBTREE_DELETE_CONTROL);
@@ -126,11 +122,10 @@
  public void openBackend()
         throws ConfigException, InitializationException
  {
    // We won't support anything other than exactly one base DN in this
    // implementation.  If we were to add such support in the future, we would
    // likely want to separate the data for each base DN into a separate entry
    // map.
    if (baseDNs == null || baseDNs.length != 1)
    // We won't support anything other than exactly one base DN in this implementation.
    // If we were to add such support in the future, we would likely want
    // to separate the data for each base DN into a separate entry map.
    if (baseDNs == null || baseDNs.size() != 1)
    {
      throw new ConfigException(ERR_LDIF_BACKEND_MULTIPLE_BASE_DNS.get(currentConfig.dn()));
    }
@@ -366,14 +361,12 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
  /** {@inheritDoc} */
  @Override
  public long getEntryCount()
  {
@@ -450,10 +443,10 @@
  public long getNumberOfEntriesInBaseDN(DN baseDN) throws DirectoryException
  {
    checkNotNull(baseDN, "baseDN must not be null");
    if (!Arrays.asList(baseDNs).contains(baseDN))
    if (!baseDNs.contains(baseDN))
    {
      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, ERR_LDIF_BACKEND_NUM_SUBORDINATES_NO_SUCH_ENTRY
          .get(baseDN));
      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
          ERR_LDIF_BACKEND_NUM_SUBORDINATES_NO_SUCH_ENTRY.get(baseDN));
    }
    final int baseDNIfExists = childDNs.containsKey(baseDN) ? 1 : 0;
    return getNumberOfSubordinates(baseDN, true) + baseDNIfExists;
@@ -547,7 +540,7 @@
        throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, m);
      }
      if (baseDNSet.contains(entryDN))
      if (baseDNs.contains(entryDN))
      {
        entryMap.put(entryDN, entry.duplicate(false));
        writeLDIF();
@@ -1136,7 +1129,7 @@
          // If the entry DN is a base DN, then add it with no more processing.
          if (baseDNSet.contains(entryDN))
          if (baseDNs.contains(entryDN))
          {
            entryMap.put(entryDN, e);
            continue;
@@ -1256,16 +1249,12 @@
      currentConfig = config;
      currentConfig.addLDIFChangeListener(this);
      baseDNs = new DN[currentConfig.getBaseDN().size()];
      currentConfig.getBaseDN().toArray(baseDNs);
      if (baseDNs.length != 1)
      baseDNs = currentConfig.getBaseDN();
      if (baseDNs.size() != 1)
      {
        throw new ConfigException(ERR_LDIF_BACKEND_MULTIPLE_BASE_DNS.get(currentConfig.dn()));
      }
      baseDNSet = new HashSet<>();
      Collections.addAll(baseDNSet, baseDNs);
      ldifFilePath = currentConfig.getLDIFFile();
    }
  }
@@ -1308,7 +1297,7 @@
      }
    }
    if (baseDNSet != null && !baseDNSet.equals(configuration.getBaseDN()))
    if (baseDNs != null && !baseDNs.equals(configuration.getBaseDN()))
    {
      ccr.addMessage(INFO_LDIF_BACKEND_BASE_DN_CHANGED.get());
      ccr.setAdminActionRequired(true);
opendj-server-legacy/src/main/java/org/opends/server/backends/MemoryBackend.java
@@ -58,6 +58,7 @@
import org.opends.server.types.LDIFImportResult;
import org.opends.server.types.RestoreConfig;
import org.opends.server.types.SearchFilter;
import org.opends.server.util.CollectionUtils;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
@@ -97,14 +98,11 @@
  /** The base DNs for this backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /** The mapping between parent DNs and their immediate children. */
  private HashMap<DN,HashSet<DN>> childDNs;
  /** The base DNs for this backend, in a hash set. */
  private HashSet<DN> baseDNSet;
  /** The set of supported controls for this backend. */
  private final Set<String> supportedControls =
      Collections.singleton(OID_SUBTREE_DELETE_CONTROL);
@@ -133,42 +131,32 @@
   * object when initializing the backend.
   * @param baseDNs The set of base DNs to be served by this memory backend.
   */
  public void setBaseDNs(DN[] baseDNs)
  public void setBaseDNs(DN... baseDNs)
  {
    this.baseDNs = baseDNs;
    this.baseDNs = CollectionUtils.newHashSet(baseDNs);
  }
  /** {@inheritDoc} */
  @Override
  public void configureBackend(MemoryBackendCfg config, ServerContext serverContext) throws ConfigException
  {
    if (config != null)
    {
      MemoryBackendCfg cfg = config;
      DN[] baseDNs = new DN[cfg.getBaseDN().size()];
      cfg.getBaseDN().toArray(baseDNs);
      setBaseDNs(baseDNs);
      this.baseDNs = config.getBaseDN();
    }
  }
  /** {@inheritDoc} */
  @Override
  public synchronized void openBackend()
       throws ConfigException, InitializationException
  {
    // We won't support anything other than exactly one base DN in this
    // implementation.  If we were to add such support in the future, we would
    // likely want to separate the data for each base DN into a separate entry
    // map.
    if (baseDNs == null || baseDNs.length != 1)
    // We won't support anything other than exactly one base DN in this implementation.
    // If we were to add such support in the future, we would likely want
    // to separate the data for each base DN into a separate entry map.
    if (baseDNs == null || baseDNs.size() != 1)
    {
      LocalizableMessage message = ERR_MEMORYBACKEND_REQUIRE_EXACTLY_ONE_BASE.get();
      throw new ConfigException(message);
      throw new ConfigException(ERR_MEMORYBACKEND_REQUIRE_EXACTLY_ONE_BASE.get());
    }
    baseDNSet = new HashSet<>();
    Collections.addAll(baseDNSet, baseDNs);
    entryMap = new LinkedHashMap<>();
    childDNs = new HashMap<>();
@@ -219,14 +207,12 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
  /** {@inheritDoc} */
  @Override
  public synchronized long getEntryCount()
  {
@@ -337,7 +323,7 @@
    // If the entry is one of the base DNs, then add it.
    if (baseDNSet.contains(entryDN))
    if (baseDNs.contains(entryDN))
    {
      entryMap.put(entryDN, e);
      return;
opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java
@@ -39,6 +39,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.ldap.AVA;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
@@ -47,9 +48,8 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.util.Reject;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.server.MonitorBackendCfg;
import org.forgerock.util.Reject;
import org.opends.server.api.Backend;
import org.opends.server.api.MonitorData;
import org.opends.server.api.MonitorProvider;
@@ -100,7 +100,7 @@
  /** The DN for the base monitor entry. */
  private DN baseMonitorDN;
  /** The set of base DNs for this backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /**
   * Creates a new backend with the provided information. All backend
@@ -216,8 +216,7 @@
      throw new ConfigException(message, e);
    }
    // FIXME -- Deal with this more correctly.
    this.baseDNs = new DN[] { baseMonitorDN };
    this.baseDNs = Collections.singleton(baseMonitorDN);
    currentConfig = cfg;
  }
@@ -330,14 +329,12 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
  /** {@inheritDoc} */
  @Override
  public Entry getEntry(final DN entryDN) throws DirectoryException
  {
opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
@@ -22,7 +22,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -30,8 +29,10 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.server.BackendCfg;
import org.opends.server.api.Backend;
import org.opends.server.controls.PagedResultsControl;
@@ -42,10 +43,8 @@
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.IndexType;
@@ -89,10 +88,7 @@
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /** The base DNs for this backend. */
  private DN[] baseDNs;
  /** The base DNs for this backend, in a hash set. */
  private HashSet<DN> baseDNSet;
  private Set<DN> baseDNs;
  /** The set of supported controls for this backend. */
  private final Set<String> supportedControls = CollectionUtils.newHashSet(
@@ -117,34 +113,18 @@
    // Perform all initialization in initializeBackend.
  }
  /**
   * Set the base DNs for this backend.  This is used by the unit tests
   * to set the base DNs without having to provide a configuration
   * object when initializing the backend.
   * @param baseDNs The set of base DNs to be served by this memory backend.
   */
  public void setBaseDNs(DN[] baseDNs)
  {
    this.baseDNs = baseDNs;
  }
  @Override
  public void configureBackend(BackendCfg config, ServerContext serverContext) throws ConfigException
  {
    if (config != null)
    {
      BackendCfg cfg = config;
      setBaseDNs(cfg.getBaseDN().toArray(new DN[cfg.getBaseDN().size()]));
      this.baseDNs = config.getBaseDN();
    }
  }
  @Override
  public synchronized void openBackend() throws ConfigException, InitializationException
  {
    baseDNSet = new HashSet<>();
    Collections.addAll(baseDNSet, baseDNs);
    // Register base DNs.
    for (DN dn : baseDNs)
    {
      try
@@ -207,7 +187,7 @@
  }
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
@@ -293,7 +273,7 @@
    }
    if (SearchScope.BASE_OBJECT.equals(searchOperation.getScope())
        && baseDNSet.contains(searchOperation.getBaseDN()))
        && baseDNs.contains(searchOperation.getBaseDN()))
    {
      searchOperation.setResultCode(ResultCode.NO_SUCH_OBJECT);
    }
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
@@ -42,16 +42,16 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.server.RootDSEBackendCfg;
import org.forgerock.util.Reject;
import org.forgerock.util.Utils;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.server.RootDSEBackendCfg;
import org.opends.server.api.Backend;
import org.opends.server.api.ClientConnection;
import org.opends.server.types.Entry;
import org.opends.server.core.AddOperation;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
@@ -59,8 +59,22 @@
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.opends.server.types.Attributes;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.CanceledOperationException;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.IndexType;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.LDIFImportResult;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.RestoreConfig;
import org.opends.server.types.SearchFilter;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.LDIFWriter;
@@ -106,7 +120,7 @@
  /** The DN for the root DSE. */
  private DN rootDSEDN;
  /** The set of base DNs for this backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /**
   * The set of subordinate base DNs and their associated backends that will be
   * used for non-base searches.
@@ -155,7 +169,7 @@
    // Create the set of base DNs that we will handle.  In this case, it's just
    // the root DSE.
    rootDSEDN    = DN.rootDN();
    this.baseDNs = new DN[] { rootDSEDN };
    baseDNs = Collections.singleton(rootDSEDN);
    // Create the set of subordinate base DNs.  If this is specified in the
@@ -290,7 +304,7 @@
  }
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -186,7 +186,7 @@
  private SchemaBackendCfg currentConfig;
  /** The set of base DNs for this backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /** The set of objectclasses that will be used in the schema entry. */
  private HashMap<ObjectClass,String> schemaObjectClasses;
@@ -223,8 +223,7 @@
    // not be able to complete initialization.
    if (cfg == null)
    {
      LocalizableMessage message = ERR_SCHEMA_CONFIG_ENTRY_NULL.get();
      throw new ConfigException(message);
      throw new ConfigException(ERR_SCHEMA_CONFIG_ENTRY_NULL.get());
    }
    Entry configEntry = DirectoryServer.getConfigEntry(cfg.dn());
@@ -259,13 +258,11 @@
    configEntryDN = configEntry.getName();
    baseDNs = cfg.getBaseDN();
    DN[] newBaseDNs = new DN[cfg.getBaseDN().size()];
    cfg.getBaseDN().toArray(newBaseDNs);
    this.baseDNs = newBaseDNs;
    creatorsName  = ByteString.valueOfUtf8(newBaseDNs[0].toString());
    modifiersName = ByteString.valueOfUtf8(newBaseDNs[0].toString());
    ByteString newBaseDN = ByteString.valueOfUtf8(baseDNs.iterator().next().toString());
    creatorsName = newBaseDN;
    modifiersName = newBaseDN;
    long createTime = DirectoryServer.getSchema().getOldestModificationTime();
    createTimestamp =
@@ -308,7 +305,7 @@
  {
    // Register each of the suffixes with the Directory Server.  Also, register
    // the first one as the schema base.
    DirectoryServer.setSchemaDN(baseDNs[0]);
    DirectoryServer.setSchemaDN(baseDNs.iterator().next());
    for (DN baseDN : baseDNs) {
      try {
        DirectoryServer.registerBaseDN(baseDN, this, true);
@@ -472,7 +469,7 @@
  }
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
@@ -717,15 +714,7 @@
  public boolean entryExists(DN entryDN) throws DirectoryException
  {
    // The specified DN must be one of the specified schema DNs.
    DN[] baseArray = baseDNs;
    for (DN baseDN : baseArray)
    {
      if (entryDN.equals(baseDN))
      {
        return true;
      }
    }
    return false;
    return baseDNs.contains(entryDN);
  }
  @Override
@@ -3321,9 +3310,8 @@
    DN baseDN = searchOperation.getBaseDN();
    boolean found = false;
    DN[] dnArray = baseDNs;
    DN matchedDN = null;
    for (DN dn : dnArray)
    for (DN dn : this.baseDNs)
    {
      if (dn.equals(baseDN))
      {
@@ -3402,7 +3390,7 @@
    // writer when we're done.
    try
    {
      ldifWriter.writeEntry(getSchemaEntry(baseDNs[0], true, true));
      ldifWriter.writeEntry(getSchemaEntry(baseDNs.iterator().next(), true, true));
    }
    catch (Exception e)
    {
@@ -3768,16 +3756,11 @@
    if (ccr.getResultCode() == ResultCode.SUCCESS)
    {
      // Get an array containing the new base DNs to use.
      DN[] dnArray = new DN[newBaseDNs.size()];
      newBaseDNs.toArray(dnArray);
      // Determine the set of DNs to add and delete.  When this is done, the
      // deleteBaseDNs will contain the set of DNs that should no longer be used
      // and should be deregistered from the server, and the newBaseDNs set will
      // just contain the set of DNs to add.
      Set<DN> deleteBaseDNs = new HashSet<>(baseDNs.length);
      Set<DN> deleteBaseDNs = new HashSet<>(baseDNs.size());
      for (DN baseDN : baseDNs)
      {
        if (! newBaseDNs.remove(baseDN))
@@ -3802,8 +3785,8 @@
        }
      }
      baseDNs = dnArray;
      for (DN dn : newBaseDNs)
      baseDNs = newBaseDNs;
      for (DN dn : baseDNs)
      {
        try
        {
opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
@@ -53,6 +53,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.ldap.AVA;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
@@ -61,9 +62,8 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.util.Reject;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.server.TrustStoreBackendCfg;
import org.forgerock.util.Reject;
import org.opends.server.api.Backend;
import org.opends.server.core.AddOperation;
import org.opends.server.core.DeleteOperation;
@@ -106,11 +106,8 @@
  /** The current configuration state. */
  private TrustStoreBackendCfg configuration;
  /** The DN for the base entry. */
  private DN baseDN;
  /** The set of base DNs for this backend. */
  private DN[] baseDNs;
  private SortedSet<DN> baseDNs;
  /** The base entry. */
  private Entry baseEntry;
@@ -141,7 +138,11 @@
    // Perform all initialization in initializeBackend.
  }
  /** {@inheritDoc} */
  private DN getBaseDN()
  {
    return baseDNs.first();
  }
  @Override
  public void configureBackend(TrustStoreBackendCfg config, ServerContext serverContext) throws ConfigException
  {
@@ -149,7 +150,6 @@
    configuration = config;
  }
  /** {@inheritDoc} */
  @Override
  public void openBackend() throws ConfigException, InitializationException
  {
@@ -162,15 +162,12 @@
    {
      throw new InitializationException(ERR_TRUSTSTORE_REQUIRES_ONE_BASE_DN.get(configEntryDN));
    }
    baseDN = baseDNSet.first();
    baseDNs = new DN[] {baseDN};
    baseDNs = baseDNSet;
    // Get the path to the trust store file.
    trustStoreFile = configuration.getTrustStoreFile();
    // Get the trust store type.  If none is specified, then use the default
    // type.
    // Get the trust store type. If none is specified, then use the default type.
    trustStoreType = configuration.getTrustStoreType();
    if (trustStoreType == null)
    {
@@ -308,13 +305,13 @@
    objectClasses.put(branchOC, "ds-cfg-branch");
    LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(1);
    for (AVA ava : baseDN.rdn())
    for (AVA ava : getBaseDN().rdn())
    {
      AttributeType attrType = ava.getAttributeType();
      userAttrs.put(attrType, Attributes.createAsList(attrType, ava.getAttributeValue()));
    }
    baseEntry = new Entry(baseDN, objectClasses, userAttrs, null);
    baseEntry = new Entry(getBaseDN(), objectClasses, userAttrs, null);
    // Register this as a change listener.
    configuration.addTrustStoreChangeListener(this);
@@ -323,12 +320,12 @@
    // Register the trust store base as a private suffix.
    try
    {
      DirectoryServer.registerBaseDN(baseDN, this, true);
      DirectoryServer.registerBaseDN(getBaseDN(), this, true);
    }
    catch (Exception e)
    {
      logger.traceException(e);
      throw new InitializationException(ERR_BACKEND_CANNOT_REGISTER_BASEDN.get(baseDN, e), e);
      throw new InitializationException(ERR_BACKEND_CANNOT_REGISTER_BASEDN.get(getBaseDN(), e), e);
    }
  }
@@ -340,7 +337,7 @@
    try
    {
      DirectoryServer.deregisterBaseDN(baseDN);
      DirectoryServer.deregisterBaseDN(getBaseDN());
    }
    catch (Exception e)
    {
@@ -348,14 +345,12 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
  /** {@inheritDoc} */
  @Override
  public long getEntryCount()
  {
@@ -398,7 +393,7 @@
    // If the requested entry was the backend base entry, then retrieve it.
    if (entryDN.equals(baseDN))
    if (entryDN.equals(getBaseDN()))
    {
      return baseEntry.duplicate(true);
    }
@@ -407,7 +402,7 @@
    // See if the requested entry was one level below the backend base entry.
    // If so, then it must point to a trust store entry.
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN != null && parentDN.equals(baseDN))
    if (parentDN != null && parentDN.equals(getBaseDN()))
    {
      try
      {
@@ -444,7 +439,7 @@
    if (v == null)
    {
      LocalizableMessage message = ERR_TRUSTSTORE_DN_DOES_NOT_SPECIFY_CERTIFICATE.get(entryDN);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, baseDN, null);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, getBaseDN(), null);
    }
    String certAlias = v.toString();
@@ -501,7 +496,7 @@
  {
    DN entryDN = entry.getName();
    if (entryDN.equals(baseDN))
    if (entryDN.equals(getBaseDN()))
    {
      LocalizableMessage message = ERR_TRUSTSTORE_INVALID_BASE.get(entryDN);
      throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, message);
@@ -514,7 +509,7 @@
      throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message);
    }
    if (parentDN.equals(baseDN))
    if (parentDN.equals(getBaseDN()))
    {
      addCertificate(entry);
    }
@@ -530,14 +525,14 @@
  public void deleteEntry(DN entryDN, DeleteOperation deleteOperation)
         throws DirectoryException
  {
    if (entryDN.equals(baseDN))
    if (entryDN.equals(getBaseDN()))
    {
      LocalizableMessage message = ERR_TRUSTSTORE_INVALID_BASE.get(entryDN);
      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
    }
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null || !parentDN.equals(baseDN))
    if (parentDN == null || !parentDN.equals(getBaseDN()))
    {
      LocalizableMessage message = ERR_TRUSTSTORE_INVALID_BASE.get(entryDN);
      throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message);
@@ -580,7 +575,7 @@
    // trust store entry DN.
    SearchScope  scope  = searchOperation.getScope();
    SearchFilter filter = searchOperation.getFilter();
    if (this.baseDN.equals(baseDN))
    if (getBaseDN().equals(baseDN))
    {
      if ((scope == SearchScope.BASE_OBJECT || scope == SearchScope.WHOLE_SUBTREE)
          && filter.matchesEntry(baseEntry))
@@ -608,7 +603,7 @@
        AttributeType certAliasType = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID);
        for (String alias : aliases)
        {
          DN certDN = makeChildDN(this.baseDN, certAliasType, alias);
          DN certDN = makeChildDN(this.getBaseDN(), certAliasType, alias);
          Entry certEntry;
          try
@@ -628,7 +623,7 @@
        }
      }
    }
    else if (this.baseDN.equals(DirectoryServer.getParentDNInSuffix(baseDN)))
    else if (this.getBaseDN().equals(DirectoryServer.getParentDNInSuffix(baseDN)))
    {
      Entry certEntry = getCertEntry(baseDN);
@@ -1193,7 +1188,7 @@
    if (v == null)
    {
      LocalizableMessage message = ERR_TRUSTSTORE_DN_DOES_NOT_SPECIFY_CERTIFICATE.get(entryDN);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, baseDN, null);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, getBaseDN(), null);
    }
    String certAlias = v.toString();
@@ -1320,7 +1315,7 @@
    if (v == null)
    {
      LocalizableMessage message = ERR_TRUSTSTORE_DN_DOES_NOT_SPECIFY_CERTIFICATE.get(entryDN);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, baseDN, null);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, getBaseDN(), null);
    }
    String certAlias = v.toString();
@@ -1490,4 +1485,3 @@
    }
  }
}
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
@@ -34,11 +35,13 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.util.Reject;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.server.PluggableBackendCfg;
import org.forgerock.util.Reject;
import org.opends.server.api.Backend;
import org.opends.server.api.MonitorProvider;
import org.opends.server.backends.RebuildConfig;
@@ -56,11 +59,9 @@
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.CanceledOperationException;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.IndexType;
@@ -98,7 +99,7 @@
  /** A count of the total operation threads currently in the backend. */
  private final AtomicInteger threadTotalCount = new AtomicInteger(0);
  /** The base DNs defined for this backend instance. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  private MonitorProvider<?> rootContainerMonitor;
@@ -170,7 +171,7 @@
    this.cfg = cfg;
    this.serverContext = serverContext;
    baseDNs = this.cfg.getBaseDN().toArray(new DN[0]);
    baseDNs = new HashSet<>(cfg.getBaseDN());
    storage = new TracedStorage(configureStorage(cfg, serverContext), cfg.getBackendId());
  }
@@ -262,13 +263,12 @@
    logger.info(NOTE_BACKEND_OFFLINE, cfg.getBackendId());
  }
  /** {@inheritDoc} */
  @Override
  public boolean isIndexed(AttributeType attributeType, IndexType indexType)
  {
    try
    {
      EntryContainer ec = rootContainer.getEntryContainer(baseDNs[0]);
      EntryContainer ec = rootContainer.getEntryContainer(baseDNs.iterator().next());
      AttributeIndex ai = ec.getAttributeIndex(attributeType);
      return ai != null ? ai.isIndexed(indexType) : false;
    }
@@ -309,9 +309,8 @@
    return supportedControls;
  }
  /** {@inheritDoc} */
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
@@ -891,16 +890,15 @@
          public void run(WriteableTransaction txn) throws Exception
          {
            SortedSet<DN> newBaseDNs = newCfg.getBaseDN();
            DN[] newBaseDNsArray = newBaseDNs.toArray(new DN[newBaseDNs.size()]);
            // Check for changes to the base DNs.
            removeDeletedBaseDNs(newBaseDNs, txn);
            if (!createNewBaseDNs(newBaseDNsArray, ccr, txn))
            if (!createNewBaseDNs(newBaseDNs, ccr, txn))
            {
              return;
            }
            baseDNs = newBaseDNsArray;
            baseDNs = new HashSet<>(newBaseDNs);
            // Put the new configuration in place.
            cfg = newCfg;
@@ -931,9 +929,9 @@
    }
  }
  private boolean createNewBaseDNs(DN[] newBaseDNsArray, ConfigChangeResult ccr, WriteableTransaction txn)
  private boolean createNewBaseDNs(Set<DN> newBaseDNs, ConfigChangeResult ccr, WriteableTransaction txn)
  {
    for (DN baseDN : newBaseDNsArray)
    for (DN baseDN : newBaseDNs)
    {
      if (!rootContainer.getBaseDNs().contains(baseDN))
      {
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java
@@ -112,7 +112,7 @@
  private DN taskRootDN;
  /** The set of base DNs defined for this backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /**
   * The length of time in seconds after a task is completed that it should be
@@ -148,37 +148,30 @@
  /** {@inheritDoc} */
  @Override
  public void configureBackend(TaskBackendCfg cfg, ServerContext serverContext) throws ConfigException
  {
    Reject.ifNull(cfg);
    this.serverContext = serverContext;
    final DN[] baseDNs = new DN[cfg.getBaseDN().size()];
    cfg.getBaseDN().toArray(baseDNs);
    Entry configEntry = DirectoryServer.getConfigEntry(cfg.dn());
    configEntryDN = configEntry.getName();
    // Make sure that the provided set of base DNs contains exactly one value.
    // We will only allow one base for task entries.
    if (baseDNs.length == 0)
    final Set<DN> baseDNs = cfg.getBaseDN();
    if (baseDNs.isEmpty())
    {
      throw new ConfigException(ERR_TASKBE_NO_BASE_DNS.get());
    }
    else if (baseDNs.length > 1)
    else if (baseDNs.size() > 1)
    {
      LocalizableMessage message = ERR_TASKBE_MULTIPLE_BASE_DNS.get();
      throw new ConfigException(message);
      throw new ConfigException(ERR_TASKBE_MULTIPLE_BASE_DNS.get());
    }
    else
    {
      this.baseDNs = baseDNs;
      taskRootDN = baseDNs[0];
      taskRootDN = baseDNs.iterator().next();
      String recurringTaskBaseString = RECURRING_TASK_BASE_RDN + "," +
                                       taskRootDN;
@@ -311,18 +304,12 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
  /** {@inheritDoc} */
  @Override
  public long getEntryCount()
  {
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
@@ -19,7 +19,6 @@
import static org.forgerock.opendj.ldap.ResultCode.*;
import static org.opends.messages.ConfigMessages.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.StaticUtils.*;
import java.util.Collection;
@@ -280,7 +279,7 @@
    Backend<?> backend = registeredBackends.get(backendDN);
    if (backend != null)
    {
      LinkedHashSet<DN> removedDNs = newLinkedHashSet(backend.getBaseDNs());
      LinkedHashSet<DN> removedDNs = new LinkedHashSet<>(backend.getBaseDNs());
      LinkedHashSet<DN> addedDNs = new LinkedHashSet<>(baseDNs);
      Iterator<DN> iterator = removedDNs.iterator();
      while (iterator.hasNext())
opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationBackend.java
@@ -29,6 +29,7 @@
import java.util.ListIterator;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -58,7 +59,6 @@
import org.opends.server.types.Privilege;
import org.opends.server.types.RestoreConfig;
import org.opends.server.util.BackupManager;
import org.opends.server.util.CollectionUtils;
import org.opends.server.util.StaticUtils;
/** Back-end responsible for management of configuration entries. */
@@ -79,7 +79,7 @@
    @Override
    public DN dn()
    {
      return getBaseDNs()[0];
      return getBaseDNs().iterator().next();
    }
    @Override
@@ -97,7 +97,7 @@
    @Override
    public SortedSet<DN> getBaseDN()
    {
      return Collections.unmodifiableSortedSet(CollectionUtils.newTreeSet(getBaseDNs()));
      return Collections.unmodifiableSortedSet(new TreeSet<DN>(getBaseDNs()));
    }
    @Override
@@ -159,7 +159,7 @@
  private final Entry configRootEntry;
  /** The set of base DNs for this config handler backend. */
  private DN[] baseDNs;
  private Set<DN> baseDNs;
  /**
   * The write lock used to ensure that only one thread can apply a
@@ -182,7 +182,7 @@
  {
    this.configurationHandler = configurationHandler;
    this.configRootEntry = Converters.to(configurationHandler.getRootEntry());
    baseDNs = new DN[] { configRootEntry.getName() };
    baseDNs = Collections.singleton(configRootEntry.getName());
    setBackendID(CONFIG_BACKEND_ID);
  }
@@ -233,7 +233,7 @@
  }
  @Override
  public DN[] getBaseDNs()
  public Set<DN> getBaseDNs()
  {
    return baseDNs;
  }
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
@@ -199,15 +199,11 @@
  @Override
  public void performBackendPreInitializationProcessing(Backend<?> backend)
  {
    DN[] baseDNs = backend.getBaseDNs();
    if (baseDNs != null)
    for (DN baseDN : backend.getBaseDNs())
    {
      for (DN baseDN : baseDNs)
      if (baseDN.equals(adminSuffixDN))
      {
        if (baseDN.equals(adminSuffixDN))
        {
          searchAdminSuffix();
        }
        searchAdminSuffix();
      }
    }
  }
opendj-server-legacy/src/main/java/org/opends/server/monitors/BackendMonitor.java
@@ -21,13 +21,14 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.server.config.server.MonitorProviderCfg;
import org.opends.server.api.Backend;
import org.opends.server.api.MonitorData;
import org.opends.server.api.MonitorProvider;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryConfig;
import org.opends.server.types.ObjectClass;
@@ -86,7 +87,7 @@
  @Override
  public MonitorData getMonitorData()
  {
    DN[] baseDNs = backend.getBaseDNs();
    Set<DN> baseDNs = backend.getBaseDNs();
    MonitorData attrs = new MonitorData(6);
    attrs.add(ATTR_MONITOR_BACKEND_ID, backend.getBackendID());
@@ -98,10 +99,17 @@
    return attrs;
  }
  private Collection<String> getBackendEntryCounts(DN[] baseDNs)
  private Collection<String> getBackendEntryCounts(Set<DN> baseDNs)
  {
    Collection<String> results = new ArrayList<>();
    if (baseDNs.length != 1)
    if (baseDNs.size() == 1)
    {
      // This is done to avoid recalculating the number of entries
      // using the numSubordinates method in the case where the
      // backend has a single base DN.
      results.add(backend.getEntryCount() + " " + baseDNs.iterator().next());
    }
    else
    {
      for (DN dn : baseDNs)
      {
@@ -117,13 +125,6 @@
        results.add(entryCount + " " + dn);
      }
    }
    else
    {
      // This is done to avoid recalculating the number of entries
      // using the numSubordinates method in the case where the
      // backend has a single base DN.
      results.add(backend.getEntryCount() + " " + baseDNs[0]);
    }
    return results;
  }
}
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -691,7 +691,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationDelete(
      ReplicationDomainCfg configuration)
opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
@@ -24,7 +24,6 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -284,8 +283,7 @@
      return TaskState.STOPPED_BY_ERROR;
    }
    ArrayList<DN> defaultIncludeBranches = new ArrayList<>(backend.getBaseDNs().length);
    Collections.addAll(defaultIncludeBranches, backend.getBaseDNs());
    ArrayList<DN> defaultIncludeBranches = new ArrayList<>(backend.getBaseDNs());
    ArrayList<DN> excludeBranches = new ArrayList<>();
    if (excludeBranchStrings != null)
opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
@@ -24,7 +24,6 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -333,8 +332,7 @@
    }
    // Make sure the selected backend will handle all the include branches
    defaultIncludeBranches = new ArrayList<>(backend.getBaseDNs().length);
    Collections.addAll(defaultIncludeBranches, backend.getBaseDNs());
    defaultIncludeBranches = new ArrayList<>(backend.getBaseDNs());
    for(DN includeBranch : includeBranches)
    {
@@ -486,8 +484,7 @@
    }
    // Find backends with subordinate base DNs that should be excluded from the import.
    defaultIncludeBranches = new HashSet<>(backend.getBaseDNs().length);
    Collections.addAll(defaultIncludeBranches, backend.getBaseDNs());
    defaultIncludeBranches = new HashSet<>(backend.getBaseDNs());
    if (backend.getSubordinateBackends() != null)
    {
@@ -629,10 +626,6 @@
      }
    }
    // Get the set of base DNs for the backend as an array.
    DN[] baseDNs = new DN[defaultIncludeBranches.size()];
    defaultIncludeBranches.toArray(baseDNs);
    // Notify the task listeners that an import is going to start
    // this must be done before disabling the backend to allow
    // listeners to get access to the backend configuration
opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
@@ -17,13 +17,40 @@
 */
package org.opends.server;
import java.io.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.StringReader;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.net.*;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
import java.util.logging.LogManager;
@@ -49,15 +76,27 @@
import org.opends.server.core.AddOperation;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.loggers.*;
import org.opends.server.loggers.AccessLogPublisher;
import org.opends.server.loggers.AccessLogger;
import org.opends.server.loggers.DebugLogger;
import org.opends.server.loggers.ErrorLogPublisher;
import org.opends.server.loggers.ErrorLogger;
import org.opends.server.loggers.HTTPAccessLogPublisher;
import org.opends.server.loggers.HTTPAccessLogger;
import org.opends.server.plugins.InvocationCounterPlugin;
import org.opends.server.protocols.ldap.BindRequestProtocolOp;
import org.opends.server.protocols.ldap.BindResponseProtocolOp;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.LDAPReader;
import org.opends.server.tools.LDAPModify;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.DirectoryEnvironmentConfig;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.FilePermission;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.Schema;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.LDIFReader;
@@ -770,7 +809,7 @@
    {
      memoryBackend = new MemoryBackend();
      memoryBackend.setBackendID(backendID);
      memoryBackend.setBaseDNs(new DN[] {baseDN});
      memoryBackend.setBaseDNs(baseDN);
      memoryBackend.openBackend();
      DirectoryServer.registerBackend(memoryBackend);
    }
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
@@ -1532,7 +1532,7 @@
    {
      memoryBackend = new MemoryBackend();
      memoryBackend.setBackendID(backendId);
      memoryBackend.setBaseDNs(new DN[] {baseDN});
      memoryBackend.setBaseDNs(baseDN);
      memoryBackend.openBackend();
      DirectoryServer.registerBackend(memoryBackend);
    }
opendj-server-legacy/src/test/java/org/opends/server/backends/GenericBackendTestCase.java
@@ -20,6 +20,7 @@
import static org.testng.Assert.*;
import java.util.ArrayList;
import java.util.Set;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.Backend;
@@ -63,9 +64,9 @@
  @Test(dataProvider = "backends")
  public void testGetBaseDNs(Backend<?> b)
  {
    DN[] baseDNs = b.getBaseDNs();
    Set<DN> baseDNs = b.getBaseDNs();
    assertNotNull(baseDNs);
    assertNotEquals(baseDNs.length, 0);
    assertNotEquals(baseDNs.size(), 0);
  }
  /** Tests the {@link Backend#getSupportedControls} method for the provided backend. */