From cfacecff2bda03fae818ababf0ed5bbce062942b Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Fri, 29 May 2015 07:42:09 +0000
Subject: [PATCH] OPENDJ-2044 CR-7087 Replication Setup GUI

---
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java                   |   12 ++
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java |  250 +++++++++++++++++++++++++++++++----------
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/FieldName.java                          |    3 
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java  |   34 +++++
 opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/quickSetup.properties                         |   14 +
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java                          |    8 +
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java                   |   36 +----
 7 files changed, 262 insertions(+), 95 deletions(-)

diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
index 2fd9479..978fa58 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
@@ -126,7 +126,6 @@
 import org.opends.quicksetup.util.FileManager;
 import org.opends.quicksetup.util.IncompatibleVersionException;
 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;
 import org.opends.server.util.CertificateManager;
@@ -1556,11 +1555,9 @@
 
     // 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, BackendTypeUIAdapter> backendTypes = new HashMap<>();
-    final Set<SuffixDescriptor> suffixes = getUserData().getSuffixesToReplicateOptions().getSuffixes();
-
-    populateBackendsToCreate(hmBackendSuffix, suffixes, backendTypes);
-    createReplicatedBackends(hmBackendSuffix, backendTypes);
+    final SuffixesToReplicateOptions suffixData = getUserData().getSuffixesToReplicateOptions();
+    populateBackendsToCreate(hmBackendSuffix, suffixData.getSuffixes());
+    createReplicatedBackends(hmBackendSuffix, suffixData.getSuffixBackendTypes());
     notifyListeners(getFormattedDoneWithLineBreak());
     checkAbort();
   }
@@ -1570,8 +1567,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,
-      Map<String, BackendTypeUIAdapter> backendTypes)
+  private void populateBackendsToCreate(Map<String, Set<String>> hmBackendSuffix, Set<SuffixDescriptor> suffixes)
   {
     Set<ServerDescriptor> serverList = getServerListFromSuffixes(suffixes);
     for (SuffixDescriptor suffix : suffixes)
@@ -1581,7 +1577,6 @@
       {
         final String backendNameKey = getOrAddBackend(hmBackendSuffix, replica.getBackendName());
         hmBackendSuffix.get(backendNameKey).add(suffix.getDN());
-        backendTypes.put(backendNameKey, getBackendType(replica.getObjectClasses()));
       }
     }
   }
@@ -1614,20 +1609,6 @@
     return null;
   }
 
-  private BackendTypeUIAdapter getBackendType(Set<String> objectClasses)
-  {
-    for (String objectClass : objectClasses)
-    {
-      BackendTypeUIAdapter adapter =
-          BackendTypeHelper.getBackendTypeAdapter(objectClass.replace(ConfigConstants.NAME_PREFIX_CFG, ""));
-      if (adapter != null)
-      {
-        return adapter;
-      }
-    }
-    return null;
-  }
-
   private String getOrAddBackend(Map<String, Set<String>> hmBackendSuffix, String backendName)
   {
     for (String storedBackend : hmBackendSuffix.keySet())
@@ -3509,6 +3490,7 @@
    * @throws UserDataException
    *           if the data provided by the user is not valid.
    */
+  @SuppressWarnings("unchecked")
   private void updateUserDataForSuffixesOptionsPanel(QuickSetup qs) throws UserDataException
   {
     List<LocalizableMessage> errorMsgs = new ArrayList<>();
@@ -3530,10 +3512,10 @@
         }
         qs.displayFieldInvalid(FieldName.SUFFIXES_TO_REPLICATE, false);
         Set<SuffixDescriptor> available = getUserData().getSuffixesToReplicateOptions().getAvailableSuffixes();
-
-        SuffixesToReplicateOptions options =
-            new SuffixesToReplicateOptions(SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES, available,
-                chosen);
+        Map<String, BackendTypeUIAdapter> suffixesBackendTypes =
+            (Map<String, BackendTypeUIAdapter>) qs.getFieldValue(FieldName.SUFFIXES_TO_REPLICATE_BACKEND_TYPE);
+        SuffixesToReplicateOptions options = new SuffixesToReplicateOptions(
+            SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES, available, chosen, suffixesBackendTypes);
         getUserData().setSuffixesToReplicateOptions(options);
       }
       getUserData().setRemoteWithNoReplicationPort(getRemoteWithNoReplicationPort(getUserData()));
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java
index a4984b7..77d1a49 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java
@@ -26,10 +26,13 @@
  */
 package org.opends.quicksetup.installer;
 
