From 486ffa6d0abfa0b91dc7ab22ee71758b5eecfb88 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 26 Sep 2007 18:57:15 +0000
Subject: [PATCH] Fix for 2306: configure replication encryption on or off in dsreplication and setup-gui

---
 opends/src/quicksetup/org/opends/quicksetup/UserData.java |   53 ++++++++++++++---------------------------------------
 1 files changed, 14 insertions(+), 39 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/UserData.java b/opends/src/quicksetup/org/opends/quicksetup/UserData.java
index 2e9dfed..08e406c 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/UserData.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/UserData.java
@@ -80,7 +80,7 @@
 
   private SuffixesToReplicateOptions suffixesToReplicateOptions;
 
-  private Map<ServerDescriptor, Integer> remoteWithNoReplicationPort;
+  private Map<ServerDescriptor, AuthenticationData> remoteWithNoReplicationPort;
 
   private boolean quiet;
 
@@ -119,12 +119,7 @@
     setDirectoryManagerDn(Constants.DIRECTORY_MANAGER_DN);
 
     setNewSuffixOptions(defaultNewSuffixOptions);
-    AuthenticationData data = new AuthenticationData();
-    data.setDn(Constants.DIRECTORY_MANAGER_DN);
-    data.setPort(389);
-    DataReplicationOptions repl = new DataReplicationOptions(
-        DataReplicationOptions.Type.STANDALONE, data,
-        getDefaultReplicationPort());
+    DataReplicationOptions repl = DataReplicationOptions.createStandalone();
     setReplicationOptions(repl);
     setGlobalAdministratorUID(Constants.GLOBAL_ADMIN_UID);
 
@@ -138,7 +133,8 @@
     sec.setSslPort(getDefaultSslPort());
     setSecurityOptions(sec);
 
-    remoteWithNoReplicationPort = new HashMap<ServerDescriptor, Integer>();
+    remoteWithNoReplicationPort =
+      new HashMap<ServerDescriptor, AuthenticationData>();
   }
 
   /**
@@ -596,29 +592,6 @@
   }
 
   /**
-   * Provides the port that will be proposed to the user in the replication
-   * options panel of the installation wizard. It will check whether we can use
-   * ports of type X989 and if not it will return -1.
-   *
-   * @return the free port of type X989 if it is available and we can use and -1
-   * if not.
-   */
-  static int getDefaultReplicationPort()
-  {
-    int defaultPort = -1;
-
-    for (int i=0;i<10000 && (defaultPort == -1);i+=1000)
-    {
-      int port = i + 8989;
-      if (Utils.canUseAsPort(port))
-      {
-        defaultPort = port;
-      }
-    }
-    return defaultPort;
-  }
-
-  /**
    * Provides the default host name that will be displayed.
    */
   private String getDefaultHostName()
@@ -639,13 +612,15 @@
    * corresponding to the Replication Port chosen by the user.
    *
    * Only the servers that have no replication port appear on this map.
-   * @return a Map containing as key a ServerDescriptor and as value an Integer
-   * corresponding to the Replication Port chosen by the user.
+   * @return a Map containing as key a ServerDescriptor and as value an
+   * AuthenticationData corresponding to the Replication Port chosen by the
+   * user.
    */
-  public Map<ServerDescriptor, Integer> getRemoteWithNoReplicationPort()
+  public Map<ServerDescriptor, AuthenticationData>
+  getRemoteWithNoReplicationPort()
   {
-    HashMap<ServerDescriptor, Integer> copy =
-      new HashMap<ServerDescriptor, Integer>();
+    HashMap<ServerDescriptor, AuthenticationData> copy =
+      new HashMap<ServerDescriptor, AuthenticationData>();
     copy.putAll(remoteWithNoReplicationPort);
     return copy;
   }
@@ -653,11 +628,11 @@
   /**
    * Sets a the Replication Ports chosen by the user in the remote servers.
    * @param remoteWithNoReplicationPort the Map containing as key a
-   * ServerDescriptor and as value an Integer corresponding to the Replication
-   * Port chosen by the user.
+   * ServerDescriptor and as value an AuthenticationData corresponding to the
+   * Replication Port chosen by the user.
    */
   public void setRemoteWithNoReplicationPort(
-      Map<ServerDescriptor, Integer> remoteWithNoReplicationPort)
+      Map<ServerDescriptor, AuthenticationData> remoteWithNoReplicationPort)
   {
     this.remoteWithNoReplicationPort.clear();
     this.remoteWithNoReplicationPort.putAll(remoteWithNoReplicationPort);

--
Gitblit v1.10.0