You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/09/03 21:04:24 UTC

svn commit: r439833 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ResultCode.java

Author: elecharny
Date: Sun Sep  3 12:04:23 2006
New Revision: 439833

URL: http://svn.apache.org/viewvc?view=rev&rev=439833
Log:
- Added a message to each resultCode
- removed the Partial_result code (don,'t know if it is used, and I 
didn't found it in any RFCs. It may be back again later if needed)

Modified:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ResultCode.java

Modified: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ResultCode.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ResultCode.java?view=diff&rev=439833&r1=439832&r2=439833
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ResultCode.java (original)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ResultCode.java Sun Sep  3 12:04:23 2006
@@ -138,22 +138,12 @@
     // operation request.
     // ------------------------------------------------------------------------
     /**
-     * Servers sends this result code to LDAP v2 clients to refer them to
-     * another LDAP server. When sending this code to a client, the server
-     * includes a newline-delimited list of LDAP URLs that identify another LDAP
-     * server. If the client identifies itself as an LDAP v3 client in the
-     * request, servers send an REFERRAL result code instead of this result
-     * code.
-     */
-    PARTIAL_RESULTS(9),
-
-    /**
      * It is returned when the client operation completed successfully without
      * errors. This code is one of 5 result codes that may be returned in the
      * LDAPResult which are not used to indicate an error. Applicable
      * operations: all except for Compare. Result code type: Non-Erroneous
      */
-    SUCCESS(0),
+    SUCCESS( 0, "success" ),
 
     /**
      * It is used to indicate that the result of a Compare operation is FALSE
@@ -161,7 +151,7 @@
      * error condition. Applicable operations: Compare. Result code type:
      * Non-Erroneous
      */
-    COMPARE_FALSE(5),
+    COMPARE_FALSE( 5, "compareFalse" ),
 
     /**
      * It is used to indicate that the result of a Compare operation is TRUE and
@@ -169,7 +159,7 @@
      * condition. Applicable operations: Compare. Result code type:
      * Non-Erroneous
      */
-    COMPARE_TRUE(6),
+    COMPARE_TRUE( 6, "compareTrue" ),
 
     /**
      * Rather than indicating an error, this result code is used to indicate
@@ -181,7 +171,7 @@
      * complete the request. This result code is new in LDAPv3. Applicable
      * operations: all. Result code type: Non-Erroneous
      */
-    REFERRAL(10),
+    REFERRAL( 10, "referral" ),
     
     /**
      * This result code is not an error response from the server, but rather, is
@@ -190,7 +180,7 @@
      * authentication process [RFC2251, Section 4.2.3]. This result code is new
      * in LDAPv3. Applicable operations: Bind. Result code type: Non-Erroneous
      */
-    SASL_BIND_IN_PROGRESS(14),
+    SASL_BIND_IN_PROGRESS( 14, "saslBindInProgress" ),
 
     // ------------------------------------------------------------------------
     // Problem Specific Error Codes:
@@ -212,7 +202,7 @@
      * the server. Applicable operations: Bind. Result code type: Specific
      * (Security)
      */
-    AUTH_METHOD_NOT_SUPPORTED(7),
+    AUTH_METHOD_NOT_SUPPORTED( 7, "authMethodNotSupported" ),
 
     /**
      * This error may be returned on a bind request if the server only accepts
@@ -225,8 +215,8 @@
      * Section 4.4.1] Applicable operations: all. Result code type: Specific
      * (Security)
      */
-    STRONG_AUTH_REQUIRED(8),
-    STRONGER_AUTH_REQUIRED(8), // In respect with RFC 4511 modification of par. 4.1.9
+    STRONG_AUTH_REQUIRED( 8, "strongAuthRequired" ),
+    STRONGER_AUTH_REQUIRED( 8, "strongerAuthRequired" ), // In respect with RFC 4511 modification of par. 4.1.9
 
     /**
      * This error code may be returned if the session is not protected by a
@@ -238,7 +228,7 @@
      * This error code is new in LDAPv3. Applicable operations: all. Result code
      * type: Specific (Security)
      */
-    CONFIDENTIALITY_REQUIRED(13),
+    CONFIDENTIALITY_REQUIRED( 13, "confidentialityRequired" ),
 
     /**
      * An alias was encountered in a situation where it was not allowed or where
@@ -249,7 +239,7 @@
      * INSUFFICIENTACCESSRIGHTS (50), but is specific to Searching on an alias.
      * Applicable operations: Search. Result code type: Specific (Security)
      */
-    ALIAS_DEREFERENCING_PROBLEM(36),
+    ALIAS_DEREFERENCING_PROBLEM( 36, "aliasDereferencingProblem" ),
 
     /**
      * This error should be returned by the server when the client has tried to
@@ -261,7 +251,7 @@
      * Section 12.7]. Applicable operations: Bind. Result code type: Specific
      * (Security)
      */
-    INAPPROPRIATE_AUTHENTICATION(48),
+    INAPPROPRIATE_AUTHENTICATION( 48, "inappropriateAuthentication" ),
 
     /**
      * This error code is returned if the DN or password used in a simple bind
@@ -273,7 +263,7 @@
      * insufficientAccessRights. Applicable operations: Bind. Result code type:
      * Specific (Security)
      */
-    INVALID_CREDENTIALS(49),
+    INVALID_CREDENTIALS( 49, "invalidCredentials" ),
 
     /**
      * The requestor does not have the right to carry out the requested
@@ -282,7 +272,7 @@
      * where the requestor has insufficientAccessRights. Applicable operations:
      * all except for Bind. Result code type: Specific (Security)
      */
-    INSUFFICIENT_ACCESS_RIGHTS(50),
+    INSUFFICIENT_ACCESS_RIGHTS( 50, "insufficientAccessRights" ),
 
     // ------------------------------------------------------------------------
     // Service Problem Specific Error Codes:
@@ -298,7 +288,7 @@
      * [RFC2251, Section 4.2.1] Applicable operations: all except Bind. Result
      * code type: Specific (Service)
      */
-    OPERATIONS_ERROR(1),
+    OPERATIONS_ERROR( 1, "operationsError" ),
     
     /**
      * A protocol error should be returned by the server when an invalid or
@@ -314,7 +304,7 @@
      * error in the error string. Applicable operations: all. Result code type:
      * Specific (Service)
      */
-    PROTOCOL_ERROR(2),
+    PROTOCOL_ERROR( 2, "protocolError" ),
 
     /**
      * This error should be returned when the time to perform an operation has
@@ -331,7 +321,7 @@
      * exceed the defined timelimit. Applicable operations: all. Result code
      * type: Specific (Service)
      */
-    TIME_LIMIT_EXCEEDED(3),
+    TIME_LIMIT_EXCEEDED( 3, "timeLimitExceeded" ),
 
     /**
      * This error should be returned when the number of results generated by a
@@ -341,7 +331,7 @@
      * results, equal in number to the size limit [X511, Section 7.5].
      * Applicable operations: Search. Result code type: Specific (Service)
      */
-    SIZE_LIMIT_EXCEEDED(4),
+    SIZE_LIMIT_EXCEEDED( 4, "sizeLimitExceeded" ),
 
     /**
      * The server has reached some limit set by an administrative authority, and
@@ -351,7 +341,7 @@
      * candidates [Net]. This error code is new in LDAPv3. Applicable
      * operations: all. Result code type: Specific (Service)
      */
-    ADMIN_LIMIT_EXCEEDED(11),
+    ADMIN_LIMIT_EXCEEDED( 11, "adminLimitExceeded" ),
 
     /**
      * The server was unable to satisfy the request because one or more critical
@@ -362,7 +352,7 @@
      * code is new in LDAPv3. Applicable operations: all. Result code type:
      * Specific (Service)
      */
-    UNAVAILABLE_CRITICAL_EXTENSION(12),
+    UNAVAILABLE_CRITICAL_EXTENSION( 12, "unavailableCriticalExtension" ),
 
     /**
      * This error code may be returned if the server is unable to process the
@@ -370,7 +360,7 @@
      * the request shortly the server will be able to process it then.
      * Applicable operations: all. Result code type: Specific (Service)
      */
-    BUSY(51),
+    BUSY( 51, "busy" ),
 
     /**
      * This error code is returned when the server is unavailable to process the
@@ -378,7 +368,7 @@
      * down [RFC2251, Section 4.2.3]. Applicable operations: all. Result code
      * type: Specific (Service)
      */
-    UNAVAILABLE(52),
+    UNAVAILABLE( 52, "unavailable" ),
     
     /**
      * This error code should be returned by the server when a client request is
@@ -394,14 +384,14 @@
      * If appropriate, details of the error should be provided in the error
      * message. Applicable operations: all. Result code type: Specific (Service)
      */
-    UNWILLING_TO_PERFORM(53),
+    UNWILLING_TO_PERFORM( 53, "unwillingToPerform" ),
 
     /**
      * This error may be returned by the server if it detects an alias or
      * referral loop, and is unable to satisfy the client's request. Applicable
      * operations: all. Result code type: Specific (Service)
      */
-    LOOP_DETECT(54),
+    LOOP_DETECT( 54, "loopDetect" ),
 
     // ------------------------------------------------------------------------
     // Attribute Problem Specific Error Codes:
@@ -415,7 +405,7 @@
      * the operation does not exist in the entry. Applicable operations: Modify,
      * Compare. Result code type: Specific (Attribute)
      */
-    NO_SUCH_ATTRIBUTE(16),
+    NO_SUCH_ATTRIBUTE( 16, "noSuchAttribute" ),
 
     /**
      * This error may be returned if the specified attribute is unrecognized by
@@ -427,14 +417,14 @@
      * Modify operations [X.511, Section 12.4]. Applicable operations: Modify,
      * Add. Result code type: Specific (Attribute)
      */
-    UNDEFINED_ATTRIBUTE_TYPE(17),
+    UNDEFINED_ATTRIBUTE_TYPE( 17, "undefinedAttributeType" ),
 
     /**
      * An attempt was made, e.g., in a filter, to use a matching rule not
      * defined for the attribute type concerned [X511, Section 12.4]. Applicable
      * operations: Search. Result code type: Specific (Attribute)
      */
-    INAPPROPRIATE_MATCHING(18),
+    INAPPROPRIATE_MATCHING( 18, "inappropriateMatching" ),
 
     /**
      * This error should be returned by the server if an attribute value
@@ -443,14 +433,14 @@
      * constraint on the content. Applicable operations: Modify, Add, ModifyDN.
      * Result code type: Specific (Attribute)
      */
-    CONSTRAINT_VIOLATION(19),
+    CONSTRAINT_VIOLATION( 19, "constraintViolation" ),
 
     /**
      * This error should be returned by the server if the value specified by the
      * client already exists within the attribute. Applicable operations:
      * Modify, Add. Result code type: Specific (Attribute)
      */
-    ATTRIBUTE_OR_VALUE_EXISTS(20),
+    ATTRIBUTE_OR_VALUE_EXISTS( 20, "attributeOrValueExists" ),
 
     /**
      * This error should be returned by the server if the attribute syntax for
@@ -458,7 +448,7 @@
      * unrecognized or invalid. Applicable operations: Modify, Add. Result code
      * type: Specific (Attribute)
      */
-    INVALID_ATTRIBUTE_SYNTAX(21),
+    INVALID_ATTRIBUTE_SYNTAX( 21, "invalidAttributeSyntax" ),
 
     // ------------------------------------------------------------------------
     // Name Problem Specific Error Codes:
@@ -488,13 +478,13 @@
      * does not have permission to view or modify the entry. Applicable
      * operations: all except for Bind. Result code type: Specific (Name)
      */
-    NO_SUCH_OBJECT(32),
+    NO_SUCH_OBJECT( 32, "noSuchObject" ),
     
     /**
      * An alias has been dereferenced which names no object [X511, Section 12.5]
      * Applicable operations: Search. Result code type: Specific (Name)
      */
-    ALIAS_PROBLEM(33),
+    ALIAS_PROBLEM( 33, "aliasProblem" ),
 
     /**
      * This error should be returned by the server if the DN syntax is
@@ -503,7 +493,7 @@
      * DSA ; in this case namingViolation should be returned instead. Applicable
      * operations: all. Result code type: Specific (Name)
      */
-    INVALID_DN_SYNTAX(34),
+    INVALID_DN_SYNTAX( 34, "invalidDNSyntax" ),
     
     // ------------------------------------------------------------------------
     // Update Problem Specific Error Codes:
@@ -521,7 +511,7 @@
      * 12.9]. Applicable operations: Add, ModifyDN. Result code type: Specific
      * (Update)
      */