+import java.util.HashMap;
 import java.util.LinkedHashSet;
+import java.util.Map;
 import java.util.Set;
 
 import org.opends.admin.ads.SuffixDescriptor;
+import org.opends.server.tools.BackendTypeHelper.BackendTypeUIAdapter;
 
 /**
  * This class is used to provide a data model for the Suffix to Replicate
@@ -56,6 +59,7 @@
   private Type type;
   private Set<SuffixDescriptor> availableSuffixes;
   private Set<SuffixDescriptor> suffixesToReplicate;
+  private Map<String, BackendTypeUIAdapter> backendsToReplicate;
 
   /**
    * Constructor for the SuffixesToReplicateOptions object.
@@ -70,9 +74,29 @@
   public SuffixesToReplicateOptions(Type type, Set<SuffixDescriptor> availableSuffixes,
       Set<SuffixDescriptor> suffixesToReplicate)
   {
+    this(type, availableSuffixes, suffixesToReplicate, new HashMap<String, BackendTypeUIAdapter>());
+  }
+
+  /**
+   * Constructor for the SuffixesToReplicateOptions object.
+   *
+   * @param type
+   *          the Type of DataReplicationOptions.
+   * @param availableSuffixes
+   *          The set of suffixes which are available for replication.
+   * @param suffixesToReplicate
+   *          The set of suffixes which user wants to replicate.
+   * @param backendsToReplicate
+   *          The map with backend name as keys and their associated backend type
+   *          as value.
+   */
+  public SuffixesToReplicateOptions(Type type, Set<SuffixDescriptor> availableSuffixes,
+      Set<SuffixDescriptor> suffixesToReplicate, Map<String, BackendTypeUIAdapter> backendsToReplicate)
+  {
     this.type = type;
     this.availableSuffixes = new LinkedHashSet<>(availableSuffixes);
     this.suffixesToReplicate = new LinkedHashSet<>(suffixesToReplicate);
+    this.backendsToReplicate = new HashMap<>(backendsToReplicate);
   }
 
   /**
@@ -105,4 +129,14 @@
   {
     return suffixesToReplicate;
   }
+
+  /**
+   * Returns a map which associate backend names and backend types.
+   *
+   * @return A map which associate backend names and backend types.
+   */
+  public Map<String, BackendTypeUIAdapter> getSuffixBackendTypes()
+  {
+    return backendsToReplicate;
+  }
 }
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
index 9525bfb..c85a450 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
@@ -31,26 +31,30 @@
 import java.awt.Component;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
+import java.awt.Insets;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeSet;
 
 import javax.swing.Box;
 import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
 import javax.swing.JEditorPane;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
 import javax.swing.SwingConstants;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.opends.admin.ads.ADSContext;
 import org.opends.admin.ads.ReplicaDescriptor;
-import org.opends.admin.ads.ServerDescriptor;
 import org.opends.admin.ads.SuffixDescriptor;
 import org.opends.quicksetup.Constants;
 import org.opends.quicksetup.UserData;
