From fcdf613062b393888caef2496acce7ce6b49305d Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Fri, 04 Apr 2014 13:06:54 +0000
Subject: [PATCH] Checkpoint for OPENDJ-1303 "opendj-cli" - Added messages in order to decouple LDAPConnectionConsoleInteraction to dsconfig server package. - Added to Utils the getHostNameForLdapUrl (from ConnectionUtils)

---
 opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java          |   27 +++++++++++++++++++++++++++
 opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties |    9 +++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
index 47f5413..7d4c60c 100644
--- a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
+++ b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
@@ -588,4 +588,31 @@
         }
         return isOutOfMemory;
     }
+
+    /**
+     * Returns the string that can be used to represent a given host name in a LDAP URL.
+     * This method must be used when we have IPv6 addresses (the address in the LDAP URL
+     *  must be enclosed with brackets).
+     *  E.g:<pre>
+     *  -h "[2a01:e35:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]"
+     *  </pre>
+     *
+     * @param host
+     *            The host name.
+     * @return The String that can be used to represent a given host name in a LDAP URL.
+     */
+    public static String getHostNameForLdapUrl(String host) {
+        if (host != null && host.indexOf(":") != -1) {
+            // Assume an IPv6 address has been specified and adds the brackets
+            // for the URL.
+            host = host.trim();
+            if (!host.startsWith("[")) {
+                host = "[" + host;
+            }
+            if (!host.endsWith("]")) {
+                host = host + "]";
+            }
+        }
+        return host;
+    }
 }
diff --git a/opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties b/opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties
index c54e16c..3dfc2eb 100755
--- a/opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties
+++ b/opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties
@@ -950,4 +950,13 @@
  because you are connected to a server pretending to be %s:%s.\n\
  Before accepting this certificate, you should examine the server's \
  certificate carefully.
+ERR_ERROR_CANNOT_READ_CONNECTION_PARAMETERS=The connection \
+ parameters could not be read due to the following error: %s
+ERR_ERROR_NO_ADMIN_PASSWORD=No password was specified for \
+ administrator "%s"
+ERR_ERROR_BIND_PASSWORD_NONINTERACTIVE=The LDAP bind \
+ password was not specified and cannot be read interactively
+ERR_ERROR_INCOMPATIBLE_PROPERTY_MOD=The property \
+ modification "%s" is incompatible with another modification to the same \
+ property
  
\ No newline at end of file

--
Gitblit v1.10.0