-    NAMING_VIOLATION(64),
+    NAMING_VIOLATION( 64, "namingViolation" ),
     
     /**
      * This error should be returned if the operation requested by the user
@@ -535,7 +525,7 @@
      * permits are still present. Applicable operations: Add, Modify, ModifyDN.
      * Result code type: Specific (Update)
      */
-    OBJECT_CLASS_VIOLATION(65),
+    OBJECT_CLASS_VIOLATION( 65, "objectClassViolation" ),
 
     /**
      * This error should be returned if the client attempts to perform an
@@ -547,7 +537,7 @@
      * [X.511, Section 11.4.1]). Applicable operations: Delete, ModifyDN. Result
      * code type: Specific (Update)
      */
-    NOT_ALLOWED_ON_NON_LEAF(66),
+    NOT_ALLOWED_ON_NON_LEAF( 66, "notAllowedOnNonLeaf" ),
     
     /**
      * The attempted operation would affect the RDN (e.g., removal of an
@@ -557,7 +547,7 @@
      * should return the error notAllowedOnRDN. [RFC2251, Section 4.6]
      * Applicable operations: Modify. Result code type: Specific (Update)
      */
-    NOT_ALLOWED_ON_RDN(67),
+    NOT_ALLOWED_ON_RDN( 67, "notAllowedOnRDN" ),
 
     /**
      * This error should be returned by the server when the client attempts to
@@ -565,7 +555,7 @@
      * entry with the name of an entry which exists. Applicable operations: Add,
      * ModifyDN. Result code type: Specific (Update)
      */
