From 18bcdc6dd02ec91f32ba9922def2ffb3e4e38073 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 12 Jul 2016 07:38:41 +0000
Subject: [PATCH] Use DNs in dsreplication

---
 opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java                                   |    3 
 opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationUserData.java                |   10 
 opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java                       |    4 
 opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java                                    |    5 
 opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java                 |  488 ++++++++++++++++-----------------
 opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java                           |    2 
 opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalUserData.java            |   16 +
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java                      |    2 
 opendj-server-legacy/src/main/java/org/opends/admin/ads/SuffixDescriptor.java                                    |   12 
 opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java                                |   90 ++---
 opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java              |   10 
 opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java                                          |   88 +++---
 opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalScheduleInformation.java |   14 
 opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java                                    |    6 
 opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java                               |    2 
 opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java                                         |   23 
 opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallData.java                            |    4 
 opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java                          |   14 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java               |    2 
 opendj-server-legacy/src/main/java/org/opends/quicksetup/Constants.java                                          |    6 
 opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/LocalPurgeHistorical.java               |   15 
 opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java       |    2 
 opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java                              |    2 
 opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java                                       |    7 
 opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java                               |    4 
 25 files changed, 412 insertions(+), 419 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
index 1e94dd9..0645cbe 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
@@ -16,6 +16,7 @@
  */
 package org.opends.admin.ads;
 
+import static org.forgerock.opendj.ldap.Filter.*;
 import static org.forgerock.opendj.ldap.ModificationType.*;
 import static org.forgerock.opendj.ldap.SearchScope.*;
 import static org.forgerock.opendj.ldap.requests.Requests.*;
@@ -45,6 +46,7 @@
 import org.forgerock.opendj.ldap.Connection;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.EntryNotFoundException;
+import org.forgerock.opendj.ldap.Filter;
 import org.forgerock.opendj.ldap.LdapException;
 import org.forgerock.opendj.ldap.LinkedAttribute;
 import org.forgerock.opendj.ldap.Modification;