@@ -60,7 +64,11 @@
 import org.opends.quicksetup.ui.GuiApplication;
 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;
 
 /**
  * This class is used to provide a data model for the list of suffixes that we
@@ -70,8 +78,11 @@
 {
   private static final long serialVersionUID = -8051367953737385327L;
 
+  private static final Insets SUFFIXES_TO_REPLICATE_INSETS = new Insets(4, 4, 4, 4);
+
   private final Set<SuffixDescriptor> orderedSuffixes = new TreeSet<>(this);
   private final Map<String, JCheckBox> hmCheckBoxes = new HashMap<>();
+  private final Map<String, JComboBox<BackendTypeUIAdapter>> backendTypeComboBoxes = new HashMap<>();
   /**
    * The display of the server the user provided in the replication options
    * panel.
@@ -105,20 +116,40 @@
     }
     else if (fieldName == FieldName.SUFFIXES_TO_REPLICATE)
     {
-      Set<SuffixDescriptor> suffixes = new HashSet<>();
-      for (SuffixDescriptor suffix : orderedSuffixes)
-      {
-        if (hmCheckBoxes.get(suffix.getId()).isSelected())
-        {
-          suffixes.add(suffix);
-        }
-      }
-      return suffixes;
+      return getSelectedSuffixes();
+    }
+    else if (fieldName == FieldName.SUFFIXES_TO_REPLICATE_BACKEND_TYPE)
+    {
+      return getSelectedSuffixBackendTypes();
     }
 
     return null;
   }
 
+  private Set<SuffixDescriptor> getSelectedSuffixes()
+  {
+    Set<SuffixDescriptor> suffixes = new HashSet<>();
+    for (SuffixDescriptor suffix : orderedSuffixes)
+    {
+      if (hmCheckBoxes.get(suffix.getId()).isSelected())
+      {
+        suffixes.add(suffix);
+      }
+    }
+    return suffixes;
+  }
+
+  private Map<String, BackendTypeUIAdapter> getSelectedSuffixBackendTypes()
+  {
+    final Map<String, BackendTypeUIAdapter> backendTypes = new HashMap<>();
+    for (SuffixDescriptor suffix : getSelectedSuffixes())
+    {
+      final String backendName = suffix.getReplicas().iterator().next().getBackendName();
+      backendTypes.put(backendName, (BackendTypeUIAdapter) backendTypeComboBoxes.get(backendName).getSelectedItem());
+    }
+    return backendTypes;
+  }
+
   @Override
   public int compare(SuffixDescriptor desc1, SuffixDescriptor desc2)
   {
@@ -142,9 +173,8 @@
     gbc.fill = GridBagConstraints.HORIZONTAL;
     gbc.gridwidth = GridBagConstraints.REMAINDER;
     gbc.insets = UIFactory.getEmptyInsets();
-
     gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
-    gbc.insets.left = UIFactory.LEFT_INSET_SUBPANEL_SUBORDINATE;
+    gbc.insets.left = UIFactory.LEFT_INSET_BACKGROUND;
 
     // Add the checkboxes
     checkBoxPanel = new JPanel(new GridBagLayout());
@@ -154,9 +184,9 @@
     gbc.weighty = 1.0;
     gbc.fill = GridBagConstraints.BOTH;
     scroll = UIFactory.createBorderLessScrollBar(checkBoxPanel);
-
     panel.add(scroll, gbc);
 
+    gbc.insets.left = UIFactory.LEFT_INSET_SUBPANEL_SUBORDINATE;
     gbc.weighty = 0.0;
     gbc.fill = GridBagConstraints.HORIZONTAL;
     gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
@@ -249,40 +279,27 @@
   private void populateCheckBoxPanel()
   {
     checkBoxPanel.removeAll();
-    GridBagConstraints gbc = new GridBagConstraints();
-    gbc.gridy = 0;
+    final GridBagConstraints gbc = new GridBagConstraints();
     gbc.fill = GridBagConstraints.BOTH;
-    gbc.anchor = GridBagConstraints.NORTH;
-    boolean first = true;
-    for (SuffixDescriptor suffix : orderedSuffixes)
+    gbc.insets = SUFFIXES_TO_REPLICATE_INSETS;
+    gbc.gridy = 0;
+
+    final Map<String, Set<SuffixDescriptor>> backendToSuffixes = getSuffixesForBackends();
+    for (Map.Entry<String, Set<SuffixDescriptor>> backendData : backendToSuffixes.entrySet())
     {
-      gbc.insets.left = 0;
-      gbc.weightx = 0.0;
-      if (!first)
+      gbc.anchor = GridBagConstraints.LINE_START;
+      gbc.gridwidth = 1;
+      gbc.gridheight = 1;
+      for (SuffixDescriptor suffix : backendData.getValue())
       {
-        gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
+        gbc.gridx = 0;
+        final JCheckBox cb = hmCheckBoxes.get(suffix.getId());
+        checkBoxPanel.add(cb, gbc);
+        printReplicaTooltipButton(suffix, gbc);
+        gbc.gridy++;
       }
-      gbc.gridwidth = GridBagConstraints.RELATIVE;
-      JCheckBox cb = hmCheckBoxes.get(suffix.getId());
-      cb.setVerticalAlignment(SwingConstants.TOP);
-      gbc.gridx = 0;
-      checkBoxPanel.add(cb, gbc);
-      gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
-      gbc.weightx = 1.0;
-      gbc.gridwidth = GridBagConstraints.REMAINDER;
-      JEditorPane l = UIFactory.makeTextPane(
-              LocalizableMessage.raw(getSuffixString(suffix)),
-              UIFactory.TextStyle.SECONDARY_FIELD_VALID);
-
-      /* Use a prototype label to get the additional insets */
-      JEditorPane proto =
-          UIFactory.makeTextPane(LocalizableMessage.raw(suffix.getDN()), UIFactory.TextStyle.SECONDARY_FIELD_VALID);
-
-      gbc.insets.top += Math.abs(cb.getPreferredSize().height - proto.getPreferredSize().height) / 2;
-      gbc.gridx = 1;
-      checkBoxPanel.add(l, gbc);
-      first = false;
-      gbc.gridy++;
+      printBackendInformations(backendData, gbc);
+      printSeparatorLine(gbc);
     }
     gbc.weighty = 1.0;
     gbc.insets = UIFactory.getEmptyInsets();
