From 8c48b025410ca522f8c26a82358500567e5cab85 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 12 Jul 2016 10:32:09 +0000
Subject: [PATCH] dsreplication: code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

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 3af5943..c0b1875 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
@@ -1866,7 +1866,7 @@
     notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CREATING_REPLICATED_BACKENDS.get()));
 
     // The keys are the backend IDs and the values the list of base DNs.
-    final Map<String, Set<String>> hmBackendSuffix = new HashMap<>();
+    final Map<String, Set<DN>> hmBackendSuffix = new HashMap<>();
     final SuffixesToReplicateOptions suffixData = getUserData().getSuffixesToReplicateOptions();
     populateBackendsToCreate(hmBackendSuffix, suffixData.getSuffixes());
     createReplicatedBackends(hmBackendSuffix, suffixData.getSuffixBackendTypes());
@@ -1879,7 +1879,7 @@
    * configuration of the other server. The algorithm consists on putting the
    * remote servers in a list and pick the backend as they appear on the list.
    */
-  private void populateBackendsToCreate(Map<String, Set<String>> hmBackendSuffix, Set<SuffixDescriptor> suffixes)
+  private void populateBackendsToCreate(Map<String, Set<DN>> hmBackendSuffix, Set<SuffixDescriptor> suffixes)
   {
     Set<ServerDescriptor> serverList = getServerListFromSuffixes(suffixes);
     for (SuffixDescriptor suffix : suffixes)
@@ -1887,8 +1887,8 @@
       final ReplicaDescriptor replica = retrieveReplicaForSuffix(serverList, suffix);
       if (replica != null)
       {
-        final String backendNameKey = getOrAddBackend(hmBackendSuffix, replica.getBackendName());
-        hmBackendSuffix.get(backendNameKey).add(suffix.getDN().toString());
+        final String backendId = getOrAddBackend(hmBackendSuffix, replica.getBackendId());
+        hmBackendSuffix.get(backendId).add(suffix.getDN());
       }
     }
   }
@@ -1921,29 +1921,29 @@
     return null;
   }
 
-  private String getOrAddBackend(Map<String, Set<String>> hmBackendSuffix, String backendName)
+  private String getOrAddBackend(Map<String, Set<DN>> hmBackendSuffix, String backendId)
   {
     for (String storedBackend : hmBackendSuffix.keySet())
     {
-      if (storedBackend.equalsIgnoreCase(backendName))
+      if (storedBackend.equalsIgnoreCase(backendId))
       {
         return storedBackend;
       }
     }
-    hmBackendSuffix.put(backendName, new HashSet<String>());
-    return backendName;
+    hmBackendSuffix.put(backendId, new HashSet<DN>());
+    return backendId;
   }
 
-  private void createReplicatedBackends(final Map<String, Set<String>> hmBackendSuffix,
+  private void createReplicatedBackends(final Map<String, Set<DN>> hmBackendSuffix,
       final Map<String, BackendTypeUIAdapter> backendTypes) throws ApplicationException
   {
     try (ConnectionWrapper connection = createLocalConnection())
     {
       final InstallerHelper helper = new InstallerHelper();
-      for (String backendName : hmBackendSuffix.keySet())
+      for (String backendId : hmBackendSuffix.keySet())
       {
-        helper.createBackend(connection, backendName, hmBackendSuffix.get(backendName),
-            backendTypes.get(backendName).getBackend());
+        helper.createBackend(connection, backendId, hmBackendSuffix.get(backendId),
+            backendTypes.get(backendId).getBackend());
       }
     }
     catch (NamingException e)

--
Gitblit v1.10.0