From a3decf6f3114f51764c1bbe80a892c6e9d1fe2b7 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 02 Nov 2007 12:05:52 +0000
Subject: [PATCH] The following modifications are aimed to have the same interaction in the status and dsconfig command lines by sharing the same code. The formatting of the table in status command-line has also be modified to be consistent with the one provided by dsconfig.

---
 opendj-sdk/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java b/opendj-sdk/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
index f4e8b70..7282949 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
@@ -263,7 +263,23 @@
   public void run()
           throws ArgumentException
   {
-    boolean secureConnection =
+    run(true, true);
+  }
+
+
+  /**
+   * Interact with the user though the console to get information
+   * necessary to establish an LDAP connection.
+   * @param canUseSSL whether we can propose to connect using SSL or not.
+   * @param canUseStartTLS whether we can propose to connect using Start TLS or
+   * not.
+   *
+   * @throws ArgumentException if there is a problem with the arguments
+   */
+  public void run(boolean canUseSSL, boolean canUseStartTLS)
+          throws ArgumentException
+  {
+    boolean secureConnection = (canUseSSL || canUseStartTLS) &&
       (
           secureArgsList.useSSLArg.isPresent()
           ||
@@ -382,6 +398,14 @@
         {
           continue ;
         }
+        if (!canUseSSL && p.equals(Protocols.SSL))
+        {
+          continue;
+        }
+        if (!canUseStartTLS && p.equals(Protocols.START_TLS))
+        {
+          continue;
+        }
         int i = builder.addNumberedOption(p.getMenuMessage(), MenuResult
             .success(p.getChoice()));
         if (p.equals(defaultProtocol))
@@ -1083,6 +1107,16 @@
   }
 
   /**
+   * Sets the port number name that should be used for connections based on
+   * this interaction.
+   *
+   * @param portNumber port number for connections
+   */
+  public void setPortNumber(int portNumber) {
+    this.portNumber = portNumber;
+  }
+
+  /**
    * Gets the bind DN name that should be used for connections based on
    * this interaction.
    *

--
Gitblit v1.10.0