@@ -290,15 +307,135 @@
     checkBoxPanel.add(Box.createVerticalGlue(), gbc);
   }
 
+  private Map<String, Set<SuffixDescriptor>> getSuffixesForBackends()
+  {
+    final Map<String, Set<SuffixDescriptor>> backendToSuffixes = new HashMap<>();
+    for (SuffixDescriptor suffix : orderedSuffixes)
+    {
+      final String backendName = suffix.getReplicas().iterator().next().getBackendName();
+      if (!backendToSuffixes.containsKey(backendName))
+      {
+        backendToSuffixes.put(backendName, new LinkedHashSet<SuffixDescriptor>());
+      }
+      backendToSuffixes.get(backendName).add(suffix);
+    }
+
+    return backendToSuffixes;
+  }
+
+  private void printReplicaTooltipButton(SuffixDescriptor suffix, GridBagConstraints gbc)
+  {
+    gbc.gridx++;
+    String imageDesc = "<html>";
+    for (ReplicaDescriptor replica : suffix.getReplicas())
+    {
+      imageDesc += getServerDisplay(replica) + "<br>";
+    }
+    final int entriesNb = suffix.getReplicas().iterator().next().getEntries();
+    final LocalizableMessage entriesNbToPrint = getNumberOfEntriesMsg(entriesNb);
+    imageDesc += entriesNbToPrint + "</html>";
+
+    final JLabel helpReplicasTooltip = new JLabel();
+    helpReplicasTooltip.setIcon(UIFactory.getImageIcon(IconType.HELP_MEDIUM));
+    helpReplicasTooltip.setToolTipText(imageDesc);
+    UIFactory.setTextStyle(helpReplicasTooltip, UIFactory.TextStyle.SECONDARY_FIELD_VALID);
+    checkBoxPanel.add(helpReplicasTooltip, gbc);
+  }
+
+  private LocalizableMessage getNumberOfEntriesMsg(int nEntries)
+  {
+    if (nEntries > 0)
+    {
+      return INFO_SUFFIX_LIST_REPLICA_DISPLAY_ENTRIES.get(nEntries);
+    }
+    else if (nEntries == 0)
+    {
+      return INFO_SUFFIX_LIST_REPLICA_DISPLAY_NO_ENTRIES.get();
+    }
+    else
+    {
+      return INFO_SUFFIX_LIST_REPLICA_DISPLAY_ENTRIES_NOT_AVAILABLE.get();
+    }
+  }
+
+  private void printBackendInformations(Map.Entry<String, Set<SuffixDescriptor>> backendData, GridBagConstraints gbc)
+  {
+    final int nbSuffixForBackend = backendData.getValue().size();
+    gbc.gridy -= nbSuffixForBackend;
+    printBackendNameText(backendData, gbc);
+    printComboBoxForSuffix(backendData.getValue().iterator().next(), gbc);
+    gbc.gridy += nbSuffixForBackend;
+  }
+
+  private void printSeparatorLine(GridBagConstraints gbc)
+  {
+    gbc.gridwidth = gbc.gridx;
+    gbc.gridx = 0;
+    checkBoxPanel.add(new JSeparator(SwingConstants.HORIZONTAL), gbc);
+    gbc.gridy++;
+  }
+
+  private void printBackendNameText(Entry<String, Set<SuffixDescriptor>> backendData, GridBagConstraints gbc)
+  {
+    gbc.gridx++;
+    final JEditorPane backendNameText = UIFactory.makeTextPane(
+        LocalizableMessage.raw(backendData.getKey()), UIFactory.TextStyle.SECONDARY_FIELD_VALID);
+    backendNameText.setToolTipText(INFO_REPLICATED_SUFFIXES_BACKEND_NAME_TOOLTIP.get().toString());
+    gbc.anchor = GridBagConstraints.CENTER;
+    checkBoxPanel.add(backendNameText, gbc);
+  }
+
+  private void printComboBoxForSuffix(SuffixDescriptor suffix, GridBagConstraints gbc)
+  {
+    gbc.gridx++;
+    gbc.anchor = GridBagConstraints.LINE_END;
+    gbc.insets = UIFactory.getEmptyInsets();
+    final ReplicaDescriptor backendData = suffix.getReplicas().iterator().next();
+    final JComboBox<BackendTypeUIAdapter> backendTypeComboBox =
+        new JComboBox<>(new BackendTypeHelper().getBackendTypeUIAdaptors());
+    backendTypeComboBox.setToolTipText(INFO_REPLICATED_SUFFIXES_BACKEND_TYPE_TOOLTIP.get().toString());
+    final Set<String> objectClasses = backendData.getObjectClasses();
+    backendTypeComboBox.setSelectedItem(getBackendTypeFromObjectClasses(objectClasses));
+    backendTypeComboBoxes.put(backendData.getBackendName(), backendTypeComboBox);
+    checkBoxPanel.add(backendTypeComboBox, gbc);
+    gbc.insets = SUFFIXES_TO_REPLICATE_INSETS;
+  }
+
+  /**
+   * Returns the concrete backend type corresponding to the provided object
+   * classes. If the backend is not found, returns the default backend of this
+   * server configuration.
+   *
+   * @param objectClasses
+   *          The set of object class with one should be a concrete backend
+   *          type.
+   * @return The concrete backend type corresponding to object classes or this
+   *         server default one.
+   */
+  private BackendTypeUIAdapter getBackendTypeFromObjectClasses(Set<String> objectClasses)
+  {
+    for (String objectClass : objectClasses)
+    {
+      BackendTypeUIAdapter adapter =
+          BackendTypeHelper.getBackendTypeAdapter(objectClass.replace(ConfigConstants.NAME_PREFIX_CFG, ""));
+      if (adapter != null)
+      {
+        return adapter;
+      }
+    }
+
+    return new BackendTypeHelper().getBackendTypeUIAdaptors()[0];
+  }
+
   private String getSuffixString(SuffixDescriptor desc)
   {
-    Set<LocalizableMessage> replicaDisplays = new TreeSet<>();
+    Set<String> replicaDisplays = new TreeSet<>();
     for (ReplicaDescriptor rep : desc.getReplicas())
     {
-      replicaDisplays.add(getReplicaDisplay(rep));
+      replicaDisplays.add(getServerDisplay(rep));
     }
     LocalizableMessageBuilder buf = new LocalizableMessageBuilder();
-    for (LocalizableMessage display : replicaDisplays)
+    for (String display : replicaDisplays)
     {
       if (buf.length() > 0)
       {
@@ -309,25 +446,10 @@
     return buf.toString();
   }
 
-  private LocalizableMessage getReplicaDisplay(ReplicaDescriptor replica)
+  private String getServerDisplay(ReplicaDescriptor replica)
   {
-    ServerDescriptor server = replica.getServer();
-    boolean isServerToConnect = server.getHostPort(false).equalsIgnoreCase(serverToConnectDisplay);
-    String serverDisplay = isServerToConnect ? serverToConnectDisplay : server.getHostPort(true);
-
-    int nEntries = replica.getEntries();
-    if (nEntries > 0)
-    {
-      return INFO_SUFFIX_LIST_REPLICA_DISPLAY_ENTRIES.get(serverDisplay, nEntries);
-    }
-    else if (nEntries == 0)
-    {
-      return INFO_SUFFIX_LIST_REPLICA_DISPLAY_NO_ENTRIES.get(serverDisplay);
-    }
-    else
-    {
-      return INFO_SUFFIX_LIST_REPLICA_DISPLAY_ENTRIES_NOT_AVAILABLE.get(serverDisplay);
-    }
+    final boolean isServerToConnect = replica.getServer().getHostPort(false).equalsIgnoreCase(serverToConnectDisplay);
+    return isServerToConnect ? serverToConnectDisplay : replica.getServer().getHostPort(true);
   }
 
   private Set<SuffixDescriptor> orderSuffixes(Set<SuffixDescriptor> suffixes)
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/FieldName.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/FieldName.java
index 9d0d109..ee9fba8 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/FieldName.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/FieldName.java
@@ -157,6 +157,9 @@
   /** The value associated with this is a Set of SuffixDescriptor. */
   SUFFIXES_TO_REPLICATE,
 
+  /** The value associated with this is a Map with String keys and BackendTypeUIAdapter values. */
+  SUFFIXES_TO_REPLICATE_BACKEND_TYPE,
+
   /** The value associated with this is a SuffixesToReplicateOptions.Type. */
   SUFFIXES_TO_REPLICATE_OPTIONS
 }
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java
index 841040c..630ca3d 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java
@@ -404,6 +404,8 @@
     SUBSECTION_RIGHT,
     /** Question icon. */
     HELP_SMALL,
+    /** Question medium icon. */
+    HELP_MEDIUM,
     /** Hourglass to display when the user must wait. */
     WAIT,
     /** 8 x 8 Hourglass to display when the user must wait. */
@@ -1340,6 +1342,10 @@
       key = INFO_HELP_SMALL_ICON.get();
       break;
 
+    case HELP_MEDIUM:
+      key = INFO_HELP_MEDIUM_ICON.get();
+      break;
+
     case ERROR:
       key = INFO_ERROR_ICON.get();
       break;
@@ -1413,6 +1419,7 @@
       return INFO_SUBSECTION_RIGHT_ICON_DESCRIPTION.get();
 
     case HELP_SMALL:
+    case HELP_MEDIUM:
       return INFO_HELP_SMALL_ICON_DESCRIPTION.get();
 
     case WAIT_TINY:
@@ -1480,6 +1487,7 @@
     case SUBSECTION_LEFT:
     case SUBSECTION_RIGHT:
     case HELP_SMALL:
+    case HELP_MEDIUM:
     case WAIT_TINY:
     case WAIT:
     case NO_ICON:
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java
index 67c5da5..569b97c 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java
@@ -94,6 +94,18 @@
       return backend.getUserFriendlyName().toString();
     }
 
