From 97f85b9773902f106565d79a06c9172f62196572 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Fri, 14 Feb 2014 15:26:01 +0000
Subject: [PATCH] minor commit for OPENDJ-1343 Migrate dsconfig / OPENDJ-1303 "opendj-cli" - added return codes.

---
 opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java |   66 ++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 1 deletions(-)

diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java
index 81a4605..5d073ad 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java
@@ -24,6 +24,9 @@
  */
 package com.forgerock.opendj.cli;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * List of return codes used by CLIs.
  */
@@ -50,6 +53,10 @@
      */
     ERROR_USER_DATA(2),
     /**
+     * The LDAP result code for operations that fail due to a protocol error.
+     */
+    PROTOCOL_ERROR(2),
+    /**
      * Error server already installed.
      * <PRE>
      * Code value of 3.
@@ -71,7 +78,7 @@
      */
     ERROR_PASSWORD_LIMIT(5),
     /**
-     * The user cancelled the setup.
+     * The user cancelled the process.
      * <PRE>
      * Code value of 6.
      * </PRE>
@@ -85,6 +92,11 @@
      */
     ERROR_LICENSE_NOT_ACCEPTED(7),
     /**
+     * The LDAP result code for operations that fail because the requested
+     * authentication method is not supported.
+     */
+    AUTH_METHOD_NOT_SUPPORTED(7),
+    /**
      * Incompatible java version.
      * <PRE>
      * Code value of 8.
@@ -92,6 +104,11 @@
      */
     JAVA_VERSION_INCOMPATIBLE(8),
     /**
+     * The LDAP result code used for multi-stage SASL bind operations that are not
+     * yet complete.
+     */
+    SASL_BIND_IN_PROGRESS(14),
+    /**
      * The LDAP result code for operations that fail because a defined constraint
      * has been violated.
      */
@@ -102,6 +119,12 @@
      */
     NO_SUCH_OBJECT(32),
     /**
+     * The LDAP result code for operations that fail because the user supplied
+     * invalid credentials for an authentication attempt.
+     */
+    INVALID_CREDENTIALS(49),
+
+    /**
      * The LDAP result code for operations that fail because the client does not
      * have permission to perform the requested operation.
      */
@@ -124,6 +147,30 @@
      */
     CLIENT_SIDE_SERVER_DOWN(81),
     /**
+     * The client-side result code that indicates that a local error occurred that
+     * had nothing to do with interaction with the server.  This is for
+     * client-side use only and should never be transferred over protocol.
+     */
+    CLIENT_SIDE_LOCAL_ERROR(82),
+    /**
+     * The client-side result code that indicates that an error occurred while
+     * encoding a request to send to the server.  This is for client-side use only
+     * and should never be transferred over protocol.
+     */
+    CLIENT_SIDE_ENCODING_ERROR(83),
+    /**
+     * The client-side result code that indicates that an error occurred while
+     * decoding a response from the server.  This is for client-side use only and
+     * should never be transferred over protocol.
+     */
+    CLIENT_SIDE_DECODING_ERROR(84),
+    /**
+     * The client-side result code that indicates that the user requested an
+     * unknown or unsupported authentication mechanism.  This is for client-side
+     * use only and should never be transferred over protocol.
+     */
+    CLIENT_SIDE_AUTH_UNKNOWN(86),
+    /**
      * The client-side result code that indicates that the client was not able to
      * establish a connection to the server.  This is for client-side use only and
      * should never be transferred over protocol.
@@ -144,6 +191,12 @@
     TODO(99);
 
     private int returnCode;
+    private static final Map<Integer, String> RETURNCODE = new HashMap<Integer, String>();
+    static {
+        for (final ReturnCode rc : ReturnCode.values()) {
+            RETURNCODE.put(rc.get(), rc.name());
+        }
+    }
 
     private ReturnCode(int returnCode) {
         this.returnCode = returnCode;
@@ -157,4 +210,15 @@
     public int get() {
         return returnCode;
     }
+
+    /**
+     * Retrieves a string representation of the return code.
+     *
+     * @param code
+     *            The code value for which to obtain the string representation.
+     * @return The string representation of the return code.
+     */
+    public static String get(int code) {
+        return RETURNCODE.get(code);
+    }
 }

--
Gitblit v1.10.0