@@ -324,7 +326,7 @@
    */
   public void registerServer(Map<ServerProperty, Object> serverProperties) throws ADSContextException
   {
-    String dn = makeDNFromServerProperties(serverProperties);
+    DN dn = makeDNFromServerProperties(serverProperties);
 
     AddRequest request = newAddRequest(dn);
     for (ServerProperty prop : serverProperties.keySet())
@@ -406,7 +408,7 @@
   private void updateServer(Map<ServerProperty, Object> serverProperties, String newServerId)
       throws ADSContextException
   {
-    String dn = makeDNFromServerProperties(serverProperties);
+    DN dn = makeDNFromServerProperties(serverProperties);
 
     try
     {
@@ -414,8 +416,8 @@
       {
         Map<ServerProperty, Object> newServerProps = new HashMap<>(serverProperties);
         newServerProps.put(ServerProperty.ID, newServerId);
-        String newDn = makeDNFromServerProperties(newServerProps);
-        throwIfNotSuccess(connectionWrapper.getConnection().modifyDN(dn, newDn));
+        DN newDn = makeDNFromServerProperties(newServerProps);
+        throwIfNotSuccess(connectionWrapper.getConnection().modifyDN(dn.toString(), newDn.toString()));
         dn = newDn;
         serverProperties.put(ServerProperty.ID, newServerId);
       }
@@ -462,7 +464,7 @@
    */
   public void unregisterServer(Map<ServerProperty, Object> serverProperties) throws ADSContextException
   {
-    String dn = makeDNFromServerProperties(serverProperties);
+    DN dn = makeDNFromServerProperties(serverProperties);
     Connection conn = connectionWrapper.getConnection();
     try
     {
@@ -481,7 +483,7 @@
         }
       }
 
-      throwIfNotSuccess(conn.delete(dn));
+      throwIfNotSuccess(conn.delete(newDeleteRequest(dn)));
     }
     catch (EntryNotFoundException x)
     {
@@ -497,7 +499,7 @@
     {
       // Unregister the server in server groups
       String memberAttrName = ServerGroupProperty.MEMBERS.getAttributeName();
-      String filter = "(" + memberAttrName + "=cn=" + serverID + ")";
+      Filter filter = Filter.valueOf("(" + memberAttrName + "=cn=" + serverID + ")");
       SearchRequest request = newSearchRequest(getServerGroupContainerDN(), SINGLE_LEVEL, filter);
       try (ConnectionEntryReader entryReader = conn.search(request);)
       {
@@ -668,7 +670,7 @@
   {
     Set<Map<ServerProperty, Object>> result = new HashSet<>();
 
-    SearchRequest request = newSearchRequest(getServerContainerDN(), SINGLE_LEVEL, "(objectclass=*)");
+    SearchRequest request = newSearchRequest(getServerContainerDN(), SINGLE_LEVEL, objectClassPresent());
     try (ConnectionEntryReader entryReader = connectionWrapper.getConnection().search(request))
     {
       while (entryReader.hasNext())
@@ -679,7 +681,7 @@
         if (keyId != null)
         {
           SearchRequest request2 = newSearchRequest(
-              getInstanceKeysContainerDN(), SINGLE_LEVEL, "(ds-cfg-key-id=" + keyId + ")",
+              getInstanceKeysContainerDN(), SINGLE_LEVEL, Filter.valueOf("(ds-cfg-key-id=" + keyId + ")"),
               "ds-cfg-public-key-certificate;binary");
           try (ConnectionEntryReader entryReader2 = connectionWrapper.getConnection().search(request2))
           {
@@ -819,7 +821,7 @@
    */
   private Set<Map<ServerGroupProperty, Object>> readServerGroupRegistry() throws ADSContextException
   {
-    SearchRequest request = newSearchRequest(getServerGroupContainerDN(), SINGLE_LEVEL, "(objectclass=*)");
+    SearchRequest request = newSearchRequest(getServerGroupContainerDN(), SINGLE_LEVEL, objectClassPresent());
     try (ConnectionEntryReader entryReader = connectionWrapper.getConnection().search(request))
     {
       Set<Map<ServerGroupProperty, Object>> result = new HashSet<>();
@@ -855,7 +857,7 @@
   {
     Set<Map<AdministratorProperty, Object>> result = new HashSet<>();
     SearchRequest request = newSearchRequest(
-        getAdministratorContainerDN(), SINGLE_LEVEL, "(objectclass=*)",
+        getAdministratorContainerDN(), SINGLE_LEVEL, objectClassPresent(),
         "cn", "userpassword", "ds-privilege-name", "description");
     try (ConnectionEntryReader entryReader = connectionWrapper.getConnection().search(request))
     {
@@ -954,11 +956,11 @@
    */
   public void removeAdminData(boolean removeAdministrators) throws ADSContextException
   {
-    String[] dns = { getServerContainerDN(), getServerGroupContainerDN(),
+    DN[] dns = { getServerContainerDN(), getServerGroupContainerDN(),
       removeAdministrators ? getAdministratorContainerDN() : null };
     try
     {
-      for (String dn : dns)
+      for (DN dn : dns)
       {
         if (dn != null)
         {
@@ -990,7 +992,7 @@
    */
   public boolean hasAdminData() throws ADSContextException
   {
-    String[] dns = { getAdministratorContainerDN(), getAllServerGroupDN(), getServerContainerDN(),
+    DN[] dns = { getAdministratorContainerDN(), getAllServerGroupDN(), getServerContainerDN(),
       getInstanceKeysContainerDN(), getSecretKeysContainerDN() };
     boolean hasAdminData = true;
     for (int i = 0; i < dns.length && hasAdminData; i++)
@@ -1007,9 +1009,9 @@
    *          the UID to be used to generate the DN.
    * @return the DN of the administrator for the given UID:
    */
-  public static String getAdministratorDN(String uid)
+  public static DN getAdministratorDN(String uid)
   {
-    return "cn=" + Rdn.escapeValue(uid) + "," + getAdministratorContainerDN();
+    return DN.valueOf("cn=" + Rdn.escapeValue(uid) + "," + getAdministratorContainerDN());
   }
 
   /**
@@ -1053,10 +1055,10 @@
    */
   public void deleteAdministrator(Map<AdministratorProperty, Object> adminProperties) throws ADSContextException
   {
-    String dnCentralAdmin = getAdministratorDN(getAdministratorUID(adminProperties));
+    DN dnCentralAdmin = getAdministratorDN(getAdministratorUID(adminProperties));
     try
     {
-      throwIfNotSuccess(connectionWrapper.getConnection().delete(dnCentralAdmin));
+      throwIfNotSuccess(connectionWrapper.getConnection().delete(newDeleteRequest(dnCentralAdmin)));
     }
     catch (EntryNotFoundException x)
     {
@@ -1077,9 +1079,9 @@
    *
    * @return the DN of the suffix that contains the administration data.
    */
-  public static String getAdministrationSuffixDN()
+  public static DN getAdministrationSuffixDN()
   {
-    return "cn=admin data";
+    return DN.valueOf("cn=admin data");
   }
 
   /**
@@ -1095,9 +1097,9 @@
    * @throws ADSContextException
    *           if something goes wrong.
    */
-  private static String makeDNFromHostnameAndPath(String hostname, String ipath) throws ADSContextException
+  private static DN makeDNFromHostnameAndPath(String hostname, String ipath) throws ADSContextException
   {
-    return "cn=" + Rdn.escapeValue(hostname + "@" + ipath) + "," + getServerContainerDN();
+    return DN.valueOf("cn=" + Rdn.escapeValue(hostname + "@" + ipath) + "," + getServerContainerDN());
   }
 
   /**
@@ -1111,9 +1113,9 @@
    * @throws ADSContextException
    *           if something goes wrong.
    */
-  private static String makeDNFromServerUniqueId(String serverUniqueId) throws ADSContextException
+  private static DN makeDNFromServerUniqueId(String serverUniqueId) throws ADSContextException
   {
-    return "cn=" + Rdn.escapeValue(serverUniqueId) + "," + getServerContainerDN();
+    return DN.valueOf("cn=" + Rdn.escapeValue(serverUniqueId) + "," + getServerContainerDN());
   }
 
   /**
@@ -1149,7 +1151,7 @@
    * @throws ADSContextException
    *           if something goes wrong.
    */
-  private static String makeDNFromServerProperties(Map<ServerProperty, Object> serverProperties)
+  private static DN makeDNFromServerProperties(Map<ServerProperty, Object> serverProperties)
       throws ADSContextException
   {
     String serverID = getServerID(serverProperties);
@@ -1427,9 +1429,9 @@
    *
    * @return the parent entry of the server entries.
    */
-  private static String getServerContainerDN()
+  private static DN getServerContainerDN()
   {
-    return "cn=Servers," + getAdministrationSuffixDN();
+    return DN.valueOf("cn=Servers," + getAdministrationSuffixDN());
   }
 
   /**
@@ -1437,9 +1439,9 @@
    *
    * @return the parent entry of the administrator entries.
    */
-  public static String getAdministratorContainerDN()
+  public static DN getAdministratorContainerDN()
   {
-    return "cn=Administrators," + getAdministrationSuffixDN();
+    return DN.valueOf("cn=Administrators," + getAdministrationSuffixDN());
   }
 
   /**
@@ -1447,9 +1449,9 @@
    *
    * @return the parent entry of the server group entries.
    */
-  private static String getServerGroupContainerDN()
+  private static DN getServerGroupContainerDN()
   {
-    return "cn=Server Groups," + getAdministrationSuffixDN();
+    return DN.valueOf("cn=Server Groups," + getAdministrationSuffixDN());
   }
 
   /**
@@ -1457,9 +1459,9 @@
    *
    * @return the all server group entry DN.
    */
-  private static String getAllServerGroupDN()
+  private static DN getAllServerGroupDN()
   {
-    return "cn=" + Rdn.escapeValue(ALL_SERVERGROUP_NAME) + "," + getServerGroupContainerDN();
+    return DN.valueOf("cn=" + Rdn.escapeValue(ALL_SERVERGROUP_NAME) + "," + getServerGroupContainerDN());
   }
 
   /**
@@ -1577,9 +1579,9 @@
    * @throws ADSContextException
    *           if an error occurred while checking if the entry exists or not.
    */
-  private boolean isExistingEntry(String dn) throws ADSContextException
+  private boolean isExistingEntry(DN dn) throws ADSContextException
   {
-    SearchRequest request = newSearchRequest(dn, BASE_OBJECT, "(objectclass=*)", NO_ATTRIBUTES);
+    SearchRequest request = newSearchRequest(dn, BASE_OBJECT, objectClassPresent(), NO_ATTRIBUTES);
     try (ConnectionEntryReader entryReader = getConnection().getConnection().search(request))
     {
       while (entryReader.hasNext())
@@ -1611,7 +1613,7 @@
    * @throws ADSContextException
    *           if the entry could not be created.
    */
-  private void createContainerEntry(String dn) throws ADSContextException
+  private void createContainerEntry(DN dn) throws ADSContextException
   {
     createEntry(newAddRequest(dn).addAttribute("objectclass", "top", "ds-cfg-branch"));
   }
@@ -1721,9 +1723,9 @@
    *
    * @return the parent entry of the server key entries in ADS.
    */
-  static String getInstanceKeysContainerDN()
+  static DN getInstanceKeysContainerDN()
   {
-    return "cn=instance keys," + getAdministrationSuffixDN();
+    return DN.valueOf("cn=instance keys," + getAdministrationSuffixDN());
   }
 
   /**
@@ -1731,9 +1733,9 @@
    *
    * @return the parent entry of the secret key entries in ADS.
    */
-  private static String getSecretKeysContainerDN()
+  private static DN getSecretKeysContainerDN()
   {
-    return "cn=secret keys," + getAdministrationSuffixDN();
+    return DN.valueOf("cn=secret keys," + getAdministrationSuffixDN());
   }
 
   /**
@@ -1774,7 +1776,7 @@
    * @throws ADSContextException
    *           In case there is a problem registering the instance public key certificate ID
    */
-  private void registerInstanceKeyCertificate(Map<ServerProperty, Object> serverProperties, String serverEntryDn)
+  private void registerInstanceKeyCertificate(Map<ServerProperty, Object> serverProperties, DN serverEntryDn)
       throws ADSContextException
   {
     ADSContextHelper helper = new ADSContextHelper();
@@ -1796,11 +1798,11 @@
    */
   public Map<String, byte[]> getTrustedCertificates() throws ADSContextException
   {
-    final String baseDN = getInstanceKeysContainerDN();
+    final DN baseDN = getInstanceKeysContainerDN();
     ADSContextHelper helper = new ADSContextHelper();
     final String FILTER_OC_INSTANCE_KEY = "(objectclass=" + helper.getOcCryptoInstanceKey() + ")";
     final String FILTER_NOT_COMPROMISED = "(!(" + helper.getAttrCryptoKeyCompromisedTime() + "=*))";
-    final String searchFilter = "(&" + FILTER_OC_INSTANCE_KEY + FILTER_NOT_COMPROMISED + ")";
+    final Filter searchFilter = Filter.valueOf("(&" + FILTER_OC_INSTANCE_KEY + FILTER_NOT_COMPROMISED + ")");
 
     String instanceKeyId = ADSContext.ServerProperty.INSTANCE_KEY_ID.getAttributeName();
     String instanceKeyCertificate =
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java
index 582270c..a5e1baa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java
@@ -108,7 +108,7 @@
       {
         suffixes = new TreeSet<>();
       }
-      DN newDN = DN.valueOf(ADSContext.getAdministrationSuffixDN());
+      DN newDN = ADSContext.getAdministrationSuffixDN();
       if (suffixes.add(newDN))
       {
         backend.setBaseDN(suffixes);
@@ -135,7 +135,7 @@
   problem getting the instance public key certificate ID.
    */
   void registerInstanceKeyCertificate(ConnectionWrapper conn, Map<ServerProperty, Object> serverProperties,
-      String serverEntryDn) throws ADSContextException
+      DN serverEntryDn) throws ADSContextException
   {
     if (! serverProperties.containsKey(
         ServerProperty.INSTANCE_PUBLIC_KEY_CERTIFICATE)) {
@@ -160,7 +160,7 @@
             serverProperties.get(ServerProperty.INSTANCE_PUBLIC_KEY_CERTIFICATE)));
 
     /* search for public-key certificate entry in ADS DIT */
-    DN dn = DN.valueOf(ADSContext.getInstanceKeysContainerDN());
+    DN dn = ADSContext.getInstanceKeysContainerDN();
     SearchRequest searchRequest = newSearchRequest(dn, WHOLE_SUBTREE, filter, "ds-cfg-key-id");
     try (ConnectionEntryReader entryReader = conn.getConnection().search(searchRequest))
     {
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java
index 1d5d889..b4a8ddd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java
@@ -883,7 +883,7 @@
           {
             for (ReplicaDescriptor replica : desc.getReplicas())
             {
-              if (replica.getSuffix().getDnAsDn().equals(dn))
+              if (replica.getSuffix().getDN().equals(dn))
               {
                 replica.setReplicationId(id);
                 LinkedHashSet<String> repServers = toLowercase(replicationServers);
@@ -1150,8 +1150,7 @@
    * @param servers the servers.
    * @return a representation of a base DN for a set of servers.
    */
-  public static String getSuffixDisplay(String baseDN,
-      Set<ServerDescriptor> servers)
+  public static String getSuffixDisplay(DN baseDN, Set<ServerDescriptor> servers)
   {
     StringBuilder sb = new StringBuilder();
     sb.append(baseDN);
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/SuffixDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/SuffixDescriptor.java
index bd890e8..1bd7b4e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/SuffixDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/SuffixDescriptor.java
@@ -36,17 +36,7 @@
    *
    * @return the DN associated with this suffix descriptor.
    */
-  public String getDN() // FIXME change return type to DN
-  {
-    return suffixDN.toString();
-  }
-
-  /**
-   * Returns the DN associated with this suffix descriptor.
-   *
-   * @return the DN associated with this suffix descriptor.
-   */
-  public DN getDnAsDn()
+  public DN getDN()
   {
     return suffixDN;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java
index 57acac7..c5774ca 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCache.java
@@ -127,7 +127,7 @@
               + replica.getSuffix().getDN()));
 
           boolean suffixFound = false;
-          LdapName dn = new LdapName(replica.getSuffix().getDN());
+          LdapName dn = new LdapName(replica.getSuffix().getDN().toString());
           Set<SuffixDescriptor> sufs = hmSuffixes.get(dn);
           if (sufs != null)
           {
@@ -445,7 +445,7 @@
       {
         SearchResultEntry sr = entryReader.readEntry();
 
-        String dn = firstValueAsString(sr, "domain-name");
+        String dnStr = firstValueAsString(sr, "domain-name");
         int replicaId = -1;
         try
         {
@@ -462,9 +462,10 @@
           logger.warn(LocalizableMessage.raw("Unexpected error reading replica ID: " + t, t));
         }
 
+        final DN dn = DN.valueOf(dnStr);
         for (ReplicaDescriptor replica : candidateReplicas)
         {
-          if (Utils.areDnsEqual(dn, replica.getSuffix().getDN())
+          if (dn.equals(replica.getSuffix().getDN())
               && replica.isReplicated()
               && replica.getReplicationId() == replicaId)
           {
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java
index db26534..60262ae 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java
@@ -347,8 +347,7 @@
   {
     try
     {
-      DN containerDn = DN.valueOf(ADSContext.getAdministratorContainerDN());
-      return dn.isSubordinateOrEqualTo(containerDn);
+      return dn.isSubordinateOrEqualTo(ADSContext.getAdministratorContainerDN());
     }
     catch (Throwable t)
     {
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java
index 242246e..954b2f2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java
@@ -961,7 +961,7 @@
     if (node instanceof SuffixNode)
     {
       String dn = node.getDN();
-      return Utilities.areDnsEqual(dn, ADSContext.getAdministrationSuffixDN()) ||
+      return Utilities.areDnsEqual(dn, ADSContext.getAdministrationSuffixDN().toString()) ||
           Utilities.areDnsEqual(dn, ConfigConstants.DN_DEFAULT_SCHEMA_ROOT) ||
           Utilities.areDnsEqual(dn, ConfigConstants.DN_TASK_ROOT) ||
           Utilities.areDnsEqual(dn, ConfigConstants.DN_CONFIG_ROOT) ||
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
index 6778553..5896c89 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
@@ -811,7 +811,7 @@
       {
         LocalizableMessage msg = INFO_PROGRESS_INITIALIZING_SUFFIX.get(baseDN, conn.getHostPort());
         getProgressDialog().appendProgressHtml(Utilities.applyFont(msg + "<br>", ColorAndFontConstants.progressFont));
-        repl.initializeAllSuffix(baseDN.toString(), conn, true);
+        repl.initializeAllSuffix(baseDN, conn, true);
       }
     }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java
index eb3a71a..81f557a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -796,7 +796,7 @@
       bindDnArg.clearValues();
       if (uid != null)
       {
-        bindDnArg.addValue(ADSContext.getAdministratorDN(uid));
+        bindDnArg.addValue(ADSContext.getAdministratorDN(uid).toString());
         bindDnArg.setPresent(true);
       }
       else
@@ -1088,7 +1088,7 @@
       int port = 389;
       String adminUid = userData.getAdminUID();
       String pwd = userData.getAdminPwd();
-      String dn = ADSContext.getAdministratorDN(adminUid);
+      String dn = ADSContext.getAdministratorDN(adminUid).toString();
 
       info.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
       String adminConnectorUrl = info.getAdminConnectorURL();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallData.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallData.java
index ca831d4..928c7d6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallData.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallData.java
@@ -12,8 +12,8 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2016 ForgeRock AS.
  */
-
 package org.opends.guitools.uninstaller;
 
 import java.io.IOException;
@@ -57,7 +57,7 @@
     while (it.hasNext() && !isADS)
     {
       isADS = Utils.areDnsEqual(it.next(),
-          ADSContext.getAdministrationSuffixDN());
+          ADSContext.getAdministrationSuffixDN().toString());
     }
     isReplicationServer = conf.isReplicationServer();
     replicationServerPort = conf.getReplicationPort();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
index 6ba1385..b669c91 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
@@ -1819,7 +1819,7 @@
     logger.info(LocalizableMessage.raw("Updating references in: " + server.getHostPort(true)));
     notifyListeners(getFormattedWithPoints(INFO_PROGRESS_REMOVING_REFERENCES.get(server.getHostPort(true))));
 
-    DN dn = DN.valueOf(ADSContext.getAdministratorDN(uData.getAdminUID()));
+    DN dn = ADSContext.getAdministratorDN(uData.getAdminUID());
     String pwd = uData.getAdminPwd();
     try (ConnectionWrapper connWrapper =
         getRemoteConnection(server, dn, pwd, getConnectTimeout(), new LinkedHashSet<PreferredConnection>()))
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
index f141857..1804864 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
@@ -379,7 +379,7 @@
           info.regenerateDescriptor();
           ConfigFromFile conf = new ConfigFromFile();
           conf.readConfiguration();
-          String dn = ADSContext.getAdministratorDN(tfUid.getText());
+          String dn = ADSContext.getAdministratorDN(tfUid.getText()).toString();
           String pwd = tfPwd.getText();
           info.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
           usedUrl = info.getAdminConnectorURL();
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Constants.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Constants.java
index 3af5c33..77a25d2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Constants.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Constants.java
@@ -16,6 +16,8 @@
  */
 package org.opends.quicksetup;
 
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.schema.Schema;
 import org.opends.admin.ads.ADSContext;
 
 /**
@@ -53,10 +55,10 @@
   };
 
   /** DN of the schema object. */
-  public static final String SCHEMA_DN = "cn=schema";
+  public static final DN SCHEMA_DN = DN.valueOf("cn=schema", Schema.getCoreSchema());
 
   /** DN of legacy replication changes base DN for backwards compatibility with OpenDJ <= 2.6.x. */
-  public static final String REPLICATION_CHANGES_DN = "dc=replicationChanges";
+  public static final DN REPLICATION_CHANGES_DN = DN.valueOf("dc=replicationChanges", Schema.getCoreSchema());
 
   /** The cli java system property. */
   public static final String CLI_JAVA_PROPERTY = "org.opends.quicksetup.cli";
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
index e6108be..3af5943 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
@@ -1888,7 +1888,7 @@
       if (replica != null)
       {
         final String backendNameKey = getOrAddBackend(hmBackendSuffix, replica.getBackendName());
-        hmBackendSuffix.get(backendNameKey).add(suffix.getDN());
+        hmBackendSuffix.get(backendNameKey).add(suffix.getDN().toString());
       }
     }
   }
@@ -2010,7 +2010,7 @@
      * as the set of ADS suffix replicas (all instances hosting the replication
      * server also replicate ADS).
      */
-    Map<String, Set<String>> replicationServers = new HashMap<>();
+    Map<DN, Set<String>> replicationServers = new HashMap<>();
     Set<String> adsServers = new HashSet<>();
 
     if (getUserData().getReplicationOptions().getType() == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY)
@@ -2019,9 +2019,9 @@
       Set<String> h = new HashSet<>();
       h.add(getLocalReplicationServer());
       adsServers.add(getLocalReplicationServer());
-      for (String dn : baseDns)
+      for (String dnStr : baseDns)
       {
-        replicationServers.put(dn, h);
+        replicationServers.put(DN.valueOf(dnStr), h);
       }
     }
     else
@@ -2114,23 +2114,23 @@
             logger.warn(LocalizableMessage.raw("Could not find replication port for: " + getHostPort(server)));
           }
         }
-        Set<String> dns = new HashSet<>();
+        Set<DN> dns = new HashSet<>();
         for (ReplicaDescriptor replica : hm.get(server))
         {
           dns.add(replica.getSuffix().getDN());
         }
         dns.add(ADSContext.getAdministrationSuffixDN());
         dns.add(Constants.SCHEMA_DN);
-        Map<String, Set<String>> remoteReplicationServers = new HashMap<>();
-        for (String dn : dns)
+        Map<DN, Set<String>> remoteReplicationServers = new HashMap<>();
+        for (DN dn : dns)
         {
           Set<String> repServer = replicationServers.get(dn);
           if (repServer == null)
           {
             // Do the comparison manually
-            for (String dn1 : replicationServers.keySet())
+            for (DN dn1 : replicationServers.keySet())
             {
-              if (Utils.areDnsEqual(dn, dn1))
+              if (dn.equals(dn1))
               {
                 repServer = replicationServers.get(dn1);
                 dn = dn1;
@@ -2462,6 +2462,8 @@
     }
 
     Set<SuffixDescriptor> suffixes = getUserData().getSuffixesToReplicateOptions().getSuffixes();
+    DN adminSuffixDn = ADSContext.getAdministrationSuffixDN();
+    DN schemaDn = Constants.SCHEMA_DN;
 
     /* Initialize local ADS and schema contents using any replica. */
     {
@@ -2470,17 +2472,17 @@
       {
         TopologyCacheFilter filter = new TopologyCacheFilter();
         filter.setSearchMonitoringInformation(false);
-        filter.addBaseDNToSearch(ADSContext.getAdministrationSuffixDN());
-        filter.addBaseDNToSearch(Constants.SCHEMA_DN);
+        filter.addBaseDNToSearch(adminSuffixDn.toString());
+        filter.addBaseDNToSearch(schemaDn.toString());
         ServerDescriptor s = createStandalone(remoteConn, filter);
         for (ReplicaDescriptor replica : s.getReplicas())
         {
-          String dn = replica.getSuffix().getDN();
-          if (areDnsEqual(dn, ADSContext.getAdministrationSuffixDN()))
+          DN dn = replica.getSuffix().getDN();
+          if (dn.equals(adminSuffixDn))
           {
             suffixes.add(replica.getSuffix());
           }
-          else if (areDnsEqual(dn, Constants.SCHEMA_DN))
+          else if (dn.equals(schemaDn))
           {
             suffixes.add(replica.getSuffix());
           }
@@ -2495,14 +2497,14 @@
 
     for (SuffixDescriptor suffix : suffixes)
     {
-      String dn = suffix.getDN();
+      DN dn = suffix.getDN();
 
       ReplicaDescriptor replica = suffix.getReplicas().iterator().next();
       ServerDescriptor server = replica.getServer();
       HostPort hostPort = getHostPort(server);
 
-      boolean isADS = areDnsEqual(dn, ADSContext.getAdministrationSuffixDN());
-      boolean isSchema = areDnsEqual(dn, Constants.SCHEMA_DN);
+      boolean isADS = dn.equals(adminSuffixDn);
+      boolean isSchema = dn.equals(schemaDn);
       if (isADS)
       {
         if (isVerbose())
@@ -2532,11 +2534,11 @@
           {
             TopologyCacheFilter filter = new TopologyCacheFilter();
             filter.setSearchMonitoringInformation(false);
-            filter.addBaseDNToSearch(dn);
+            filter.addBaseDNToSearch(dn.toString());
             ServerDescriptor s = createStandalone(remoteConn, filter);
             for (ReplicaDescriptor r : s.getReplicas())
             {
-              if (areDnsEqual(r.getSuffix().getDN(), dn))
+              if (r.getSuffix().getDN().equals(dn))
               {
                 replicationId = r.getReplicationId();
               }
@@ -3424,18 +3426,7 @@
                 cause = e.getTrustManager().getLastRefusedCause();
               }
               logger.info(LocalizableMessage.raw("Certificate exception cause: " + cause));
-              if (cause == ApplicationTrustManager.Cause.NOT_TRUSTED)
-              {
-                excType = UserDataCertificateException.Type.NOT_TRUSTED;
-              }
-              else if (cause == ApplicationTrustManager.Cause.HOST_NAME_MISMATCH)
-              {
-                excType = UserDataCertificateException.Type.HOST_NAME_MISMATCH;
-              }
-              else
-              {
-                excType = null;
-              }
+              excType = toUserDataCertificateExceptionType(cause);
               if (excType != null)
               {
                 String h;
@@ -3487,19 +3478,7 @@
         UserDataCertificateException.Type excType;
         ApplicationTrustManager.Cause cause = trustManager.getLastRefusedCause();
         logger.info(LocalizableMessage.raw("Certificate exception cause: " + cause));
-        if (cause == ApplicationTrustManager.Cause.NOT_TRUSTED)
-        {
-          excType = UserDataCertificateException.Type.NOT_TRUSTED;
-        }
-        else if (cause == ApplicationTrustManager.Cause.HOST_NAME_MISMATCH)
-        {
-          excType = UserDataCertificateException.Type.HOST_NAME_MISMATCH;
-        }
-        else
-        {
-          excType = null;
-        }
-
+        excType = toUserDataCertificateExceptionType(cause);
         if (excType != null)
         {
           throw new UserDataCertificateException(Step.REPLICATION_OPTIONS, INFO_CERTIFICATE_EXCEPTION.get(host, port),
@@ -3533,6 +3512,19 @@
     }
   }
 
+  private UserDataCertificateException.Type toUserDataCertificateExceptionType(ApplicationTrustManager.Cause cause)
+  {
+    switch (cause)
+    {
+    case NOT_TRUSTED:
+      return UserDataCertificateException.Type.NOT_TRUSTED;
+    case HOST_NAME_MISMATCH:
+      return UserDataCertificateException.Type.HOST_NAME_MISMATCH;
+    default:
+      return null;
+    }
+  }
+
   private ConnectionWrapper newConnectionWrapper(String dn, String pwd, String[] effectiveDn, HostPort hostPort,
       ApplicationTrustManager trustManager) throws Throwable
   {
@@ -3548,7 +3540,7 @@
         throw t;
       }
       // Try using a global administrator
-      dn = ADSContext.getAdministratorDN(dn);
+      dn = ADSContext.getAdministratorDN(dn).toString();
       effectiveDn[0] = dn;
       return new ConnectionWrapper(hostPort, LDAPS, dn, pwd, getConnectTimeout(), trustManager);
     }
@@ -4162,7 +4154,7 @@
    * @throws PeerNotFoundException
    *           if the replication mechanism cannot find a peer.
    */
-  public void initializeSuffix(ConnectionWrapper conn, int replicaId, String suffixDn, boolean displayProgress,
+  public void initializeSuffix(ConnectionWrapper conn, int replicaId, DN suffixDn, boolean displayProgress,
       HostPort sourceServerDisplay) throws ApplicationException, PeerNotFoundException
   {
     boolean taskCreated = false;
@@ -4172,7 +4164,7 @@
     AddRequest addRequest = newAddRequest(dn)
         .addAttribute("objectclass", "top", "ds-task", "ds-task-initialize-from-remote-replica")
         .addAttribute("ds-task-class-name", "org.opends.server.tasks.InitializeTask")
-        .addAttribute("ds-task-initialize-domain-dn", suffixDn)
+        .addAttribute("ds-task-initialize-domain-dn", suffixDn.toString())
         .addAttribute("ds-task-initialize-replica-server-id", String.valueOf(replicaId));
     while (!taskCreated)
     {
@@ -4409,7 +4401,7 @@
     return getUserData().getHostName() + ":" + getUserData().getReplicationOptions().getReplicationPort();
   }
 
-  private void resetGenerationId(ConnectionWrapper conn, String suffixDn, HostPort sourceServerDisplay)
+  private void resetGenerationId(ConnectionWrapper conn, DN suffixDn, HostPort sourceServerDisplay)
       throws ApplicationException
   {
     boolean taskCreated = false;
@@ -4419,7 +4411,7 @@
     AddRequest addRequest = newAddRequest(dn)
         .addAttribute("objectclass", "top", "ds-task", "ds-task-reset-generation-id")
         .addAttribute("ds-task-class-name", "org.opends.server.tasks.SetGenerationIdTask")
-        .addAttribute("ds-task-reset-generation-id-domain-base-dn", suffixDn);
+        .addAttribute("ds-task-reset-generation-id-domain-base-dn", suffixDn.toString());
     while (!taskCreated)
     {
       checkAbort();
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
index e880fb4..785b8de 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
@@ -21,7 +21,6 @@
 
 import static org.opends.messages.QuickSetupMessages.*;
 import static org.opends.quicksetup.Installation.*;
-import static org.opends.quicksetup.util.Utils.*;
 import static org.opends.server.types.ExistingFileBehavior.*;
 
 import java.io.BufferedReader;
@@ -383,7 +382,7 @@
    * @return a ConfiguredReplication object describing what has been configured.
    */
   public ConfiguredReplication configureReplication(
-      ConnectionWrapper conn, Map<String,Set<String>> replicationServers,
+      ConnectionWrapper conn, Map<DN, Set<String>> replicationServers,
       int replicationPort, boolean useSecureReplication, Set<Integer> usedReplicationServerIds,
       Set<Integer> usedServerIds)
   throws ApplicationException
@@ -513,15 +512,14 @@
       {
         domains[i] = sync.getReplicationDomain(domainNames[i]);
       }
-      for (String dn : replicationServers.keySet())
+      for (DN dn : replicationServers.keySet())
       {
         ReplicationDomainCfgClient domain = null;
         boolean isCreated;
         String domainName = null;
         for (int i = 0; i < domains.length && domain == null; i++)
         {
-          if (areDnsEqual(dn,
-              domains[i].getBaseDN().toString()))
+          if (dn.equals(domains[i].getBaseDN()))
           {
             domain = domains[i];
             domainName = domainNames[i];
@@ -536,7 +534,7 @@
               ReplicationDomainCfgDefn.getInstance(), domainName,
               new ArrayList<PropertyException>());
           domain.setServerId(domainId);
-          domain.setBaseDN(DN.valueOf(dn));
+          domain.setBaseDN(dn);
           isCreated = true;
         }
         else
@@ -721,9 +719,9 @@
    * @param baseDN the base DN of the domain.
    * @return the name to be used for a new replication domain.
    */
-  public static String getDomainName(String[] existingDomains, String baseDN)
+  public static String getDomainName(String[] existingDomains, DN baseDN)
   {
-    String domainName = baseDN;
+    String domainName = baseDN.toString();
     boolean nameExists = true;
     int j = 0;
     while (nameExists)
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
index 6483b8f..9b00614 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
@@ -55,7 +55,6 @@
 import org.opends.quicksetup.ui.QuickSetupStepPanel;
 import org.opends.quicksetup.ui.UIFactory;
 import org.opends.quicksetup.ui.UIFactory.IconType;
-import org.opends.quicksetup.util.Utils;
 import org.opends.server.config.ConfigConstants;
 import org.opends.server.tools.BackendTypeHelper;
 import org.opends.server.tools.BackendTypeHelper.BackendTypeUIAdapter;
@@ -227,9 +226,9 @@
       orderedSuffixes.clear();
       for (SuffixDescriptor suffix : array)
       {
-        if (!Utils.areDnsEqual(suffix.getDN(), ADSContext.getAdministrationSuffixDN())
-            && !Utils.areDnsEqual(suffix.getDN(), Constants.SCHEMA_DN)
-            && !Utils.areDnsEqual(suffix.getDN(), Constants.REPLICATION_CHANGES_DN))
+        if (!suffix.getDN().equals(ADSContext.getAdministrationSuffixDN())
+            && !suffix.getDN().equals(Constants.SCHEMA_DN)
+            && !suffix.getDN().equals(Constants.REPLICATION_CHANGES_DN))
         {
           orderedSuffixes.add(suffix);
         }
@@ -237,7 +236,8 @@
       hmCheckBoxes.clear();
       for (SuffixDescriptor suffix : orderedSuffixes)
       {
-        JCheckBox cb = UIFactory.makeJCheckBox(LocalizableMessage.raw(suffix.getDN()),
+        JCheckBox cb =
+            UIFactory.makeJCheckBox(LocalizableMessage.raw(suffix.getDN().toString()),
                 INFO_SUFFIXES_TO_REPLICATE_DN_TOOLTIP.get(), UIFactory.TextStyle.SECONDARY_FIELD_VALID);
         cb.setOpaque(false);
         Boolean v = hmOldValues.get(suffix.getId());
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
index f271349..9c78d53 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
@@ -65,6 +65,7 @@
 import org.forgerock.opendj.config.ManagedObjectDefinition;
 import org.forgerock.opendj.ldap.AuthorizationException;
 import org.forgerock.opendj.ldap.ConnectionException;
+import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
 import org.forgerock.opendj.server.config.client.BackendCfgClient;
@@ -376,7 +377,7 @@
   public static boolean isConfigurationDn(String dn)
   {
     boolean isConfigurationDn = false;
-    String[] configDns = { "cn=config", Constants.SCHEMA_DN };
+    String[] configDns = { "cn=config", Constants.SCHEMA_DN.toString() };
     for (int i = 0; i < configDns.length && !isConfigurationDn; i++)
     {
       isConfigurationDn = areDnsEqual(dn, configDns[i]);
@@ -1589,7 +1590,7 @@
   public static List<List<String>> getDsReplicationEquivalentCommandLines(String subcommand, UserData userData)
   {
     final List<List<String>> cmdLines = new ArrayList<>();
-    final Map<ServerDescriptor, Set<String>> hmServerBaseDNs = getServerDescriptorBaseDNMap(userData);
+    final Map<ServerDescriptor, Set<DN>> hmServerBaseDNs = getServerDescriptorBaseDNMap(userData);
     for (ServerDescriptor server : hmServerBaseDNs.keySet())
     {
       cmdLines.add(getDsReplicationEquivalentCommandLine(subcommand, userData, hmServerBaseDNs.get(server), server));
@@ -1606,7 +1607,7 @@
     cmdLine.add(String.valueOf(server.getEnabledAdministrationPorts().get(0)));
 
     AuthenticationData authData = userData.getReplicationOptions().getAuthenticationData();
-    if (!Utils.areDnsEqual(authData.getDn(), ADSContext.getAdministratorDN(userData.getGlobalAdministratorUID())))
+    if (!DN.valueOf(authData.getDn()).equals(ADSContext.getAdministratorDN(userData.getGlobalAdministratorUID())))
     {
       cmdLine.add("--bindDN1");
       cmdLine.add(authData.getDn());
@@ -1700,7 +1701,7 @@
   }
 
   private static List<String> getDsReplicationEquivalentCommandLine(String subcommand, UserData userData,
-      Set<String> baseDNs, ServerDescriptor server)
+      Set<DN> baseDNs, ServerDescriptor server)
   {
     List<String> cmdLine = new ArrayList<>();
     String cmdName = getCommandLinePath("dsreplication");
@@ -1737,12 +1738,12 @@
     cmdLine.add(String.valueOf(userData.getAdminConnectorPort()));
   }
 
-  private static void addCommonOptions(UserData userData, Set<String> baseDNs, List<String> cmdLine)
+  private static void addCommonOptions(UserData userData, Set<DN> baseDNs, List<String> cmdLine)
   {
-    for (String baseDN : baseDNs)
+    for (DN baseDN : baseDNs)
     {
       cmdLine.add("--baseDN");
-      cmdLine.add(baseDN);
+      cmdLine.add(baseDN.toString());
     }
 
     cmdLine.add("--adminUID");
@@ -1783,9 +1784,9 @@
     return baseDNs;
   }
 
-  private static Map<ServerDescriptor, Set<String>> getServerDescriptorBaseDNMap(UserData userData)
+  private static Map<ServerDescriptor, Set<DN>> getServerDescriptorBaseDNMap(UserData userData)
   {
-    Map<ServerDescriptor, Set<String>> hm = new HashMap<>();
+    Map<ServerDescriptor, Set<DN>> hm = new HashMap<>();
 
     Set<SuffixDescriptor> suffixes = userData.getSuffixesToReplicateOptions().getSuffixes();
     AuthenticationData authData = userData.getReplicationOptions().getAuthenticationData();
@@ -1799,7 +1800,7 @@
         if (ldapURL.equalsIgnoreCase(replica.getServer().getAdminConnectorURL()))
         {
           // This is the server we're configuring
-          Set<String> baseDNs = hm.get(replica.getServer());
+          Set<DN> baseDNs = hm.get(replica.getServer());
           if (baseDNs == null)
           {
             baseDNs = new LinkedHashSet<>();
@@ -1812,7 +1813,7 @@
 
       for (ReplicaDescriptor replica : suffix.getReplicas())
       {
-        Set<String> baseDNs = hm.get(replica.getServer());
+        Set<DN> baseDNs = hm.get(replica.getServer());
         if (baseDNs != null)
         {
           baseDNs.add(suffix.getDN());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java b/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java
index 6d74601..0bf3ddd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java
@@ -258,7 +258,7 @@
       ocMacKey = DirectoryServer.getSchema().getObjectClass(OC_CRYPTO_MAC_KEY);
 
       localTruststoreDN = DN.valueOf(DN_TRUST_STORE_ROOT);
-      DN adminSuffixDN = DN.valueOf(ADSContext.getAdministrationSuffixDN());
+      DN adminSuffixDN = ADSContext.getAdministrationSuffixDN();
       instanceKeysDN = adminSuffixDN.child(DN.valueOf("cn=instance keys"));
       secretKeysDN = adminSuffixDN.child(DN.valueOf("cn=secret keys"));
       serversDN = adminSuffixDN.child(DN.valueOf("cn=Servers"));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java b/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
index 7c5b797..bf8cb63 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
@@ -40,6 +40,7 @@
 import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.opendj.ldap.schema.CoreSchema;
+import org.forgerock.opendj.ldap.schema.ObjectClass;
 import org.opends.admin.ads.ADSContext;
 import org.opends.server.api.Backend;
 import org.opends.server.api.BackendInitializationListener;
@@ -60,7 +61,6 @@
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
-import org.forgerock.opendj.ldap.schema.ObjectClass;
 import org.opends.server.types.SearchFilter;
 import org.opends.server.types.SearchResultEntry;
 import org.opends.server.types.operation.PostResponseAddOperation;
@@ -140,7 +140,7 @@
 
     try
     {
-      adminSuffixDN = DN.valueOf(ADSContext.getAdministrationSuffixDN());
+      adminSuffixDN = ADSContext.getAdministrationSuffixDN();
       instanceKeysDN = adminSuffixDN.child(DN.valueOf("cn=instance keys"));
       secretKeysDN = adminSuffixDN.child(DN.valueOf("cn=secret keys"));
       trustStoreRootDN = DN.valueOf(ConfigConstants.DN_TRUST_STORE_ROOT);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/LocalPurgeHistorical.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/LocalPurgeHistorical.java
index f3c3d4c..e3c9b9c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/LocalPurgeHistorical.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/LocalPurgeHistorical.java
@@ -22,19 +22,19 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
-
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.quicksetup.util.ProgressMessageFormatter;
 import org.opends.server.replication.plugin.LDAPReplicationDomain;
-import org.forgerock.opendj.ldap.DN;
 import org.opends.server.types.DirectoryEnvironmentConfig;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.OpenDsException;
-import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.server.util.EmbeddedUtils;
 import org.opends.server.util.TimeThread;
-import com.forgerock.opendj.cli.ConsoleApplication;
 import org.opends.server.util.cli.PointAdder;
 
+import com.forgerock.opendj.cli.ConsoleApplication;
+
 /**
  * The class that is in charge of taking the different information provided
  * by the user through the command-line and actually executing the local
@@ -121,13 +121,10 @@
     try
     {
       // launch the job
-      for (String baseDN : uData.getBaseDNs())
+      for (DN baseDN : uData.getBaseDNs())
       {
-        DN dn = DN.valueOf(baseDN);
         // We can assume that this is an LDAP replication domain
-        LDAPReplicationDomain domain =
-            LDAPReplicationDomain.retrievesReplicationDomain(dn);
-
+        LDAPReplicationDomain domain = LDAPReplicationDomain.retrievesReplicationDomain(baseDN);
         domain.purgeConflictsHistorical(null, startTime + purgeMaxTime);
       }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalScheduleInformation.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalScheduleInformation.java
index a9322ff..fbce382 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalScheduleInformation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalScheduleInformation.java
@@ -16,9 +16,11 @@
  */
 package org.opends.server.tools.dsreplication;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import org.forgerock.opendj.ldap.DN;
 import org.opends.server.backends.task.FailedDependencyAction;
 import org.opends.server.config.ConfigConstants;
 import org.opends.server.protocols.ldap.LDAPAttribute;
@@ -56,12 +58,22 @@
   public void addTaskAttributes(List<RawAttribute> attributes)
   {
     attributes.add(new LDAPAttribute(
-        ConfigConstants.ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN, uData.getBaseDNs()));
+        ConfigConstants.ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN, toStrings(uData.getBaseDNs())));
     attributes.add(new LDAPAttribute(
         ConfigConstants.ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION,
         Long.toString(uData.getMaximumDuration())));
   }
 
+  private List<String> toStrings(List<DN> dns)
+  {
+    final List<String> results = new ArrayList<>();
+    for (DN dn : dns)
+    {
+      results.add(dn.toString());
+    }
+    return results;
+  }
+
   @Override
   public List<String> getDependencyIds()
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalUserData.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalUserData.java
index 506af6c..e28cbbb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalUserData.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalUserData.java
@@ -16,8 +16,10 @@
  */
 package org.opends.server.tools.dsreplication;
 
-import java.util.LinkedList;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.forgerock.opendj.ldap.DN;
 import org.opends.server.admin.client.cli.TaskScheduleArgs;
 import org.opends.server.tools.tasks.TaskScheduleUserData;
 import org.opends.server.types.HostPort;
@@ -106,7 +108,7 @@
   public static  void initializeWithArgParser(PurgeHistoricalUserData uData,
       ReplicationCliArgumentParser argParser)
   {
-    uData.setBaseDNs(new LinkedList<String>(argParser.getBaseDNs()));
+    uData.setBaseDNs(toDNs(argParser.getBaseDNs()));
 
     if (argParser.connectionArgumentsPresent())
     {
@@ -140,4 +142,14 @@
 
     uData.setMaximumDuration(argParser.getMaximumDurationOrDefault());
   }
+
+  private static List<DN> toDNs(List<String> baseDNs)
+  {
+    final List<DN> results = new ArrayList<>(baseDNs.size());
+    for (String dn : baseDNs)
+    {
+      results.add(DN.valueOf(dn));
+    }
+    return results;
+  }
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
index 3275beb..e796c54 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
@@ -326,7 +326,7 @@
         {
           errors.add(ERR_REPLICATION_NOT_A_VALID_BASEDN.get(dn));
         }
-        if (Constants.REPLICATION_CHANGES_DN.equalsIgnoreCase(dn))
+        if (Constants.REPLICATION_CHANGES_DN.toString().equalsIgnoreCase(dn))
         {
           errors.add(ERR_REPLICATION_NOT_A_USER_SUFFIX.get(Constants.REPLICATION_CHANGES_DN));
         }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index 4262710..2429723 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -282,7 +282,7 @@
      * @param interactive if user has to input information
      * @return whether we should stop
      */
-    boolean continueAfterUserInput(Collection<String> baseDNs, ConnectionWrapper source, ConnectionWrapper dest,
+    boolean continueAfterUserInput(Collection<DN> baseDNs, ConnectionWrapper source, ConnectionWrapper dest,
         boolean interactive);
 
     /**
@@ -954,7 +954,7 @@
   private ReplicationCliReturnCode purgeHistoricalLocally(
       PurgeHistoricalUserData uData)
   {
-    List<String> baseDNs = uData.getBaseDNs();
+    List<DN> baseDNs = uData.getBaseDNs();
     checkSuffixesForLocalPurgeHistorical(baseDNs, false);
     if (!baseDNs.isEmpty())
     {
@@ -982,6 +982,16 @@
     }
   }
 
+  private List<DN> toDNs(List<String> baseDNs)
+  {
+    final List<DN> results = new ArrayList<>(baseDNs.size());
+    for (String dn : baseDNs)
+    {
+      results.add(DN.valueOf(dn));
+    }
+    return results;
+  }
+
   private void printPurgeProgressMessage(PurgeHistoricalUserData uData)
   {
     String separator = formatter.getLineBreak().toString() + formatter.getTab();
@@ -1006,10 +1016,10 @@
       args.add("--"+argParser.noPromptArg.getLongIdentifier());
       args.add("--"+argParser.maximumDurationArg.getLongIdentifier());
       args.add(String.valueOf(uData.getMaximumDuration()));
-      for (String baseDN : uData.getBaseDNs())
+      for (DN baseDN : uData.getBaseDNs())
       {
         args.add("--"+argParser.baseDNsArg.getLongIdentifier());
-        args.add(baseDN);
+        args.add(baseDN.toString());
       }
       ProcessBuilder pb = new ProcessBuilder(args);
       // Use the java args in the script.
@@ -1241,7 +1251,7 @@
 
     try
     {
-      List<String> baseDNs = uData.getBaseDNs();
+      List<DN> baseDNs = uData.getBaseDNs();
       checkSuffixesForPurgeHistorical(baseDNs, conn, false);
       if (baseDNs.isEmpty())
       {
@@ -1284,7 +1294,7 @@
         resetChangeNumberOperations = new OperationBetweenSourceAndDestinationServers()
     {
       @Override
-      public boolean continueAfterUserInput(Collection<String> baseDNs, ConnectionWrapper source,
+      public boolean continueAfterUserInput(Collection<DN> baseDNs, ConnectionWrapper source,
           ConnectionWrapper dest, boolean interactive)
       {
         TopologyCacheFilter filter = new TopologyCacheFilter();
@@ -1371,9 +1381,8 @@
       DN targetBaseDN = DN.rootDN();
       try
       {
-        for (String adn : getCommonSuffixes(connSource, connDest, SuffixRelationType.REPLICATED))
+        for (DN dn : getCommonSuffixes(connSource, connDest, SuffixRelationType.REPLICATED))
         {
-          DN dn = DN.valueOf(adn);
           if (DN.valueOf(targetDN).isSubordinateOrEqualTo(dn) && dn.isSubordinateOrEqualTo(targetBaseDN))
           {
             targetBaseDN = dn;
@@ -1659,7 +1668,7 @@
    * @param interactive whether to ask the user to provide interactively
    * base DNs if none of the provided base DNs can be purged.
    */
-  private void checkSuffixesForPurgeHistorical(Collection<String> suffixes, ConnectionWrapper conn, boolean interactive)
+  private void checkSuffixesForPurgeHistorical(Collection<DN> suffixes, ConnectionWrapper conn, boolean interactive)
   {
     checkSuffixesForPurgeHistorical(suffixes, getReplicas(conn), interactive);
   }
@@ -1672,8 +1681,7 @@
    * @param interactive whether to ask the user to provide interactively
    * base DNs if none of the provided base DNs can be purged.
    */
-  private void checkSuffixesForLocalPurgeHistorical(Collection<String> suffixes,
-      boolean interactive)
+  private void checkSuffixesForLocalPurgeHistorical(Collection<DN> suffixes, boolean interactive)
   {
     checkSuffixesForPurgeHistorical(suffixes, getLocalReplicas(), interactive);
   }
@@ -1711,15 +1719,15 @@
     return replicas;
   }
 
-  private void checkSuffixesForPurgeHistorical(Collection<String> suffixes, Collection<ReplicaDescriptor> replicas,
+  private void checkSuffixesForPurgeHistorical(Collection<DN> suffixes, Collection<ReplicaDescriptor> replicas,
       boolean interactive)
   {
-    TreeSet<String> availableSuffixes = new TreeSet<>();
-    TreeSet<String> notReplicatedSuffixes = new TreeSet<>();
+    TreeSet<DN> availableSuffixes = new TreeSet<>();
+    TreeSet<DN> notReplicatedSuffixes = new TreeSet<>();
 
     for (ReplicaDescriptor rep : replicas)
     {
-      String dn = rep.getSuffix().getDN();
+      DN dn = rep.getSuffix().getDN();
       if (rep.isReplicated())
       {
         availableSuffixes.add(dn);
@@ -1733,9 +1741,9 @@
     checkSuffixesForPurgeHistorical(suffixes, availableSuffixes, notReplicatedSuffixes, interactive);
   }
 
-  private void checkSuffixesForPurgeHistorical(Collection<String> suffixes,
-      Collection<String> availableSuffixes,
-      Collection<String> notReplicatedSuffixes,
+  private void checkSuffixesForPurgeHistorical(Collection<DN> suffixes,
+      Collection<DN> availableSuffixes,
+      Collection<DN> notReplicatedSuffixes,
       boolean interactive)
   {
     if (availableSuffixes.isEmpty())
@@ -1747,13 +1755,13 @@
     else
     {
       // Verify that the provided suffixes are configured in the servers.
-      TreeSet<String> notFound = new TreeSet<>();
-      TreeSet<String> alreadyNotReplicated = new TreeSet<>();
-      for (String dn : suffixes)
+      TreeSet<DN> notFound = new TreeSet<>();
+      TreeSet<DN> alreadyNotReplicated = new TreeSet<>();
+      for (DN dn : suffixes)
       {
-        if (!containsDN(availableSuffixes, dn))
+        if (!availableSuffixes.contains(dn))
         {
-          if (containsDN(notReplicatedSuffixes, dn))
+          if (notReplicatedSuffixes.contains(dn))
           {
             alreadyNotReplicated.add(dn);
           }
@@ -1780,8 +1788,8 @@
     }
   }
 
-  private void askConfirmations(Collection<String> suffixes,
-      Collection<String> availableSuffixes, Arg0 noSuffixAvailableMsg,
+  private void askConfirmations(Collection<DN> suffixes,
+      Collection<DN> availableSuffixes, Arg0 noSuffixAvailableMsg,
       Arg0 noSuffixSelectedMsg, Arg1<Object> confirmationMsgPromt)
   {
     if (containsOnlySchemaOrAdminSuffix(availableSuffixes))
@@ -1805,9 +1813,9 @@
     }
   }
 
-  private boolean containsOnlySchemaOrAdminSuffix(Collection<String> suffixes)
+  private boolean containsOnlySchemaOrAdminSuffix(Collection<DN> suffixes)
   {
-    for (String suffix : suffixes)
+    for (DN suffix : suffixes)
     {
       if (!isSchemaOrInternalAdminSuffix(suffix))
       {
@@ -1817,11 +1825,11 @@
     return true;
   }
 
-  private boolean isSchemaOrInternalAdminSuffix(String suffix)
+  private boolean isSchemaOrInternalAdminSuffix(DN suffix)
   {
-    return areDnsEqual(suffix, ADSContext.getAdministrationSuffixDN())
-        || areDnsEqual(suffix, Constants.SCHEMA_DN)
-        || areDnsEqual(suffix,  Constants.REPLICATION_CHANGES_DN);
+    return suffix.equals(ADSContext.getAdministrationSuffixDN())
+        || suffix.equals(Constants.SCHEMA_DN)
+        || suffix.equals(Constants.REPLICATION_CHANGES_DN);
   }
 
   /**
@@ -1843,7 +1851,7 @@
         initializeReplicationOperations = new OperationBetweenSourceAndDestinationServers()
     {
       @Override
-      public boolean continueAfterUserInput(Collection<String> baseDNs, ConnectionWrapper source,
+      public boolean continueAfterUserInput(Collection<DN> baseDNs, ConnectionWrapper source,
           ConnectionWrapper dest, boolean interactive)
       {
         checkSuffixesForInitializeReplication(baseDNs, source, dest, interactive);
@@ -1890,7 +1898,7 @@
       }
       uData.setMaximumDuration(maximumDuration);
 
-      List<String> suffixes = argParser.getBaseDNs();
+      List<DN> suffixes = toDNs(argParser.getBaseDNs());
       if (uData.isOnline())
       {
         checkSuffixesForPurgeHistorical(suffixes, conn, true);
@@ -2607,7 +2615,7 @@
 
     if (!cancelled)
     {
-      List<String> suffixes = argParser.getBaseDNs();
+      List<DN> suffixes = toDNs(argParser.getBaseDNs());
       checkSuffixesForEnableReplication(suffixes, conn1, conn2, true, uData);
       cancelled = suffixes.isEmpty();
 
@@ -2760,7 +2768,7 @@
     uData.setDisableReplicationServer(disableReplicationServer);
     if (!cancelled && !disableAll)
     {
-      List<String> suffixes = argParser.getBaseDNs();
+      List<DN> suffixes = toDNs(argParser.getBaseDNs());
       checkSuffixesForDisableReplication(suffixes, conn, true, !disableReplicationServer);
       cancelled = suffixes.isEmpty() && !disableReplicationServer;
 
@@ -2790,13 +2798,13 @@
       // Ask for confirmation to disable if not already done.
       boolean disableADS = false;
       boolean disableSchema = false;
-      for (String dn : uData.getBaseDNs())
+      for (DN dn : uData.getBaseDNs())
       {
-        if (areDnsEqual(ADSContext.getAdministrationSuffixDN(), dn))
+        if (ADSContext.getAdministrationSuffixDN().equals(dn))
         {
           disableADS = true;
         }
-        else if (areDnsEqual(Constants.SCHEMA_DN, dn))
+        else if (Constants.SCHEMA_DN.equals(dn))
         {
           disableSchema = true;
         }
@@ -2849,7 +2857,7 @@
         return false;
       }
 
-      List<String> suffixes = argParser.getBaseDNs();
+      List<DN> suffixes = toDNs(argParser.getBaseDNs());
       checkSuffixesForInitializeReplication(suffixes, conn, true);
       if (suffixes.isEmpty())
       {
@@ -2908,7 +2916,7 @@
       {
         return false;
       }
-      List<String> suffixes = argParser.getBaseDNs();
+      List<DN> suffixes = toDNs(argParser.getBaseDNs());
       checkSuffixesForInitializeReplication(suffixes, conn, true);
       uData.setBaseDNs(suffixes);
       return !suffixes.isEmpty();
@@ -2995,7 +3003,7 @@
 
       if (!cancelled)
       {
-        uData.setBaseDNs(argParser.getBaseDNs());
+        uData.setBaseDNs(toDNs(argParser.getBaseDNs()));
       }
       return !cancelled;
     }
@@ -3153,7 +3161,7 @@
       uData.setHostNameDestination(hostDestination);
       uData.setPortDestination(portDestination);
 
-      List<String> suffixes = argParser.getBaseDNs();
+      List<DN> suffixes = toDNs(argParser.getBaseDNs());
       cancelled = serversOperations.continueAfterUserInput(suffixes, connSource, connDestination, true);
       uData.setBaseDNs(suffixes);
 
@@ -3176,22 +3184,15 @@
     HostPort hostPortDestination = connDestination.getHostPort();
     if (initializeADS(uData.getBaseDNs()))
     {
-      final String adminSuffixDN = ADSContext.getAdministrationSuffixDN();
+      final DN adminSuffixDN = ADSContext.getAdministrationSuffixDN();
       return INFO_REPLICATION_CONFIRM_INITIALIZE_ADS.get(adminSuffixDN, hostPortDestination, hostPortSource);
     }
     return INFO_REPLICATION_CONFIRM_INITIALIZE_GENERIC.get(hostPortDestination, hostPortSource);
   }
 
-  private boolean initializeADS(List<String> baseDNs)
+  private boolean initializeADS(List<DN> baseDNs)
   {
-    for (String dn : baseDNs)
-    {
-      if (areDnsEqual(ADSContext.getAdministrationSuffixDN(), dn))
-      {
-        return true;
-      }
-    }
-    return false;
+    return baseDNs.contains(ADSContext.getAdministrationSuffixDN());
   }
 
   /**
@@ -3292,7 +3293,7 @@
    */
   private void initializeWithArgParser(DisableReplicationUserData uData)
   {
-    uData.setBaseDNs(new LinkedList<String>(argParser.getBaseDNs()));
+    uData.setBaseDNs(toDNs(argParser.getBaseDNs()));
     String adminUid = argParser.getAdministratorUID();
     String bindDn = argParser.getBindDNToDisable();
     if (bindDn == null && adminUid == null)
@@ -3340,7 +3341,7 @@
 
   private void initialize(ReplicationUserData uData)
   {
-    uData.setBaseDNs(new LinkedList<String>(argParser.getBaseDNs()));
+    uData.setBaseDNs(toDNs(argParser.getBaseDNs()));
     uData.setAdminUid(argParser.getAdministratorUIDOrDefault());
     uData.setAdminPwd(argParser.getBindPasswordAdmin());
   }
@@ -3663,9 +3664,9 @@
    * @return a Collection containing a list of suffixes that are replicated
    * (or those that can be replicated) in two servers.
    */
-  private List<String> getCommonSuffixes(ConnectionWrapper conn1, ConnectionWrapper conn2, SuffixRelationType type)
+  private List<DN> getCommonSuffixes(ConnectionWrapper conn1, ConnectionWrapper conn2, SuffixRelationType type)
   {
-    LinkedList<String> suffixes = new LinkedList<>();
+    List<DN> suffixes = new LinkedList<>();
     try
     {
       TopologyCacheFilter filter = new TopologyCacheFilter();
@@ -3677,9 +3678,9 @@
       {
         for (ReplicaDescriptor rep2 : server2.getReplicas())
         {
-          String rep1SuffixDN = rep1.getSuffix().getDN();
-          String rep2SuffixDN = rep2.getSuffix().getDN();
-          boolean areDnsEqual = areDnsEqual(rep1SuffixDN, rep2SuffixDN);
+          DN rep1SuffixDN = rep1.getSuffix().getDN();
+          DN rep2SuffixDN = rep2.getSuffix().getDN();
+          boolean areDnsEqual = rep1SuffixDN.equals(rep2SuffixDN);
           switch (type)
           {
           case NOT_REPLICATED:
@@ -3740,7 +3741,7 @@
   private boolean areFullyReplicated(ReplicaDescriptor rep1,
       ReplicaDescriptor rep2)
   {
-    if (areDnsEqual(rep1.getSuffix().getDN(), rep2.getSuffix().getDN()) &&
+    if (rep1.getSuffix().getDN().equals(rep2.getSuffix().getDN()) &&
         rep1.isReplicated() && rep2.isReplicated() &&
         rep1.getServer().isReplicationServer() &&
         rep2.getServer().isReplicationServer())
@@ -3765,7 +3766,7 @@
    */
   private boolean areReplicated(ReplicaDescriptor rep1, ReplicaDescriptor rep2)
   {
-    if (areDnsEqual(rep1.getSuffix().getDN(), rep2.getSuffix().getDN()) &&
+    if (rep1.getSuffix().getDN().equals(rep2.getSuffix().getDN()) &&
         rep1.isReplicated() && rep2.isReplicated())
     {
       Set<String> servers1 = rep1.getReplicationServers();
@@ -3837,7 +3838,7 @@
         }
       }
 
-      List<String> suffixes = uData.getBaseDNs();
+      List<DN> suffixes = uData.getBaseDNs();
       checkSuffixesForEnableReplication(suffixes, conn1, conn2, false, uData);
       if (suffixes.isEmpty())
       {
@@ -4007,7 +4008,7 @@
       print(formatter.getFormattedDone());
       println();
 
-      List<String> suffixes = uData.getBaseDNs();
+      List<DN> suffixes = uData.getBaseDNs();
       checkSuffixesForDisableReplication(suffixes, conn, false, !uData.disableReplicationServer());
       if (suffixes.isEmpty() && !uData.disableReplicationServer() && !uData.disableAll())
       {
@@ -4121,7 +4122,7 @@
         return ERROR_CONNECTING;
       }
 
-      List<String> baseDNs = uData.getBaseDNs();
+      List<DN> baseDNs = uData.getBaseDNs();
       checkSuffixesForInitializeReplication(baseDNs, connSource, connDestination, false);
       if (baseDNs.isEmpty())
       {
@@ -4134,7 +4135,7 @@
       }
 
       ReplicationCliReturnCode returnValue = SUCCESSFUL_NOP;
-      for (String baseDN : baseDNs)
+      for (DN baseDN : baseDNs)
       {
         try
         {
@@ -4193,7 +4194,7 @@
 
     try
     {
-      List<String> baseDNs = uData.getBaseDNs();
+      List<DN> baseDNs = uData.getBaseDNs();
       checkSuffixesForInitializeReplication(baseDNs, conn, false);
       if (baseDNs.isEmpty())
       {
@@ -4206,7 +4207,7 @@
       }
 
       ReplicationCliReturnCode returnValue = SUCCESSFUL_NOP;
-      for (String baseDN : baseDNs)
+      for (DN baseDN : baseDNs)
       {
         try
         {
@@ -4252,7 +4253,7 @@
 
     try
     {
-      List<String> baseDNs = uData.getBaseDNs();
+      List<DN> baseDNs = uData.getBaseDNs();
       checkSuffixesForInitializeReplication(baseDNs, conn, false);
       if (baseDNs.isEmpty())
       {
@@ -4265,7 +4266,7 @@
       }
 
       ReplicationCliReturnCode returnValue = SUCCESSFUL;
-      for (String baseDN : baseDNs)
+      for (DN baseDN : baseDNs)
       {
         try
         {
@@ -4314,7 +4315,7 @@
 
     try
     {
-      List<String> baseDNs = uData.getBaseDNs();
+      List<DN> baseDNs = uData.getBaseDNs();
       checkSuffixesForInitializeReplication(baseDNs, conn, false);
       if (baseDNs.isEmpty())
       {
@@ -4327,7 +4328,7 @@
       }
 
       ReplicationCliReturnCode returnValue = SUCCESSFUL;
-      for (String baseDN : baseDNs)
+      for (DN baseDN : baseDNs)
       {
         try
         {
@@ -4370,14 +4371,14 @@
    * but it is assumed that it contains information about whether the
    * replication domains must be configured or not.
    */
-  private void checkSuffixesForEnableReplication(Collection<String> suffixes,
+  private void checkSuffixesForEnableReplication(Collection<DN> suffixes,
       ConnectionWrapper conn1, ConnectionWrapper conn2,
       boolean interactive, EnableReplicationUserData uData)
   {
     EnableReplicationServerData server1 = uData.getServer1();
     EnableReplicationServerData server2 = uData.getServer2();
-    final TreeSet<String> availableSuffixes = new TreeSet<>();
-    final TreeSet<String> alreadyReplicatedSuffixes = new TreeSet<>();
+    final TreeSet<DN> availableSuffixes = new TreeSet<>();
+    final TreeSet<DN> alreadyReplicatedSuffixes = new TreeSet<>();
     if (server1.configureReplicationDomain() &&
         server2.configureReplicationDomain())
     {
@@ -4415,14 +4416,14 @@
         errPrintln(ERR_NO_SUFFIXES_AVAILABLE_TO_ENABLE_REPLICATION.get());
       }
 
-      List<String> userProvidedSuffixes = argParser.getBaseDNs();
-      TreeSet<String> userProvidedReplicatedSuffixes = new TreeSet<>();
+      List<DN> userProvidedSuffixes = toDNs(argParser.getBaseDNs());
+      TreeSet<DN> userProvidedReplicatedSuffixes = new TreeSet<>();
 
-      for (String s1 : userProvidedSuffixes)
+      for (DN s1 : userProvidedSuffixes)
       {
-        for (String s2 : alreadyReplicatedSuffixes)
+        for (DN s2 : alreadyReplicatedSuffixes)
         {
-          if (areDnsEqual(s1, s2))
+          if (s1.equals(s2))
           {
             userProvidedReplicatedSuffixes.add(s1);
           }
@@ -4438,13 +4439,13 @@
     else
     {
       //  Verify that the provided suffixes are configured in the servers.
-      TreeSet<String> notFound = new TreeSet<>();
-      TreeSet<String> alreadyReplicated = new TreeSet<>();
-      for (String dn : suffixes)
+      TreeSet<DN> notFound = new TreeSet<>();
+      TreeSet<DN> alreadyReplicated = new TreeSet<>();
+      for (DN dn : suffixes)
       {
-        if (!containsDN(availableSuffixes, dn))
+        if (!availableSuffixes.contains(dn))
         {
-          if (containsDN(alreadyReplicatedSuffixes, dn))
+          if (alreadyReplicatedSuffixes.contains(dn))
           {
             alreadyReplicated.add(dn);
           }
@@ -4487,20 +4488,20 @@
    * base DNs if none of the provided base DNs can be disabled.
    * @param displayErrors whether to display errors or not.
    */
-  private void checkSuffixesForDisableReplication(Collection<String> suffixes,
+  private void checkSuffixesForDisableReplication(Collection<DN> suffixes,
       ConnectionWrapper conn, boolean interactive, boolean displayErrors)
   {
     // whether the user must provide base DNs or not
     // (if it is <CODE>false</CODE> the user will be proposed the suffixes only once)
     final boolean areSuffixRequired = displayErrors;
 
-    TreeSet<String> availableSuffixes = new TreeSet<>();
-    TreeSet<String> notReplicatedSuffixes = new TreeSet<>();
+    TreeSet<DN> availableSuffixes = new TreeSet<>();
+    TreeSet<DN> notReplicatedSuffixes = new TreeSet<>();
 
     Collection<ReplicaDescriptor> replicas = getReplicas(conn);
     for (ReplicaDescriptor rep : replicas)
     {
-      String dn = rep.getSuffix().getDN();
+      DN dn = rep.getSuffix().getDN();
       if (rep.isReplicated())
       {
         availableSuffixes.add(dn);
@@ -4517,13 +4518,13 @@
         errPrintln();
         errPrintln(ERR_NO_SUFFIXES_AVAILABLE_TO_DISABLE_REPLICATION.get());
       }
-      List<String> userProvidedSuffixes = argParser.getBaseDNs();
-      TreeSet<String> userProvidedNotReplicatedSuffixes = new TreeSet<>();
-      for (String s1 : userProvidedSuffixes)
+      List<DN> userProvidedSuffixes = toDNs(argParser.getBaseDNs());
+      TreeSet<DN> userProvidedNotReplicatedSuffixes = new TreeSet<>();
+      for (DN s1 : userProvidedSuffixes)
       {
-        for (String s2 : notReplicatedSuffixes)
+        for (DN s2 : notReplicatedSuffixes)
         {
-          if (areDnsEqual(s1, s2))
+          if (s1.equals(s2))
           {
             userProvidedNotReplicatedSuffixes.add(s1);
           }
@@ -4540,13 +4541,13 @@
     else
     {
       // Verify that the provided suffixes are configured in the servers.
-      TreeSet<String> notFound = new TreeSet<>();
-      TreeSet<String> alreadyNotReplicated = new TreeSet<>();
-      for (String dn : suffixes)
+      TreeSet<DN> notFound = new TreeSet<>();
+      TreeSet<DN> alreadyNotReplicated = new TreeSet<>();
+      for (DN dn : suffixes)
       {
-        if (!containsDN(availableSuffixes, dn))
+        if (!availableSuffixes.contains(dn))
         {
-          if (containsDN(notReplicatedSuffixes, dn))
+          if (notReplicatedSuffixes.contains(dn))
           {
             alreadyNotReplicated.add(dn);
           }
@@ -4605,9 +4606,9 @@
   }
 
   private boolean askConfirmations(Arg1<Object> confirmationMsg,
-      Collection<String> availableSuffixes, Collection<String> suffixes)
+      Collection<DN> availableSuffixes, Collection<DN> suffixes)
   {
-    for (String dn : availableSuffixes)
+    for (DN dn : availableSuffixes)
     {
       if (!isSchemaOrInternalAdminSuffix(dn))
       {
@@ -4639,15 +4640,15 @@
    * base DNs if none of the provided base DNs can be initialized.
    */
   private void checkSuffixesForInitializeReplication(
-      Collection<String> suffixes, ConnectionWrapper conn, boolean interactive)
+      Collection<DN> suffixes, ConnectionWrapper conn, boolean interactive)
   {
-    TreeSet<String> availableSuffixes = new TreeSet<>();
-    TreeSet<String> notReplicatedSuffixes = new TreeSet<>();
+    TreeSet<DN> availableSuffixes = new TreeSet<>();
+    TreeSet<DN> notReplicatedSuffixes = new TreeSet<>();
 
     Collection<ReplicaDescriptor> replicas = getReplicas(conn);
     for (ReplicaDescriptor rep : replicas)
     {
-      String dn = rep.getSuffix().getDN();
+      DN dn = rep.getSuffix().getDN();
       if (rep.isReplicated())
       {
         availableSuffixes.add(dn);
@@ -4669,13 +4670,13 @@
         errPrintln(
             ERR_NO_SUFFIXES_AVAILABLE_TO_INITIALIZE_LOCAL_REPLICATION.get());
       }
-      List<String> userProvidedSuffixes = argParser.getBaseDNs();
-      TreeSet<String> userProvidedNotReplicatedSuffixes = new TreeSet<>();
-      for (String s1 : userProvidedSuffixes)
+      List<DN> userProvidedSuffixes = toDNs(argParser.getBaseDNs());
+      TreeSet<DN> userProvidedNotReplicatedSuffixes = new TreeSet<>();
+      for (DN s1 : userProvidedSuffixes)
       {
-        for (String s2 : notReplicatedSuffixes)
+        for (DN s2 : notReplicatedSuffixes)
         {
-          if (areDnsEqual(s1, s2))
+          if (s1.equals(s2))
           {
             userProvidedNotReplicatedSuffixes.add(s1);
           }
@@ -4692,13 +4693,13 @@
     else
     {
       // Verify that the provided suffixes are configured in the servers.
-      TreeSet<String> notFound = new TreeSet<>();
-      TreeSet<String> alreadyNotReplicated = new TreeSet<>();
-      for (String dn : suffixes)
+      TreeSet<DN> notFound = new TreeSet<>();
+      TreeSet<DN> alreadyNotReplicated = new TreeSet<>();
+      for (DN dn : suffixes)
       {
-        if (!containsDN(availableSuffixes, dn))
+        if (!availableSuffixes.contains(dn))
         {
-          if (containsDN(notReplicatedSuffixes, dn))
+          if (notReplicatedSuffixes.contains(dn))
           {
             alreadyNotReplicated.add(dn);
           }
@@ -4754,7 +4755,7 @@
               errPrintln(ERR_NO_SUFFIXES_SELECTED_TO_POST_EXTERNAL_INITIALIZATION.get());
             }
 
-            for (String dn : availableSuffixes)
+            for (DN dn : availableSuffixes)
             {
               if (!isSchemaOrInternalAdminSuffix(dn))
               {
@@ -4803,7 +4804,7 @@
     }
   }
 
-  private String toSingleLine(Collection<String> notFound)
+  private String toSingleLine(Collection<?> notFound)
   {
     return joinAsString(Constants.LINE_SEPARATOR, notFound);
   }
@@ -4818,10 +4819,10 @@
    * @param interactive whether to ask the user to provide interactively
    * base DNs if none of the provided base DNs can be initialized.
    */
-  private void checkSuffixesForInitializeReplication(Collection<String> suffixes, ConnectionWrapper connSource,
+  private void checkSuffixesForInitializeReplication(Collection<DN> suffixes, ConnectionWrapper connSource,
       ConnectionWrapper connDestination, boolean interactive)
   {
-    TreeSet<String> availableSuffixes = new TreeSet<>(
+    TreeSet<DN> availableSuffixes = new TreeSet<>(
         getCommonSuffixes(connSource, connDestination, SuffixRelationType.REPLICATED));
     if (availableSuffixes.isEmpty())
     {
@@ -4832,10 +4833,10 @@
     else
     {
       // Verify that the provided suffixes are configured in the servers.
-      LinkedList<String> notFound = new LinkedList<>();
-      for (String dn : suffixes)
+      LinkedList<DN> notFound = new LinkedList<>();
+      for (DN dn : suffixes)
       {
-        if (!containsDN(availableSuffixes, dn))
+        if (!availableSuffixes.contains(dn))
         {
           notFound.add(dn);
         }
@@ -4870,14 +4871,14 @@
   {
     final Set<String> twoReplServers = new LinkedHashSet<>();
     final Set<String> allRepServers = new LinkedHashSet<>();
-    final Map<String, Set<String>> hmRepServers = new HashMap<>();
+    final Map<DN, Set<String>> hmRepServers = new HashMap<>();
     final Set<Integer> usedReplicationServerIds = new HashSet<>();
-    final Map<String, Set<Integer>> hmUsedReplicationDomainIds = new HashMap<>();
+    final Map<DN, Set<Integer>> hmUsedReplicationDomainIds = new HashMap<>();
 
     TopologyCacheFilter filter = new TopologyCacheFilter();
     filter.setSearchMonitoringInformation(false);
-    filter.addBaseDNToSearch(ADSContext.getAdministrationSuffixDN());
-    filter.addBaseDNToSearch(Constants.SCHEMA_DN);
+    filter.addBaseDNToSearch(ADSContext.getAdministrationSuffixDN().toString());
+    filter.addBaseDNToSearch(Constants.SCHEMA_DN.toString());
     addBaseDNs(filter, uData.getBaseDNs());
     ServerDescriptor serverDesc1 = createStandalone(conn1, filter);
     ServerDescriptor serverDesc2 = createStandalone(conn2, filter);
@@ -4926,8 +4927,8 @@
       }
     }
     // Check whether there is more than one replication server in the topology.
-    Set<String> baseDNsWithOneReplicationServer = new TreeSet<>();
-    Set<String> baseDNsWithNoReplicationServer = new TreeSet<>();
+    Set<DN> baseDNsWithOneReplicationServer = new TreeSet<>();
+    Set<DN> baseDNsWithNoReplicationServer = new TreeSet<>();
     updateBaseDnsWithNotEnoughReplicationServer(adsCtx1, adsCtx2, uData,
        baseDNsWithNoReplicationServer, baseDNsWithOneReplicationServer);
 
@@ -5173,9 +5174,9 @@
       print(formatter.getFormattedDone());
       println();
     }
-    List<String> baseDNs = uData.getBaseDNs();
+    List<DN> baseDNs = uData.getBaseDNs();
     if (!adsAlreadyReplicated
-        && !containsDN(baseDNs, ADSContext.getAdministrationSuffixDN()))
+        && !baseDNs.contains(ADSContext.getAdministrationSuffixDN()))
     {
       baseDNs.add(ADSContext.getAdministrationSuffixDN());
       uData.setBaseDNs(baseDNs);
@@ -5222,7 +5223,7 @@
     addToSets(serverDesc1, uData.getServer1(), conn1, twoReplServers, usedReplicationServerIds);
     addToSets(serverDesc2, uData.getServer2(), conn2, twoReplServers, usedReplicationServerIds);
 
-    for (String baseDN : uData.getBaseDNs())
+    for (DN baseDN : uData.getBaseDNs())
     {
       Set<String> repServersForBaseDN = new LinkedHashSet<>();
       repServersForBaseDN.addAll(getReplicationServers(baseDN, cache1, serverDesc1));
@@ -5262,7 +5263,7 @@
         usedReplicationServerIds, allRepServers, alreadyConfiguredReplicationServers,
         WARN_SECOND_REPLICATION_SERVER_ALREADY_CONFIGURED);
 
-    for (String baseDN : uData.getBaseDNs())
+    for (DN baseDN : baseDNs)
     {
       Set<String> repServers = hmRepServers.get(baseDN);
       Set<Integer> usedIds = hmUsedReplicationDomainIds.get(baseDN);
@@ -5360,12 +5361,12 @@
   }
 
   private void configureToReplicateBaseDN(EnableReplicationServerData server, ConnectionWrapper conn,
-      ServerDescriptor serverDesc, TopologyCache cache, String baseDN, Set<Integer> usedIds,
+      ServerDescriptor serverDesc, TopologyCache cache, DN baseDN, Set<Integer> usedIds,
       Set<String> alreadyConfiguredServers, Set<String> repServers, final Set<String> allRepServers,
       Set<String> alreadyConfiguredReplicationServers) throws ReplicationCliException
   {
     if (server.configureReplicationDomain()
-        || areDnsEqual(baseDN, ADSContext.getAdministrationSuffixDN()))
+        || baseDN.equals(ADSContext.getAdministrationSuffixDN()))
     {
       try
       {
@@ -5480,7 +5481,7 @@
     filter.setSearchMonitoringInformation(false);
     if (!uData.disableAll())
     {
-      filter.addBaseDNToSearch(ADSContext.getAdministrationSuffixDN());
+      filter.addBaseDNToSearch(ADSContext.getAdministrationSuffixDN().toString());
       addBaseDNs(filter, uData.getBaseDNs());
     }
     ServerDescriptor server = createStandalone(conn, filter);
@@ -5571,7 +5572,7 @@
       // Inform the user
       if (!beforeLastRepServer.isEmpty())
       {
-        Set<String> baseDNs = new LinkedHashSet<>();
+        Set<DN> baseDNs = new LinkedHashSet<>();
         for (SuffixDescriptor suffix : beforeLastRepServer)
         {
           if (!isSchemaOrInternalAdminSuffix(suffix.getDN()))
@@ -5604,16 +5605,7 @@
         Set<String> suffixArg = new LinkedHashSet<>();
         for (SuffixDescriptor suffix : lastRepServer)
         {
-          boolean baseDNSpecified = false;
-          for (String baseDN : uData.getBaseDNs())
-          {
-            if (!isSchemaOrInternalAdminSuffix(baseDN) && areDnsEqual(baseDN, suffix.getDN()))
-            {
-              baseDNSpecified = true;
-              break;
-            }
-          }
-          if (!baseDNSpecified)
+          if (!isBaseDNSpecified(uData.getBaseDNs(), suffix.getDN()))
           {
             Set<ServerDescriptor> servers = new TreeSet<>(new ServerComparator());
             for (ReplicaDescriptor replica : suffix.getReplicas())
@@ -5669,14 +5661,14 @@
     Collection<ReplicaDescriptor> replicas = getReplicas(conn);
     for (ReplicaDescriptor rep : replicas)
     {
-      String dn = rep.getSuffix().getDN();
+      DN dn = rep.getSuffix().getDN();
       if (rep.isReplicated())
       {
-        if (areDnsEqual(ADSContext.getAdministrationSuffixDN(), dn))
+        if (ADSContext.getAdministrationSuffixDN().equals(dn))
         {
           adsReplicated = true;
         }
-        else if (areDnsEqual(Constants.SCHEMA_DN, dn))
+        else if (Constants.SCHEMA_DN.equals(dn))
         {
           schemaReplicated = true;
         }
@@ -5708,7 +5700,7 @@
       }
     }
 
-    Set<String> suffixesToDisable = new HashSet<>();
+    Set<DN> suffixesToDisable = new HashSet<>();
     if (uData.disableAll())
     {
       for (ReplicaDescriptor replica : server.getReplicas())
@@ -5729,14 +5721,14 @@
         forceDisableSchema = schemaReplicated;
         forceDisableADS = adsReplicated;
       }
-      for (String dn : uData.getBaseDNs())
+      for (DN dn : uData.getBaseDNs())
       {
-        if (areDnsEqual(ADSContext.getAdministrationSuffixDN(), dn))
+        if (ADSContext.getAdministrationSuffixDN().equals(dn))
         {
           // The user already asked this to be explicitly disabled
           forceDisableADS = false;
         }
-        else if (areDnsEqual(Constants.SCHEMA_DN, dn))
+        else if (Constants.SCHEMA_DN.equals(dn))
         {
           // The user already asked this to be explicitly disabled
           forceDisableSchema = false;
@@ -5756,7 +5748,7 @@
     String replicationServerHostPort =
         server.isReplicationServer() ? server.getReplicationServerHostPort() : null;
 
-    for (String baseDN : suffixesToDisable)
+    for (DN baseDN : suffixesToDisable)
     {
       try
       {
@@ -5773,8 +5765,8 @@
     if (replicationServerHostPort != null && cache != null)
     {
       Set<ServerDescriptor> serversToUpdate = new LinkedHashSet<>();
-      Set<String> baseDNsToUpdate = new HashSet<>(suffixesToDisable);
-      for (String baseDN : baseDNsToUpdate)
+      Set<DN> baseDNsToUpdate = new HashSet<>(suffixesToDisable);
+      for (DN baseDN : baseDNsToUpdate)
       {
         SuffixDescriptor suffix = getSuffix(baseDN, cache, server);
         if (suffix != null)
@@ -5867,11 +5859,23 @@
     }
   }
 
-  private void addBaseDNs(TopologyCacheFilter filter, List<String> baseDNs)
+  private boolean isBaseDNSpecified(List<DN> baseDns, DN dnToFind)
   {
-    for (String dn : baseDNs)
+    for (DN baseDN : baseDns)
     {
-      filter.addBaseDNToSearch(dn);
+      if (!isSchemaOrInternalAdminSuffix(baseDN) && baseDN.equals(dnToFind))
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private void addBaseDNs(TopologyCacheFilter filter, List<DN> baseDNs)
+  {
+    for (DN dn : baseDNs)
+    {
+      filter.addBaseDNToSearch(dn.toString());
     }
   }
 
@@ -5921,7 +5925,7 @@
       }
     }
 
-    List<String> userBaseDNs = uData.getBaseDNs();
+    List<DN> userBaseDNs = uData.getBaseDNs();
     List<Set<ReplicaDescriptor>> replicaLists = new LinkedList<>();
 
     boolean oneReplicated = false;
@@ -5929,11 +5933,11 @@
     boolean displayAll = userBaseDNs.isEmpty();
     for (SuffixDescriptor suffix : cache.getSuffixes())
     {
-      String dn = suffix.getDN();
+      DN dn = suffix.getDN();
 
       // If no base DNs where specified display all the base DNs but the schema
       // and cn=admin data.
-      boolean found = containsDN(userBaseDNs, dn) || (displayAll && !isSchemaOrInternalAdminSuffix(dn));
+      boolean found = userBaseDNs.contains(dn) || (displayAll && !isSchemaOrInternalAdminSuffix(dn));
       if (found)
       {
         if (isAnyReplicated(suffix))
@@ -5948,8 +5952,7 @@
           for (Set<ReplicaDescriptor> replicas : replicaLists)
           {
             ReplicaDescriptor replica = replicas.iterator().next();
-            if (!replica.isReplicated() &&
-                areDnsEqual(dn, replica.getSuffix().getDN()))
+            if (!replica.isReplicated() && dn.equals(replica.getSuffix().getDN()))
             {
               replicas.addAll(suffix.getReplicas());
               found = true;
@@ -5987,11 +5990,11 @@
       List<Set<ReplicaDescriptor>> orderedReplicaLists = new LinkedList<>();
       for (Set<ReplicaDescriptor> replicas : replicaLists)
       {
-        String dn1 = replicas.iterator().next().getSuffix().getDN();
+        DN dn1 = replicas.iterator().next().getSuffix().getDN();
         boolean inserted = false;
         for (int i=0; i<orderedReplicaLists.size() && !inserted; i++)
         {
-          String dn2 = orderedReplicaLists.get(i).iterator().next().getSuffix().getDN();
+          DN dn2 = orderedReplicaLists.get(i).iterator().next().getSuffix().getDN();
           if (dn1.compareTo(dn2) < 0)
           {
             orderedReplicaLists.add(i, replicas);
@@ -6156,7 +6159,7 @@
     {
       tableBuilder.startRow();
       // Suffix DN
-      tableBuilder.appendCell(LocalizableMessage.raw(replica.getSuffix().getDN()));
+      tableBuilder.appendCell(LocalizableMessage.raw(replica.getSuffix().getDN().toString()));
       // Server port
       tableBuilder.appendCell(LocalizableMessage.raw("%s", getHostPort2(replica.getServer(), cnx)));
       // Number of entries
@@ -6414,15 +6417,14 @@
    * to replicate the baseDN defined in the server described by the
    * ServerDescriptor.
    */
-  private Set<String> getReplicationServers(String baseDN,
-      TopologyCache cache, ServerDescriptor server)
+  private Set<String> getReplicationServers(DN baseDN, TopologyCache cache, ServerDescriptor server)
   {
     Set<String> servers = getAllReplicationServers(baseDN, server);
     if (cache != null)
     {
       for (SuffixDescriptor suffix : cache.getSuffixes())
       {
-        if (areDnsEqual(suffix.getDN(), baseDN))
+        if (suffix.getDN().equals(baseDN))
         {
           Set<String> s = suffix.getReplicationServers();
           // Test that at least we share one of the replication servers.
@@ -6482,8 +6484,7 @@
    * @param server the ServerDescriptor.
    * @return the suffix in the TopologyCache for a given baseDN.
    */
-  private SuffixDescriptor getSuffix(String baseDN, TopologyCache cache,
-      ServerDescriptor server)
+  private SuffixDescriptor getSuffix(DN baseDN, TopologyCache cache, ServerDescriptor server)
   {
     String replicationServer = null;
     if (server.isReplicationServer())
@@ -6495,7 +6496,7 @@
     Set<String> servers = getAllReplicationServers(baseDN, server);
     for (SuffixDescriptor suffix : cache.getSuffixes())
     {
-      if (areDnsEqual(suffix.getDN(), baseDN))
+      if (suffix.getDN().equals(baseDN))
       {
         Set<String> s = suffix.getReplicationServers();
         // Test that at least we share one of the replication servers.
@@ -6517,12 +6518,12 @@
     return returnValue;
   }
 
-  private Set<String> getAllReplicationServers(String baseDN, ServerDescriptor server)
+  private Set<String> getAllReplicationServers(DN baseDN, ServerDescriptor server)
   {
     Set<String> servers = new LinkedHashSet<>();
     for (ReplicaDescriptor replica : server.getReplicas())
     {
-      if (areDnsEqual(replica.getSuffix().getDN(), baseDN))
+      if (replica.getSuffix().getDN().equals(baseDN))
       {
         servers.addAll(replica.getReplicationServers());
         break;
@@ -6539,14 +6540,13 @@
    * @return a Set containing the replication domain IDs for a given baseDN in
    * the ServerDescriptor.
    */
-  private Set<Integer> getReplicationDomainIds(String baseDN,
-      ServerDescriptor server)
+  private Set<Integer> getReplicationDomainIds(DN baseDN, ServerDescriptor server)
   {
     Set<Integer> ids = new HashSet<>();
     for (ReplicaDescriptor replica : server.getReplicas())
     {
       if (replica.isReplicated()
-          && areDnsEqual(replica.getSuffix().getDN(), baseDN))
+          && replica.getSuffix().getDN().equals(baseDN))
       {
         ids.add(replica.getReplicationId());
         break;
@@ -6737,18 +6737,18 @@
    *           if there is an error updating the configuration.
    */
   private void configureToReplicateBaseDN(ConnectionWrapper conn,
-      String baseDN,
+      DN baseDN,
       Set<String> replicationServers,
       Set<Integer> usedReplicationDomainIds) throws Exception
   {
     boolean userSpecifiedAdminBaseDN = false;
-    List<String> l = argParser.getBaseDNs();
-    if (l != null)
+    List<DN> baseDNs = toDNs(argParser.getBaseDNs());
+    if (baseDNs != null)
     {
-      userSpecifiedAdminBaseDN = containsDN(l, ADSContext.getAdministrationSuffixDN());
+      userSpecifiedAdminBaseDN = baseDNs.contains(ADSContext.getAdministrationSuffixDN());
     }
     if (!userSpecifiedAdminBaseDN
-        && areDnsEqual(baseDN, ADSContext.getAdministrationSuffixDN()))
+        && baseDN.equals(ADSContext.getAdministrationSuffixDN()))
     {
       print(formatter.getFormattedWithPoints(
           INFO_REPLICATION_ENABLE_CONFIGURING_ADS.get(conn.getHostPort())));
@@ -6775,7 +6775,7 @@
     ReplicationDomainCfgClient domain = null;
     for (ReplicationDomainCfgClient domain2 : domains)
     {
-      if (areDnsEqual(baseDN, domain2.getBaseDN().toString()))
+      if (baseDN.equals(domain2.getBaseDN()))
       {
         domain = domain2;
         break;
@@ -6791,7 +6791,7 @@
           ReplicationDomainCfgDefn.getInstance(), domainName,
           new ArrayList<PropertyException>());
       domain.setServerId(domainId);
-      domain.setBaseDN(DN.valueOf(baseDN));
+      domain.setBaseDN(baseDN);
       domain.setReplicationServer(replicationServers);
       mustCommit = true;
     }
@@ -6839,7 +6839,7 @@
    * replication server.
    * @throws ReplicationCliException if something goes wrong.
    */
-  private void configureToReplicateBaseDN(String baseDN,
+  private void configureToReplicateBaseDN(DN baseDN,
       Set<String> repServers, Set<Integer> usedIds,
       TopologyCache cache, ServerDescriptor server,
       Set<String> alreadyConfiguredServers, Set<String> allRepServers,
@@ -6925,20 +6925,19 @@
     return adminProperties;
   }
 
-  private void initializeSuffix(String baseDN, ConnectionWrapper connSource, ConnectionWrapper connDestination,
-      boolean displayProgress)
-  throws ReplicationCliException
+  private void initializeSuffix(DN baseDN, ConnectionWrapper connSource, ConnectionWrapper connDestination,
+      boolean displayProgress) throws ReplicationCliException
   {
     int replicationId = -1;
     try
     {
       TopologyCacheFilter filter = new TopologyCacheFilter();
       filter.setSearchMonitoringInformation(false);
-      filter.addBaseDNToSearch(baseDN);
+      filter.addBaseDNToSearch(baseDN.toString());
       ServerDescriptor source = ServerDescriptor.createStandalone(connSource, filter);
       for (ReplicaDescriptor replica : source.getReplicas())
       {
-        if (areDnsEqual(replica.getSuffix().getDN(), baseDN))
+        if (replica.getSuffix().getDN().equals(baseDN))
         {
           replicationId = replica.getReplicationId();
           break;
@@ -7012,7 +7011,7 @@
    * @param displayProgress whether we want to display progress or not.
    * @throws ReplicationCliException if an unexpected error occurs.
    */
-  public void initializeAllSuffix(String baseDN, ConnectionWrapper conn, boolean displayProgress)
+  public void initializeAllSuffix(DN baseDN, ConnectionWrapper conn, boolean displayProgress)
       throws ReplicationCliException
   {
     if (argParser == null)
@@ -7064,7 +7063,7 @@
    * @throws ReplicationCliException if there is an error performing the
    * operation.
    */
-  private void preExternalInitialization(String baseDN, ConnectionWrapper conn) throws ReplicationCliException
+  private void preExternalInitialization(DN baseDN, ConnectionWrapper conn) throws ReplicationCliException
   {
     postPreExternalInitialization(baseDN, conn, true);
   }
@@ -7077,7 +7076,7 @@
    * @throws ReplicationCliException if there is an error performing the
    * operation.
    */
-  private void postExternalInitialization(String baseDN, ConnectionWrapper conn) throws ReplicationCliException
+  private void postExternalInitialization(DN baseDN, ConnectionWrapper conn) throws ReplicationCliException
   {
     postPreExternalInitialization(baseDN, conn, false);
   }
@@ -7090,7 +7089,7 @@
    * @param isPre whether this is the pre operation or the post operation.
    * @throws ReplicationCliException if there is an error performing the operation
    */
-  private void postPreExternalInitialization(String baseDN,
+  private void postPreExternalInitialization(DN baseDN,
       ConnectionWrapper conn, boolean isPre) throws ReplicationCliException
   {
     boolean isOver = false;
@@ -7100,7 +7099,7 @@
     {
       attrMap.put("ds-task-reset-generation-id-new-value", "-1");
     }
-    attrMap.put("ds-task-reset-generation-id-domain-base-dn", baseDN);
+    attrMap.put("ds-task-reset-generation-id-domain-base-dn", baseDN.toString());
 
     try {
       dn = createServerTask(conn,
@@ -7200,14 +7199,14 @@
    * @throws PeerNotFoundException if the replication mechanism cannot find
    * a peer.
    */
-  private void initializeAllSuffixTry(String baseDN, ConnectionWrapper conn, boolean displayProgress)
+  private void initializeAllSuffixTry(DN baseDN, ConnectionWrapper conn, boolean displayProgress)
       throws ClientException, PeerNotFoundException
   {
     boolean isOver = false;
     String dn = null;
     HostPort hostPort = conn.getHostPort();
     Map<String, String> attrsMap = new TreeMap<>();
-    attrsMap.put("ds-task-initialize-domain-dn", baseDN);
+    attrsMap.put("ds-task-initialize-domain-dn", baseDN.toString());
     attrsMap.put("ds-task-initialize-replica-server-id", "all");
     try
     {
@@ -7473,7 +7472,7 @@
    */
   private void removeReferencesInServer(ServerDescriptor server,
       String replicationServer, DN bindDn, String pwd,
-      Collection<String> baseDNs, boolean updateReplicationServers,
+      Collection<DN> baseDNs, boolean updateReplicationServers,
       Set<PreferredConnection> cnx)
   throws ReplicationCliException
   {
@@ -7482,7 +7481,7 @@
     filter.setSearchBaseDNInformation(false);
     ServerLoader loader = new ServerLoader(server.getAdsProperties(), bindDn,
         pwd, getTrustManager(sourceServerCI), getConnectTimeout(), cnx, filter);
-    String lastBaseDN = null;
+    DN lastBaseDN = null;
     HostPort hostPort = null;
 
     try (ConnectionWrapper conn = loader.createConnectionWrapper())
@@ -7506,12 +7505,11 @@
         {
           for (String domainName : domainNames)
           {
-            ReplicationDomainCfgClient domain =
-              sync.getReplicationDomain(domainName);
-            for (String baseDN : baseDNs)
+            ReplicationDomainCfgClient domain = sync.getReplicationDomain(domainName);
+            for (DN baseDN : baseDNs)
             {
               lastBaseDN = baseDN;
-              if (areDnsEqual(domain.getBaseDN().toString(), baseDN))
+              if (domain.getBaseDN().equals(baseDN))
               {
                 print(formatter.getFormattedWithPoints(
                     INFO_REPLICATION_REMOVING_REFERENCES_ON_REMOTE.get(baseDN, hostPort)));
@@ -7597,7 +7595,7 @@
    * @throws ReplicationCliException if there is an error updating the
    * configuration of the server.
    */
-  private void deleteReplicationDomain(ConnectionWrapper conn, String baseDN) throws ReplicationCliException
+  private void deleteReplicationDomain(ConnectionWrapper conn, DN baseDN) throws ReplicationCliException
   {
     HostPort hostPort = conn.getHostPort();
     try
@@ -7621,7 +7619,7 @@
           {
             ReplicationDomainCfgClient domain =
               sync.getReplicationDomain(domainName);
-            if (areDnsEqual(domain.getBaseDN().toString(), baseDN))
+            if (domain.getBaseDN().equals(baseDN))
             {
               print(formatter.getFormattedWithPoints(
                   INFO_REPLICATION_DISABLING_BASEDN.get(baseDN, hostPort)));
@@ -7711,7 +7709,7 @@
    * the replication domain or updating the list of replication servers of
    * the replication domain).
    */
-  private LocalizableMessage getMessageForEnableException(HostPort hostPort, String baseDN)
+  private LocalizableMessage getMessageForEnableException(HostPort hostPort, DN baseDN)
   {
     return ERR_REPLICATION_CONFIGURING_BASEDN.get(baseDN, hostPort);
   }
@@ -7730,7 +7728,7 @@
    * the replication domain or updating the list of replication servers of
    * the replication domain).
    */
-  private LocalizableMessage getMessageForDisableException(HostPort hostPort, String baseDN)
+  private LocalizableMessage getMessageForDisableException(HostPort hostPort, DN baseDN)
   {
     return ERR_REPLICATION_CONFIGURING_BASEDN.get(baseDN, hostPort);
   }
@@ -8024,21 +8022,21 @@
     }
 
     Collection<ReplicaDescriptor> replicas = getReplicas(conn);
-    Set<String> replicatedSuffixes = new HashSet<>();
+    Set<DN> replicatedSuffixes = new HashSet<>();
     for (ReplicaDescriptor rep : replicas)
     {
-      String dn = rep.getSuffix().getDN();
+      DN dn = rep.getSuffix().getDN();
       if (rep.isReplicated())
       {
         replicatedSuffixes.add(dn);
       }
     }
 
-    for (String dn1 : replicatedSuffixes)
+    for (DN dn1 : replicatedSuffixes)
     {
-      if (!areDnsEqual(ADSContext.getAdministrationSuffixDN(), dn1)
-          && !areDnsEqual(Constants.SCHEMA_DN, dn1)
-          && !containsDN(uData.getBaseDNs(), dn1))
+      if (!ADSContext.getAdministrationSuffixDN().equals(dn1)
+          && !Constants.SCHEMA_DN.equals(dn1)
+          && !uData.getBaseDNs().contains(dn1))
       {
         return false;
       }
@@ -8046,18 +8044,6 @@
     return true;
   }
 
-  private boolean containsDN(final Collection<String> dns, String dnToFind)
-  {
-    for (String dn : dns)
-    {
-      if (areDnsEqual(dn, dnToFind))
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
   /**
    * Returns the host port representation of the server to be used in progress,
    * status and error messages.  It takes into account the fact the host and
@@ -8309,7 +8295,7 @@
   private void addGlobalArguments(CommandBuilder commandBuilder, ReplicationUserData uData)
   throws ArgumentException
   {
-    List<String> baseDNs = uData.getBaseDNs();
+    List<DN> baseDNs = uData.getBaseDNs();
     StringArgument baseDNsArg =
             StringArgument.builder(OPTION_LONG_BASEDN)
                     .shortIdentifier(OPTION_SHORT_BASEDN)
@@ -8317,9 +8303,9 @@
                     .multiValued()
                     .valuePlaceholder(INFO_BASEDN_PLACEHOLDER.get())
                     .buildArgument();
-    for (String baseDN : baseDNs)
+    for (DN baseDN : baseDNs)
     {
-      baseDNsArg.addValue(baseDN);
+      baseDNsArg.addValue(baseDN.toString());
     }
     commandBuilder.addArgument(baseDNsArg);
 
@@ -8922,45 +8908,47 @@
 
   private void updateAvailableAndReplicatedSuffixesForOneDomain(
       ConnectionWrapper connDomain, ConnectionWrapper connOther,
-      Set<String> availableSuffixes, Set<String> alreadyReplicatedSuffixes)
+      Set<DN> availableSuffixes, Set<DN> alreadyReplicatedSuffixes)
   {
-    Collection<ReplicaDescriptor> replicas = getReplicas(connDomain);
     int replicationPort = getReplicationPort(connOther);
     boolean isReplicationServerConfigured = replicationPort != -1;
     String replicationServer = getReplicationServer(connOther.getHostPort().getHost(), replicationPort);
+
+    Collection<ReplicaDescriptor> replicas = getReplicas(connDomain);
     for (ReplicaDescriptor replica : replicas)
     {
+      final DN suffixDn = replica.getSuffix().getDN();
       if (!isReplicationServerConfigured)
       {
         if (replica.isReplicated())
         {
-          alreadyReplicatedSuffixes.add(replica.getSuffix().getDN());
+          alreadyReplicatedSuffixes.add(suffixDn);
         }
-        availableSuffixes.add(replica.getSuffix().getDN());
+        availableSuffixes.add(suffixDn);
       }
 
       if (!isReplicationServerConfigured)
       {
-        availableSuffixes.add(replica.getSuffix().getDN());
+        availableSuffixes.add(suffixDn);
       }
       else if (!replica.isReplicated())
       {
-        availableSuffixes.add(replica.getSuffix().getDN());
+        availableSuffixes.add(suffixDn);
       }
       else if (containsIgnoreCase(replica.getReplicationServers(), replicationServer))
       {
-        alreadyReplicatedSuffixes.add(replica.getSuffix().getDN());
+        alreadyReplicatedSuffixes.add(suffixDn);
       }
       else
       {
-        availableSuffixes.add(replica.getSuffix().getDN());
+        availableSuffixes.add(suffixDn);
       }
     }
   }
 
   private void updateAvailableAndReplicatedSuffixesForNoDomain(
       ConnectionWrapper conn1, ConnectionWrapper conn2,
-      Set<String> availableSuffixes, Set<String> alreadyReplicatedSuffixes)
+      Set<DN> availableSuffixes, Set<DN> alreadyReplicatedSuffixes)
   {
     int replicationPort1 = getReplicationPort(conn1);
     boolean isReplicationServer1Configured = replicationPort1 != -1;
@@ -9013,7 +9001,7 @@
     return null;
   }
 
-  private void addAllAvailableSuffixes(Collection<String> availableSuffixes,
+  private void addAllAvailableSuffixes(Collection<DN> availableSuffixes,
       Set<SuffixDescriptor> suffixes, String rsToFind)
   {
     for (SuffixDescriptor suffix : suffixes)
@@ -9030,7 +9018,7 @@
 
   private void updateAvailableAndReplicatedSuffixesForNoDomainOneSense(
       TopologyCache cache1, TopologyCache cache2, String replicationServer1, String replicationServer2,
-      Set<String> availableSuffixes, Set<String> alreadyReplicatedSuffixes)
+      Set<DN> availableSuffixes, Set<DN> alreadyReplicatedSuffixes)
   {
     for (SuffixDescriptor suffix : cache1.getSuffixes())
     {
@@ -9043,7 +9031,7 @@
           boolean isFirstReplicated = false;
           for (SuffixDescriptor suffix2 : cache2.getSuffixes())
           {
-            if (areDnsEqual(suffix.getDN(), suffix2.getDN()))
+            if (suffix.getDN().equals(suffix2.getDN()))
             {
               for (String rServer2 : suffix2.getReplicationServers())
               {
@@ -9080,8 +9068,7 @@
 
   private void updateBaseDnsWithNotEnoughReplicationServer(ADSContext adsCtx1,
       ADSContext adsCtx2, EnableReplicationUserData uData,
-      Set<String> baseDNsWithNoReplicationServer,
-      Set<String> baseDNsWithOneReplicationServer)
+      Set<DN> baseDNsWithNoReplicationServer, Set<DN> baseDNsWithOneReplicationServer)
   {
     EnableReplicationServerData server1 = uData.getServer1();
     EnableReplicationServerData server2 = uData.getServer2();
@@ -9099,12 +9086,12 @@
     String repServer1 =  getReplicationServer(server1.getHostName(), repPort1);
     int repPort2 = getReplicationPort(adsCtx2.getConnection());
     String repServer2 =  getReplicationServer(server2.getHostName(), repPort2);
-    for (String baseDN : uData.getBaseDNs())
+    for (DN baseDN : uData.getBaseDNs())
     {
       int nReplicationServers = 0;
       for (SuffixDescriptor suffix : suffixes)
       {
-        if (areDnsEqual(suffix.getDN(), baseDN))
+        if (suffix.getDN().equals(baseDN))
         {
           Set<String> replicationServers = suffix.getReplicationServers();
           nReplicationServers += replicationServers.size();
@@ -9402,10 +9389,10 @@
     return false;
   }
 
-  private boolean findReplicaInSuffix2(ReplicaDescriptor replica1, SuffixDescriptor suffix2, String suffix1DN,
+  private boolean findReplicaInSuffix2(ReplicaDescriptor replica1, SuffixDescriptor suffix2, DN suffix1DN,
       Set<LocalizableMessage> commonDomainIDErrors)
   {
-    if (!areDnsEqual(suffix2.getDN(), replica1.getSuffix().getDN()))
+    if (!suffix2.getDN().equals(replica1.getSuffix().getDN()))
     {
       // Conflicting domain names must apply to same suffix.
       return false;
@@ -9473,7 +9460,7 @@
    * @return <CODE>true</CODE> if the provided baseDN is replicated in the
    * provided server, <CODE>false</CODE> otherwise.
    */
-  private boolean isBaseDNReplicated(ServerDescriptor server, String baseDN)
+  private boolean isBaseDNReplicated(ServerDescriptor server, DN baseDN)
   {
     return findReplicated(server.getReplicas(), baseDN) != null;
   }
@@ -9487,8 +9474,7 @@
    * @return <CODE>true</CODE> if the provided baseDN is replicated between
    * both servers, <CODE>false</CODE> otherwise.
    */
-  private boolean isBaseDNReplicated(ServerDescriptor server1,
-      ServerDescriptor server2, String baseDN)
+  private boolean isBaseDNReplicated(ServerDescriptor server1, ServerDescriptor server2, DN baseDN)
   {
     final ReplicaDescriptor replica1 = findReplicated(server1.getReplicas(), baseDN);
     final ReplicaDescriptor replica2 = findReplicated(server2.getReplicas(), baseDN);
@@ -9508,11 +9494,11 @@
     return false;
   }
 
-  private ReplicaDescriptor findReplicated(Set<ReplicaDescriptor> replicas, String baseDN)
+  private ReplicaDescriptor findReplicated(Set<ReplicaDescriptor> replicas, DN baseDN)
   {
     for (ReplicaDescriptor replica : replicas)
     {
-      if (areDnsEqual(replica.getSuffix().getDN(), baseDN))
+      if (replica.getSuffix().getDN().equals(baseDN))
       {
         return replica;
       }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationUserData.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationUserData.java
index 2c05974..037fdaf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationUserData.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationUserData.java
@@ -12,13 +12,15 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
  */
 package org.opends.server.tools.dsreplication;
 
 import java.util.LinkedList;
 import java.util.List;
 
+import org.forgerock.opendj.ldap.DN;
+
 /**
  * This class is used to store the information provided by the user in the
  * replication command line.  It is required because when we are in interactive
@@ -26,7 +28,7 @@
  */
 public abstract class ReplicationUserData
 {
-  private final LinkedList<String> baseDNs = new LinkedList<>();
+  private final LinkedList<DN> baseDNs = new LinkedList<>();
   private String adminUid;
   private String adminPwd;
 
@@ -70,7 +72,7 @@
    * Returns the Base DNs to replicate.
    * @return the Base DNs to replicate.
    */
-  public List<String> getBaseDNs()
+  public List<DN> getBaseDNs()
   {
     return new LinkedList<>(baseDNs);
   }
@@ -79,7 +81,7 @@
    * Sets the Base DNs to replicate.
    * @param baseDNs the Base DNs to replicate.
    */
-  public void setBaseDNs(List<String> baseDNs)
+  public void setBaseDNs(List<DN> baseDNs)
   {
     this.baseDNs.clear();
     this.baseDNs.addAll(baseDNs);

--
Gitblit v1.10.0