+    @Override
+    public boolean equals(Object obj)
+    {
+      return obj instanceof BackendTypeUIAdapter && ((BackendTypeUIAdapter) obj).toString().equals(toString());
+    }
+
+    @Override
+    public int hashCode()
+    {
+      return super.hashCode();
+    }
+
     /**
      * Return the adapted backend object.
      *
diff --git a/opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/quickSetup.properties b/opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/quickSetup.properties
index 51bb664..4ff51c8 100644
--- a/opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/quickSetup.properties
+++ b/opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/quickSetup.properties
@@ -777,10 +777,10 @@
 INFO_SUBSECTION_RIGHT_ICON_DESCRIPTION=Decoration icon.
 INFO_SUFFIX_INITIALIZED_SUCCESSFULLY=Base DN initialized successfully.
 INFO_SUFFIX_LIST_EMPTY=-No Base DNs Found-
-INFO_SUFFIX_LIST_REPLICA_DISPLAY_ENTRIES=%s (%s entries)
-INFO_SUFFIX_LIST_REPLICA_DISPLAY_ENTRIES_NOT_AVAILABLE=%s (number of entries \
- not available)
-INFO_SUFFIX_LIST_REPLICA_DISPLAY_NO_ENTRIES=%s (no entries)
+INFO_SUFFIX_LIST_REPLICA_DISPLAY_ENTRIES=%s entries
+INFO_SUFFIX_LIST_REPLICA_DISPLAY_ENTRIES_NOT_AVAILABLE=number of entries \
+ not available
+INFO_SUFFIX_LIST_REPLICA_DISPLAY_NO_ENTRIES=no entries
 INFO_SUFFIXES_STEP=Data Replication
 INFO_SUFFIXES_TO_REPLICATE_DN_TOOLTIP=The Distinguished Name (DN) of the base \
  DN to replicate.
@@ -982,3 +982,9 @@
 INFO_BACKEND_TYPE_LABEL=Backend Type:
 INFO_BACKEND_TYPE_TOOLTIP=Select the type of backend in which you want to \
  store your data
+INFO_REPLICATED_SUFFIXES_BACKEND_TYPE_TOOLTIP=Select the type of backend \
+ that you want to use for replicated data
+INFO_REPLICATED_SUFFIXES_BACKEND_NAME_TOOLTIP=The name of the backend that \
+ will be used for replicated data
+INFO_HELP_MEDIUM_ICON=images/help_medium.gif
+

--
Gitblit v1.10.0