-    ENTRY_ALREADY_EXISTS(68),
+    ENTRY_ALREADY_EXISTS( 68, "entryAlreadyExists" ),
 
     /**
      * An operation attempted to modify an object class that should not be
@@ -575,7 +565,7 @@
      * forms, structure rules etc. [X.511, Section 12.9]. Applicable operations:
      * Modify. Result code type: Specific (Update)
      */
-    OBJECT_CLASS_MODS_PROHIBITED(69),
+    OBJECT_CLASS_MODS_PROHIBITED( 69, "objectClassModsProhibited" ),
 
     /**
      * This error code should be returned to indicate that the operation could
@@ -588,7 +578,7 @@
      * entries and subtrees between servers [RFC2251, Section 4.9]. Applicable
      * operations: ModifyDN. Result code type: Specific (Update)
      */
-    AFFECTS_MULTIPLE_DSAS(71),
+    AFFECTS_MULTIPLE_DSAS( 71, "affectsMultipleDSAs" ),
     
     // ------------------------------------------------------------------------
     // General Error Codes:
@@ -605,18 +595,23 @@
      * of the error should be provided in the error message. Applicable
      * operations: all. Result code type: General
      */
-    OTHER(80);
+    OTHER( 80, "other" );
 
+    /** The code value */
     private int code;
     
+    /** The associated message */
+    private String message;
+    
     /**
      * Initialize the enum element, with a specific integer value.
      * @param code The numeric value associated with the error. It will
      * be used when we will generate the encoded message.
      */
-    ResultCode( int code )
+    ResultCode( int code, String message )
     {
     	this.code = code;
+        this.message = message;
     }
     
     /**
@@ -625,5 +620,13 @@
     public int getCode()
     {
     	return code;
+    }
+
+    /**
+     * @return The message associated with the error
+     */
+    public String getMessage()
+    {
+        return message;
     }
 }