001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 package org.apache.directory.shared.ldap.message; 021 022 023 import java.util.Collections; 024 import java.util.HashSet; 025 import java.util.Set; 026 027 import javax.naming.CommunicationException; 028 import javax.naming.LimitExceededException; 029 import javax.naming.PartialResultException; 030 import javax.naming.SizeLimitExceededException; 031 032 import org.apache.directory.shared.ldap.codec.MessageTypeEnum; 033 import org.apache.directory.shared.ldap.exception.LdapAttributeInUseException; 034 import org.apache.directory.shared.ldap.exception.LdapAuthenticationException; 035 import org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException; 036 import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException; 037 import org.apache.directory.shared.ldap.exception.LdapEntryAlreadyExistsException; 038 import org.apache.directory.shared.ldap.exception.LdapException; 039 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeTypeException; 040 import org.apache.directory.shared.ldap.exception.LdapInvalidSearchFilterException; 041 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException; 042 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException; 043 import org.apache.directory.shared.ldap.exception.LdapNoSuchObjectException; 044 import org.apache.directory.shared.ldap.exception.LdapOperationException; 045 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException; 046 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException; 047 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException; 048 import org.apache.directory.shared.ldap.exception.LdapServiceUnavailableException; 049 import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException; 050 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException; 051 052 053 /** 054 * Type safe LDAP message envelope result code enumeration. The resultCode is a 055 * parameter of the LDAPResult which is the construct used in this protocol to 056 * return success or failure indications from servers to clients. In response to 057 * various requests servers will return responses containing fields of type 058 * LDAPResult to indicate the final status of a protocol operation request. This 059 * enumeration represents the various status codes associated with an 060 * LDAPResult, hence it is called the ResultCodeEnum. Here are the definitions 061 * and values for error codes from section 4.1.10 of <a 062 * href="http://www.faqs.org/rfcs/rfc2251.html">RFC 2251</a>: 063 * 064 * <pre><code> 065 * resultCode 066 * ENUMERATED { 067 * success (0), 068 * operationsError (1), 069 * protocolError (2), 070 * timeLimitExceeded (3), 071 * sizeLimitExceeded (4), 072 * compareFalse (5), 073 * compareTrue (6), 074 * authMethodNotSupported (7), 075 * strongAuthRequired (8), 076 * partialResults (9), -- new 077 * referral (10), -- new 078 * adminLimitExceeded (11), -- new 079 * unavailableCriticalExtension (12), -- new 080 * confidentialityRequired (13), -- new 081 * saslBindInProgress (14), -- new 082 * noSuchAttribute (16), 083 * undefinedAttributeType (17), 084 * inappropriateMatching (18), 085 * constraintViolation (19), 086 * attributeOrValueExists (20), 087 * invalidAttributeSyntax (21), 088 * -- 22-31 unused -- 089 * NO_SUCH_OBJECT (32), 090 * aliasProblem (33), 091 * invalidDNSyntax (34), 092 * -- 35 reserved for undefined isLeaf -- 093 * aliasDereferencingProblem (36), 094 * -- 37-47 unused -- 095 * inappropriateAuthentication (48), 096 * invalidCredentials (49), 097 * insufficientAccessRights (50), 098 * busy (51), 099 * unavailable (52), 100 * unwillingToPerform (53), 101 * loopDetect (54), 102 * -- 55-63 unused -- 103 * namingViolation (64), 104 * objectClassViolation (65), 105 * notAllowedOnNonLeaf (66), 106 * notAllowedOnRDN (67), 107 * entryAlreadyExists (68), 108 * objectClassModsProhibited (69), 109 * -- 70 reserved for CLDAP -- 110 * affectsMultipleDSAs (71), -- new 111 * -- 72-79 unused -- 112 * other (80) }, 113 * -- 81-90 reserved for APIs -- 114 * </code></pre> 115 * 116 * All the result codes with the exception of success, compareFalse and 117 * compareTrue are to be treated as meaning the operation could not be completed 118 * in its entirety. Most of the result codes are based on problem indications 119 * from X.511 error data types. Result codes from 16 to 21 indicate an 120 * AttributeProblem, codes 32, 33, 34 and 36 indicate a NameProblem, codes 48, 121 * 49 and 50 indicate a SecurityProblem, codes 51 to 54 indicate a 122 * ServiceProblem, and codes 64 to 69 and 71 indicates an UpdateProblem. If a 123 * client receives a result code which is not listed above, it is to be treated 124 * as an unknown error condition. The majority of this javadoc was pasted in 125 * from RFC 2251. There's and expired draft out there on error codes which makes 126 * alot of sense: <a 127 * href="http://www.alternic.org/drafts/drafts-j-k/draft-just-ldapv3-rescodes- 128 * 02.html"> ietf (expired) draft</a> on error codes (read at your discretion). 129 * Result codes have been identified and split into categories: 130 * <ul> 131 * <li> Non-Erroneous: Five result codes that may be returned in LDAPResult are 132 * not used to indicate an error. </li> 133 * <li> General: returned only when no suitable specific error exists. </li> 134 * <li> Specific: Specific errors are used to indicate that a particular type of 135 * error has occurred. These error types are: 136 * <ul> 137 * <li> Name, </li> 138 * <li> Update, </li> 139 * <li> Attribute </li> 140 * <li> Security, and </li> 141 * <li> Service </li> 142 * </ul> 143 * </li> 144 * </ul> 145 * The result codes are also grouped according to the following LDAP operations 146 * which return responses: 147 * <ul> 148 * <li> bind </li> 149 * <li> search </li> 150 * <li> modify </li> 151 * <li> modifyDn </li> 152 * <li> add </li> 153 * <li> delete </li> 154 * <li> compare </li> 155 * <li> extended </li> 156 * </ul> 157 * 158 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 159 * @version $Revision: 930278 $ 160 */ 161 public enum ResultCodeEnum 162 { 163 // ------------------------------------------------------------------------ 164 // Public Static Constants: Enumeration values and names. 165 // ------------------------------------------------------------------------ 166 // ------------------------------------------------------------------------ 167 // Non Erroneous Codes: 168 // 169 // Five result codes that may be returned in LDAPResult are not used to 170 // indicate an error. These result codes are listed below. The first 171 // three codes, indicate to the client that no further action is required 172 // in order to satisfy their request. In contrast, the last two errors 173 // require further action by the client in order to complete their original 174 // operation request. 175 // ------------------------------------------------------------------------ 176 177 /** 178 * It is returned when the client operation completed successfully without 179 * errors. This code is one of 5 result codes that may be returned in the 180 * LDAPResult which are not used to indicate an error. Applicable 181 * operations: all except for Compare. Result code type: Non-Erroneous 182 */ 183 SUCCESS( 0 ), 184 185 /** 186 * Servers sends this result code to LDAP v2 clients to refer them to 187 * another LDAP server. When sending this code to a client, the server 188 * includes a newline-delimited list of LDAP URLs that identify another LDAP 189 * server. If the client identifies itself as an LDAP v3 client in the 190 * request, servers send an REFERRAL result code instead of this result 191 * code. 192 */ 193 PARTIAL_RESULTS( 9 ), 194 195 /** 196 * It is used to indicate that the result of a Compare operation is FALSE 197 * and does not indicate an error. 1 of 5 codes that do not indicate an 198 * error condition. Applicable operations: Compare. Result code type: 199 * Non-Erroneous 200 */ 201 COMPARE_FALSE( 5 ), 202 203 /** 204 * It is used to indicate that the result of a Compare operation is TRUE and 205 * does not indicate an error. 1 of 5 codes that do not indicate an error 206 * condition. Applicable operations: Compare. Result code type: 207 * Non-Erroneous 208 */ 209 COMPARE_TRUE( 6 ), 210 211 /** 212 * Rather than indicating an error, this result code is used to indicate 213 * that the server does not hold the target entry of the request but is able 214 * to provide alternative servers that may. A set of server(s) URLs may be 215 * returned in the referral field, which the client may subsequently query 216 * to attempt to complete their operation. 1 of 5 codes that do not indicate 217 * an error condition yet requires further action on behalf of the client to 218 * complete the request. This result code is new in LDAPv3. Applicable 219 * operations: all. Result code type: Non-Erroneous 220 */ 221 REFERRAL( 10 ), 222 223 /** 224 * This result code is not an error response from the server, but rather, is 225 * a request for bind continuation. The server requires the client to send a 226 * new bind request, with the same SASL mechanism, to continue the 227 * authentication process [RFC2251, Section 4.2.3]. This result code is new 228 * in LDAPv3. Applicable operations: Bind. Result code type: Non-Erroneous 229 */ 230 SASL_BIND_IN_PROGRESS( 14 ), 231 232 // ------------------------------------------------------------------------ 233 // Problem Specific Error Codes: 234 // 235 // Specific errors are used to indicate that a particular type of error 236 // has occurred. These error types are Name, Update, Attribute, Security, 237 // and Service. 238 // ------------------------------------------------------------------------ 239 // ------------------------------------------------------------------------ 240 // Security Problem Specific Error Codes: 241 // 242 // A security error reports a problem in carrying out an operation for 243 // security reasons [X511, Section 12.7]. 244 // ------------------------------------------------------------------------ 245 246 /** 247 * This error code should be returned if the client requests, in a Bind 248 * request, an authentication method which is not supported or recognized by 249 * the server. Applicable operations: Bind. Result code type: Specific 250 * (Security) 251 */ 252 AUTH_METHOD_NOT_SUPPORTED( 7 ), 253 254 /** 255 * This error may be returned on a bind request if the server only accepts 256 * strong authentication or it may be returned when a client attempts an 257 * operation which requires the client to be strongly authenticated - for 258 * example Delete. This result code may also be returned in an unsolicited 259 * notice of disconnection if the server detects that an established 260 * underlying security association protecting communication between the 261 * client and server has unexpectedly failed or been compromised. [RFC2251, 262 * Section 4.4.1] Applicable operations: all. Result code type: Specific 263 * (Security) 264 */ 265 STRONG_AUTH_REQUIRED( 8 ), 266 267 /** 268 * This error code may be returned if the session is not protected by a 269 * protocol which provides session confidentiality. For example, if the 270 * client did not establish a TLS connection using a cipher suite which 271 * provides confidentiality of the session before sending any other 272 * requests, and the server requires session confidentiality then the server 273 * may reject that request with a result code of confidentialityRequired. 274 * This error code is new in LDAPv3. Applicable operations: all. Result code 275 * type: Specific (Security) 276 */ 277 CONFIDENTIALITY_REQUIRED( 13 ), 278 279 /** 280 * An alias was encountered in a situation where it was not allowed or where 281 * access was denied [X511, Section 12.5]. For example, if the client does 282 * not have read permission for the aliasedObjectName attribute and its 283 * value then the error aliasDereferencingProblem should be returned. [X511, 284 * Section 7.11.1.1] Notice that this error has similar meaning to 285 * INSUFFICIENT_ACCESS_RIGHTS (50), but is specific to Searching on an alias. 286 * Applicable operations: Search. Result code type: Specific (Security) 287 */ 288 ALIAS_DEREFERENCING_PROBLEM( 36 ), 289 290 /** 291 * This error should be returned by the server when the client has tried to 292 * use a method of authentication that is inappropriate, that is a method of 293 * authentication which the client is unable to use correctly. In other 294 * words, the level of security associated with the requestor's credentials 295 * is inconsistent with the level of protection requested, e.g. simple 296 * credentials were supplied while strong credentials were required [X511, 297 * Section 12.7]. Applicable operations: Bind. Result code type: Specific 298 * (Security) 299 */ 300 INAPPROPRIATE_AUTHENTICATION( 48 ), 301 302 /** 303 * This error code is returned if the DN or password used in a simple bind 304 * operation is incorrect, or if the DN or password is incorrect for some 305 * other reason, e.g. the password has expired. This result code only 306 * applies to Bind operations -- it should not be returned for other 307 * operations if the client does not have sufficient permission to perform 308 * the requested operation - in this case the return code should be 309 * insufficientAccessRights. Applicable operations: Bind. Result code type: 310 * Specific (Security) 311 */ 312 INVALID_CREDENTIALS( 49 ), 313 314 /** 315 * The requestor does not have the right to carry out the requested 316 * operation [X511, Section 12.7]. Note that the more specific 317 * aliasDereferencingProblem is returned in case of a Search on an alias 318 * where the requestor has insufficientAccessRights. Applicable operations: 319 * all except for Bind. Result code type: Specific (Security) 320 */ 321 INSUFFICIENT_ACCESS_RIGHTS( 50 ), 322 323 // ------------------------------------------------------------------------ 324 // Service Problem Specific Error Codes: 325 // 326 // A service error reports a problem related to the provision of the 327 // service [X511, Section 12.8]. 328 // ------------------------------------------------------------------------ 329 330 /** 331 * If the server requires that the client bind before browsing or modifying 332 * the directory, the server MAY reject a request other than binding, 333 * unbinding or an extended request with the "operationsError" result. 334 * [RFC2251, Section 4.2.1] Applicable operations: all except Bind. Result 335 * code type: Specific (Service) 336 */ 337 OPERATIONS_ERROR( 1 ), 338 339 /** 340 * A protocol error should be returned by the server when an invalid or 341 * malformed request is received from the client. This may be a request that 342 * is not recognized as an LDAP request, for example, if a nonexistent 343 * operation were specified in LDAPMessage. As well, it may be the result of 344 * a request that is missing a required parameter, such as a search filter 345 * in a search request. If the server can return an error, which is more 346 * specific than protocolError, then this error should be returned instead. 347 * For example if the server does not recognize the authentication method 348 * requested by the client then the error authMethodNotSupported should be 349 * returned instead of protocolError. The server may return details of the 350 * error in the error string. Applicable operations: all. Result code type: 351 * Specific (Service) 352 */ 353 PROTOCOL_ERROR( 2 ), 354 355 /** 356 * This error should be returned when the time to perform an operation has 357 * exceeded either the time limit specified by the client (which may only be 358 * set by the client in a search operation) or the limit specified by the 359 * server. If the time limit is exceeded on a search operation then the 360 * result is an arbitrary selection of the accumulated results [X511, 361 * Section 7.5]. Note that an arbitrary selection of results may mean that 362 * no results are returned to the client. If the LDAP server is a front end 363 * for an X.500 server, any operation that is chained may exceed the 364 * timelimit, therefore clients can expect to receive timelimitExceeded for 365 * all operations. For stand alone LDAP- Servers that do not implement 366 * chaining it is unlikely that operations other than search operations will 367 * exceed the defined timelimit. Applicable operations: all. Result code 368 * type: Specific (Service) 369 */ 370 TIME_LIMIT_EXCEEDED( 3 ), 371 372 /** 373 * This error should be returned when the number of results generated by a 374 * search exceeds the maximum number of results specified by either the 375 * client or the server. If the size limit is exceeded then the results of a 376 * search operation will be an arbitrary selection of the accumulated 377 * results, equal in number to the size limit [X511, Section 7.5]. 378 * Applicable operations: Search. Result code type: Specific (Service) 379 */ 380 SIZE_LIMIT_EXCEEDED( 4 ), 381 382 /** 383 * The server has reached some limit set by an administrative authority, and 384 * no partial results are available to return to the user [X511, Section 385 * 12.8]. For example, there may be an administrative limit to the number of 386 * entries a server will check when gathering potential search result 387 * candidates [Net]. This error code is new in LDAPv3. Applicable 388 * operations: all. Result code type: Specific (Service) 389 */ 390 ADMIN_LIMIT_EXCEEDED( 11 ), 391 392 /** 393 * The server was unable to satisfy the request because one or more critical 394 * extensions were not available [X511, Section 12.8]. This error is 395 * returned, for example, when a control submitted with a request is marked 396 * critical but is not recognized by a server or when such a control is not 397 * appropriate for the operation type. [RFC2251 section 4.1.12]. This error 398 * code is new in LDAPv3. Applicable operations: all. Result code type: 399 * Specific (Service) 400 */ 401 UNAVAILABLE_CRITICAL_EXTENSION( 12 ), 402 403 /** 404 * This error code may be returned if the server is unable to process the 405 * client's request at this time. This implies that if the client retries 406 * the request shortly the server will be able to process it then. 407 * Applicable operations: all. Result code type: Specific (Service) 408 */ 409 BUSY( 51 ), 410 411 /** 412 * This error code is returned when the server is unavailable to process the 413 * client's request. This usually means that the LDAP server is shutting 414 * down [RFC2251, Section 4.2.3]. Applicable operations: all. Result code 415 * type: Specific (Service) 416 */ 417 UNAVAILABLE( 52 ), 418 419 /** 420 * This error code should be returned by the server when a client request is 421 * properly formed but which the server is unable to complete due to 422 * server-defined restrictions. For example, the server, or some part of it, 423 * is not prepared to execute this request, e.g. because it would lead to 424 * excessive consumption of resources or violates the policy of an 425 * Administrative Authority involved [X511, Section 12.8]. If the server is 426 * able to return a more specific error code such as adminLimitExceeded it 427 * should. This error may also be returned if the client attempts to modify 428 * attributes which can not be modified by users, e.g., operational 429 * attributes such as creatorsName or createTimestamp [X511, Section 7.12]. 430 * If appropriate, details of the error should be provided in the error 431 * message. Applicable operations: all. Result code type: Specific (Service) 432 */ 433 UNWILLING_TO_PERFORM( 53 ), 434 435 /** 436 * This error may be returned by the server if it detects an alias or 437 * referral loop, and is unable to satisfy the client's request. Applicable 438 * operations: all. Result code type: Specific (Service) 439 */ 440 LOOP_DETECT( 54 ), 441 442 // ------------------------------------------------------------------------ 443 // Attribute Problem Specific Error Codes: 444 // 445 // An attribute error reports a problem related to an attribute specified 446 // by the client in their request message. 447 // ------------------------------------------------------------------------ 448 449 /** 450 * This error may be returned if the attribute specified as an argument of 451 * the operation does not exist in the entry. Applicable operations: Modify, 452 * Compare. Result code type: Specific (Attribute) 453 */ 454 NO_SUCH_ATTRIBUTE( 16 ), 455 456 /** 457 * This error may be returned if the specified attribute is unrecognized by 458 * the server, since it is not present in the server's defined schema. If 459 * the server doesn't recognize an attribute specified in a search request 460 * as the attribute to be returned the server should not return an error in 461 * this case - it should just return values for the requested attributes it 462 * does recognize. Note that this result code only applies to the Add and 463 * Modify operations [X.511, Section 12.4]. Applicable operations: Modify, 464 * Add. Result code type: Specific (Attribute) 465 */ 466 UNDEFINED_ATTRIBUTE_TYPE( 17 ), 467 468 /** 469 * An attempt was made, e.g., in a filter, to use a matching rule not 470 * defined for the attribute type concerned [X511, Section 12.4]. Applicable 471 * operations: Search. Result code type: Specific (Attribute) 472 */ 473 INAPPROPRIATE_MATCHING( 18 ), 474 475 /** 476 * This error should be returned by the server if an attribute value 477 * specified by the client violates the constraints placed on the attribute 478 * as it was defined in the DSA - this may be a size constraint or a 479 * constraint on the content. Applicable operations: Modify, Add, ModifyDN. 480 * Result code type: Specific (Attribute) 481 */ 482 CONSTRAINT_VIOLATION( 19 ), 483 484 /** 485 * This error should be returned by the server if the value specified by the 486 * client already exists within the attribute. Applicable operations: 487 * Modify, Add. Result code type: Specific (Attribute) 488 */ 489 ATTRIBUTE_OR_VALUE_EXISTS( 20 ), 490 491 /** 492 * This error should be returned by the server if the attribute syntax for 493 * the attribute value, specified as an argument of the operation, is 494 * unrecognized or invalid. Applicable operations: Modify, Add. Result code 495 * type: Specific (Attribute) 496 */ 497 INVALID_ATTRIBUTE_SYNTAX( 21 ), 498 499 // ------------------------------------------------------------------------ 500 // Name Problem Specific Error Codes: 501 // 502 // A name error reports a problem related to the distinguished name 503 // provided as an argument to an operation [X511, Section 12.5]. 504 // 505 // For result codes of NO_SUCH_OBJECT, aliasProblem, invalidDNSyntax and 506 // aliasDereferencingProblem (see Section 5.2.2.3.7), the matchedDN 507 // field is set to the name of the lowest entry (object or alias) in the 508 // directory that was matched. If no aliases were dereferenced while 509 // attempting to locate the entry, this will be a truncated form of the 510 // name provided, or if aliases were dereferenced, of the resulting 511 // name, as defined in section 12.5 of X.511 [X511]. The matchedDN field 512 // is to be set to a zero length string with all other result codes 513 // [RFC2251, Section 4.1.10]. 514 // ------------------------------------------------------------------------ 515 516 /** 517 * This error should only be returned if the target object cannot be found. 518 * For example, in a search operation if the search base can not be located 519 * in the DSA the server should return NO_SUCH_OBJECT. If, however, the search 520 * base is found but does not match the search filter, success, with no 521 * resultant objects, should be returned instead of NO_SUCH_OBJECT. If the 522 * LDAP server is a front end for an X.500 DSA then NO_SUCH_OBJECT may also be 523 * returned if discloseOnError is not granted for an entry and the client 524 * does not have permission to view or modify the entry. Applicable 525 * operations: all except for Bind. Result code type: Specific (Name) 526 */ 527 NO_SUCH_OBJECT( 32 ), 528 529 /** 530 * An alias has been dereferenced which names no object [X511, Section 12.5] 531 * Applicable operations: Search. Result code type: Specific (Name) 532 */ 533 ALIAS_PROBLEM( 33 ), 534 535 /** 536 * This error should be returned by the server if the DN syntax is 537 * incorrect. It should not be returned if the DN is correctly formed but 538 * represents an entry which is not permitted by the structure rules at the 539 * DSA ; in this case namingViolation should be returned instead. Applicable 540 * operations: all. Result code type: Specific (Name) 541 */ 542 INVALID_DN_SYNTAX( 34 ), 543 544 // ------------------------------------------------------------------------ 545 // Update Problem Specific Error Codes: 546 // 547 // An update error reports problems related to attempts to add, delete, or 548 // modify information in the DIB [X511, Section 12.9]. 549 // ------------------------------------------------------------------------ 550 551 /** 552 * The attempted addition or modification would violate the structure rules 553 * of the DIT as defined in the directory schema and X.501. That is, it 554 * would place an entry as the subordinate of an alias entry, or in a region 555 * of the DIT not permitted to a member of its object class, or would define 556 * an RDN for an entry to include a forbidden attribute type [X511, Section 557 * 12.9]. Applicable operations: Add, ModifyDN. Result code type: Specific 558 * (Update) 559 */ 560 NAMING_VIOLATION( 64 ), 561 562 /** 563 * This error should be returned if the operation requested by the user 564 * would violate the objectClass requirements for the entry if carried out. 565 * On an add or modify operation this would result from trying to add an 566 * object class without a required attribute, or by trying to add an 567 * attribute which is not permitted by the current object class set in the 568 * entry. On a modify operation this may result from trying to remove a 569 * required attribute without removing the associated auxiliary object 570 * class, or by attempting to remove an object class while the attributes it 571 * permits are still present. Applicable operations: Add, Modify, ModifyDN. 572 * Result code type: Specific (Update) 573 */ 574 OBJECT_CLASS_VIOLATION( 65 ), 575 576 /** 577 * This error should be returned if the client attempts to perform an 578 * operation which is permitted only on leaf entries - e.g., if the client 579 * attempts to delete a non-leaf entry. If the directory does not permit 580 * ModifyDN for non-leaf entries then this error may be returned if the 581 * client attempts to change the DN of a non-leaf entry. (Note that 1988 582 * edition X.500 servers only permitted change of the RDN of an entry's DN 583 * [X.511, Section 11.4.1]). Applicable operations: Delete, ModifyDN. Result 584 * code type: Specific (Update) 585 */ 586 NOT_ALLOWED_ON_NON_LEAF( 66 ), 587 588 /** 589 * The attempted operation would affect the RDN (e.g., removal of an 590 * attribute which is a part of the RDN) [X511, Section 12.9]. If the client 591 * attempts to remove from an entry any of its distinguished values, those 592 * values which form the entry's relative distinguished name the server 593 * should return the error notAllowedOnRDN. [RFC2251, Section 4.6] 594 * Applicable operations: Modify. Result code type: Specific (Update) 595 */ 596 NOT_ALLOWED_ON_RDN( 67 ), 597 598 /** 599 * This error should be returned by the server when the client attempts to 600 * add an entry which already exists, or if the client attempts to rename an 601 * entry with the name of an entry which exists. Applicable operations: Add, 602 * ModifyDN. Result code type: Specific (Update) 603 */ 604 ENTRY_ALREADY_EXISTS( 68 ), 605 606 /** 607 * An operation attempted to modify an object class that should not be 608 * modified, e.g., the structural object class of an entry. Some servers may 609 * not permit object class modifications, especially modifications to the 610 * structural object class since this may change the entry entirely, name 611 * forms, structure rules etc. [X.511, Section 12.9]. Applicable operations: 612 * Modify. Result code type: Specific (Update) 613 */ 614 OBJECT_CLASS_MODS_PROHIBITED( 69 ), 615 616 /** 617 * This error code should be returned to indicate that the operation could 618 * not be performed since it affects more than one DSA. This error code is 619 * new for LDAPv3. X.500 restricts the ModifyDN operation to only affect 620 * entries that are contained within a single server. If the LDAP server is 621 * mapped onto DAP, then this restriction will apply, and the resultCode 622 * affectsMultipleDSAs will be returned if this error occurred. In general 623 * clients MUST NOT expect to be able to perform arbitrary movements of 624 * entries and subtrees between servers [RFC2251, Section 4.9]. Applicable 625 * operations: ModifyDN. Result code type: Specific (Update) 626 */ 627 AFFECTS_MULTIPLE_DSAS( 71 ), 628 629 // ------------------------------------------------------------------------ 630 // General Error Codes: 631 // 632 // A general error code typically specifies an error condition for which 633 // there is no suitable specific error code. If the server can return an 634 // error, which is more specific than the following general errors, then 635 // the specific error should be returned instead. 636 // ------------------------------------------------------------------------ 637 638 /** 639 * This error code should be returned only if no other error code is 640 * suitable. Use of this error code should be avoided if possible. Details 641 * of the error should be provided in the error message. Applicable 642 * operations: all. Result code type: General 643 */ 644 OTHER( 80 ), 645 646 /** 647 * This error code is returned when an operation has been canceled using 648 * the Cancel extended operation. 649 */ 650 CANCELED( 118 ), 651 652 653 /** 654 * This error code is returned if the server has no knowledge of 655 * the operation requested for cancelation. 656 */ 657 NO_SUCH_OPERATION( 119 ), 658 659 660 /** 661 * The tooLate resultCode is returned to indicate that it is too late to 662 * cancel the outstanding operation. For example, the server may return 663 * tooLate for a request to cancel an outstanding modify operation which 664 * has already committed updates to the underlying data store. 665 */ 666 TOO_LATE( 120 ), 667 668 /** 669 * The cannotCancel resultCode is returned if the identified operation 670 * does not support cancelation or the cancel operation could not be 671 * performed. The following classes of operations are not cancelable: 672 * 673 * - operations which have no response, 674 * 675 * - operations which create, alter, or destroy authentication and/or 676 * authorization associations, 677 * 678 * - operations which establish, alter, or tear-down security services, 679 * and 680 * 681 * - operations which abandon or cancel other operations. 682 */ 683 CANNOT_CANCEL( 121 ), 684 685 /** 686 * The server may return this result code on the initial content poll 687 * if it is safe to do so when it is unable to perform the operation 688 * due to various reasons. For more detailed explanation refer 689 * <a href="http://www.faqs.org/rfcs/rfc4533.html">RFC 4533 (a.k.a syncrepl)</a> 690 */ 691 E_SYNC_REFRESH_REQUIRED( 4096 ), 692 693 /** 694 * A unknown result code to cover all the other cases 695 */ 696 // -- 15 unused -- 697 // -- 22-31 unused -- 698 // -- 35 reserved for undefined isLeaf -- 699 // -- 37-47 unused -- 700 // -- 55-63 unused -- 701 // -- 70 reserved for CLDAP -- 702 // -- 72-79 unused -- 703 // -- 81-90 reserved for APIs -- 704 UNKNOWN( 122 ); 705 706 /** Stores the integer value of each element of the enumeration */ 707 private int value; 708 709 /** 710 * Private construct so no other instances can be created other than the 711 * public static constants in this class. 712 * 713 * @param value the integer value of the enumeration. 714 */ 715 private ResultCodeEnum( int value ) 716 { 717 this.value = value; 718 } 719 720 /** 721 * @return The value associated with the current element. 722 */ 723 public int getValue() 724 { 725 return value; 726 } 727 728 public static final Set<ResultCodeEnum> EMPTY_RESULT_CODE_SET = new HashSet<ResultCodeEnum>(); 729 730 731 // ------------------------------------------------------------------------ 732 // Error Codes Grouped Into Categories & Static Accessors 733 // ------------------------------------------------------------------------ 734 735 /** 736 * This array holds the set of general error codes. General error codes are 737 * typically returned only when no suitable specific error exists. Specific 738 * error codes are meant to capture situations that are specific to the 739 * requested operation. A general error code typically specifies an error 740 * condition for which there is no suitable specific error code. If the 741 * server can return an error, which is more specific than the following 742 * general errors, then the specific error should be returned instead. This 743 * array only contains the OTHER error code at the present time. The set 744 * contains: 745 * <ul> 746 * <li><a href="OTHER">OTHER</a></li> 747 * </ul> 748 */ 749 public static final Set<ResultCodeEnum> GENERAL_CODES = Collections.singleton( OTHER ); 750 751 /** 752 * Five result codes that may be returned in LDAPResult are not used to 753 * indicate an error. The first three codes, indicate to the client that no 754 * further action is required in order to satisfy their request. In 755 * contrast, the last two errors require further action by the client in 756 * order to complete their original operation request. The set contains: 757 * <ul> 758 * <li><a href="#SUCCESS">SUCCESS</a></li> 759 * <li><a href="#COMPARETRUE">COMPARETRUE</a></li> 760 * <li><a href="#COMPAREFALSE">COMPAREFALSE</a></li> 761 * <li><a href="#REFERRAL">REFERRAL</a></li> 762 * <li><a href="#SASL_BIND_IN_PROGRESS">SASL_BIND_IN_PROGRESS</a></li> 763 * </ul> 764 */ 765 public static final Set<ResultCodeEnum> NON_ERRONEOUS_CODES; 766 767 static 768 { 769 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 770 set.add( ResultCodeEnum.SUCCESS ); 771 set.add( ResultCodeEnum.COMPARE_TRUE ); 772 set.add( ResultCodeEnum.COMPARE_FALSE ); 773 set.add( ResultCodeEnum.REFERRAL ); 774 set.add( ResultCodeEnum.SASL_BIND_IN_PROGRESS ); 775 set.add( ResultCodeEnum.CANCELED ); 776 NON_ERRONEOUS_CODES = Collections.unmodifiableSet( set ); 777 } 778 779 /** 780 * Contains the set of error codes associated with attribute problems. An 781 * attribute error reports a problem related to an attribute specified by 782 * the client in their request message. The set contains: 783 * <ul> 784 * <li><a href="#NO_SUCH_ATTRIBUTE">NO_SUCH_ATTRIBUTE</a></li> 785 * <li><a href="#UNDEFINED_ATTRIBUTE_TYPE">UNDEFINED_ATTRIBUTE_TYPE</a></li> 786 * <li><a href="#INAPPROPRIATE_MATCHING">INAPPROPRIATE_MATCHING</a></li> 787 * <li><a href="#CONSTRAINT_VIOLATION">CONSTRAINT_VIOLATION</a></li> 788 * <li><a href="#ATTRIBUTE_OR_VALUE_EXISTS">ATTRIBUTE_OR_VALUE_EXISTS</a></li> 789 * <li><a href="#INVALID_ATTRIBUTE_SYNTAX">INVALID_ATTRIBUTE_SYNTAX</a></li> 790 * </ul> 791 */ 792 public static final Set<ResultCodeEnum> ATTRIBUTE_CODES; 793 794 static 795 { 796 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 797 set.add( ResultCodeEnum.NO_SUCH_ATTRIBUTE ); 798 set.add( ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE ); 799 set.add( ResultCodeEnum.INAPPROPRIATE_MATCHING ); 800 set.add( ResultCodeEnum.CONSTRAINT_VIOLATION ); 801 set.add( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS ); 802 set.add( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX ); 803 ATTRIBUTE_CODES = Collections.unmodifiableSet( set ); 804 } 805 806 /** 807 * Stores the set of error codes associated with name problems. A name error 808 * reports a problem related to the distinguished name provided as an 809 * argument to an operation [X511, Section 12.5]. For result codes of 810 * NO_SUCH_OBJECT, aliasProblem, invalidDNSyntax and 811 * aliasDereferencingProblem, the matchedDN field is set to the name of the 812 * lowest entry (object or alias) in the directory that was matched. If no 813 * aliases were dereferenced while attempting to locate the entry, this will 814 * be a truncated form of the name provided, or if aliases were dereferenced 815 * of the resulting name, as defined in section 12.5 of X.511 [X511]. The 816 * matchedDN field is to be set to a zero length string with all other 817 * result codes [RFC2251, Section 4.1.10]. The set contains: 818 * <ul> 819 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 820 * <li><a href="#ALIAS_PROBLEM">ALIAS_PROBLEM</a></li> 821 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 822 * </ul> 823 */ 824 public static final Set<ResultCodeEnum> NAME_CODES; 825 826 static 827 { 828 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 829 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 830 set.add( ResultCodeEnum.ALIAS_PROBLEM ); 831 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 832 NAME_CODES = Collections.unmodifiableSet( set ); 833 } 834 835 /** 836 * Stores all the result codes associated with security related problems. A 837 * security error reports a problem in carrying out an operation for 838 * security reasons [X511, Section 12.7]. The set contains: 839 * <ul> 840 * <li><a href="#INVALID_CREDENTIALS">INVALID_CREDENTIALS</a></li> 841 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 842 * <li><a href="#AUTH_METHOD_NOT_SUPPORTED">AUTH_METHOD_NOT_SUPPORTED</a></li> 843 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 844 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 845 * <li><a href="#ALIAS_DEREFERENCING_PROBLEM">ALIAS_DEREFERENCING_PROBLEM</a></li> 846 * <li><a href="#INAPPROPRIATE_AUTHENTICATION">INAPPROPRIATE_AUTHENTICATION</a></li> 847 * </ul> 848 */ 849 public static final Set<ResultCodeEnum> SECURITY_CODES; 850 851 static 852 { 853 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 854 set.add( ResultCodeEnum.INVALID_CREDENTIALS ); 855 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 856 set.add( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED ); 857 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 858 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 859 set.add( ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ); 860 set.add( ResultCodeEnum.INAPPROPRIATE_AUTHENTICATION ); 861 SECURITY_CODES = Collections.unmodifiableSet( set ); 862 } 863 864 /** 865 * A service error reports a problem related to the provision of the service 866 * [X511, Section 12.8]. This set stores all error codes related to service 867 * problems. The set contains: 868 * <ul> 869 * <li><a href="#BUSY">BUSY</a></li> 870 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 871 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 872 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 873 * <li><a href="#OPERATIONSERROR">OPERATIONSERROR</a></li> 874 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 875 * <li><a href="#SIZE_LIMIT_EXCEEDED">SIZE_LIMIT_EXCEEDED</a></li> 876 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 877 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 878 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 879 * </ul> 880 */ 881 public static final Set<ResultCodeEnum> SERVICE_CODES; 882 883 static 884 { 885 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 886 set.add( ResultCodeEnum.BUSY ); 887 set.add( ResultCodeEnum.LOOP_DETECT ); 888 set.add( ResultCodeEnum.UNAVAILABLE ); 889 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 890 set.add( ResultCodeEnum.OPERATIONS_ERROR ); 891 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 892 set.add( ResultCodeEnum.SIZE_LIMIT_EXCEEDED ); 893 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 894 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 895 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 896 set.add( ResultCodeEnum.CANNOT_CANCEL ); 897 set.add( ResultCodeEnum.TOO_LATE ); 898 set.add( ResultCodeEnum.NO_SUCH_OPERATION ); 899 SERVICE_CODES = Collections.unmodifiableSet( set ); 900 } 901 902 /** 903 * An update error reports problems related to attempts to add, delete, or 904 * modify information in the DIB [X511, Section 12.9]. This set contains the 905 * category of update errors. 906 * <ul> 907 * <li><a href="#NAMING_VIOLATION">NAMING_VIOLATION</a></li> 908 * <li><a href="#OBJECT_CLASS_VIOLATION">OBJECT_CLASS_VIOLATION</a></li> 909 * <li><a href="#NOT_ALLOWED_ON_NON_LEAF">NOT_ALLOWED_ON_NON_LEAF</a></li> 910 * <li><a href="#NOT_ALLOWED_ON_RDN">NOT_ALLOWED_ON_RDN</a></li> 911 * <li><a href="#ENTRY_ALREADY_EXISTS">ENTRY_ALREADY_EXISTS</a></li> 912 * <li><a href="#OBJECT_CLASS_MODS_PROHIBITED">OBJECT_CLASS_MODS_PROHIBITED</a></li> 913 * <li><a href="#AFFECTS_MULTIPLE_DSAS">AFFECTS_MULTIPLE_DSAS</a></li> 914 * </ul> 915 */ 916 public static final Set<ResultCodeEnum> UPDATE_CODES; 917 918 static 919 { 920 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 921 set.add( ResultCodeEnum.NAMING_VIOLATION ); 922 set.add( ResultCodeEnum.OBJECT_CLASS_VIOLATION ); 923 set.add( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF ); 924 set.add( ResultCodeEnum.NOT_ALLOWED_ON_RDN ); 925 set.add( ResultCodeEnum.ENTRY_ALREADY_EXISTS ); 926 set.add( ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED ); 927 set.add( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS ); 928 UPDATE_CODES = Collections.unmodifiableSet( set ); 929 } 930 931 // ------------------------------------------------------------------------ 932 // Result Codes Categorized by Request Type 933 // ------------------------------------------------------------------------ 934 935 /** 936 * A set of result code enumerations common to all operations. The set 937 * contains: 938 * <ul> 939 * <li><a href="#BUSY">BUSY</a></li> 940 * <li><a href="#OTHER">OTHER</a></li> 941 * <li><a href="#REFERRAL">REFERRAL</a></li> 942 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 943 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 944 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 945 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 946 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 947 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 948 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 949 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 950 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 951 * </ul> 952 */ 953 public static final Set<ResultCodeEnum> COMMON_CODES; 954 static 955 { 956 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 957 set.add( ResultCodeEnum.BUSY ); 958 set.add( ResultCodeEnum.OTHER ); 959 set.add( ResultCodeEnum.REFERRAL ); 960 set.add( ResultCodeEnum.LOOP_DETECT ); 961 set.add( ResultCodeEnum.UNAVAILABLE ); 962 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 963 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 964 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 965 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 966 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 967 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 968 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 969 COMMON_CODES = Collections.unmodifiableSet( set ); 970 } 971 972 /** 973 * A set of result code enumerations that may result from bind operations. 974 * The set contains: 975 * <ul> 976 * <li><a href="#BUSY">BUSY</a></li> 977 * <li><a href="#OTHER">OTHER</a></li> 978 * <li><a href="#SUCCESS">SUCCESS</a></li> 979 * <li><a href="#REFERRAL">REFERRAL</a></li> 980 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 981 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 982 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 983 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 984 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 985 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 986 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 987 * <li><a href="#SASL_BIND_IN_PROGRESS">SASL_BIND_IN_PROGRESS</a></li> 988 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 989 * <li><a href="#INVALID_CREDENTIALS">INVALID_CREDENTIALS</a></li> 990 * <li><a href="#AUTH_METHOD_NOT_SUPPORTED">AUTH_METHOD_NOT_SUPPORTED</a></li> 991 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 992 * <li><a href="#INAPPROPRIATE_AUTHENTICATION">INAPPROPRIATE_AUTHENTICATION</a></li> 993 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 994 * </ul> 995 */ 996 public static final Set<ResultCodeEnum> BIND_CODES; 997 static 998 { 999 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1000 set.add( ResultCodeEnum.BUSY ); 1001 set.add( ResultCodeEnum.OTHER ); 1002 set.add( ResultCodeEnum.SUCCESS ); 1003 set.add( ResultCodeEnum.REFERRAL ); 1004 set.add( ResultCodeEnum.LOOP_DETECT ); 1005 set.add( ResultCodeEnum.UNAVAILABLE ); 1006 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1007 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1008 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1009 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1010 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1011 set.add( ResultCodeEnum.SASL_BIND_IN_PROGRESS ); 1012 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1013 set.add( ResultCodeEnum.INVALID_CREDENTIALS ); 1014 set.add( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED ); 1015 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1016 set.add( ResultCodeEnum.INAPPROPRIATE_AUTHENTICATION ); 1017 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1018 set.add( ResultCodeEnum.CANCELED ); 1019 BIND_CODES = Collections.unmodifiableSet( set ); 1020 } 1021 1022 /** 1023 * A set of result code enumerations that may result from search operations. 1024 * The set contains: 1025 * <ul> 1026 * <li><a href="#BUSY">BUSY</a></li> 1027 * <li><a href="#OTHER">OTHER</a></li> 1028 * <li><a href="#SUCCESS">SUCCESS</a></li> 1029 * <li><a href="#REFERRAL">REFERRAL</a></li> 1030 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 1031 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 1032 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 1033 * <li><a href="#ALIAS_PROBLEM">ALIAS_PROBLEM</a></li> 1034 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 1035 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 1036 * <li><a href="#SIZE_LIMIT_EXCEEDED">SIZE_LIMIT_EXCEEDED</a></li> 1037 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 1038 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 1039 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 1040 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 1041 * <li><a href="#INAPPROPRIATE_MATCHING">INAPPROPRIATE_MATCHING</a></li> 1042 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 1043 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 1044 * <li><a href="#ALIAS_DEREFERENCING_PROBLEM">ALIAS_DEREFERENCING_PROBLEM</a></li> 1045 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 1046 * </ul> 1047 */ 1048 public static final Set<ResultCodeEnum> SEARCH_CODES; 1049 static 1050 { 1051 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1052 set.add( ResultCodeEnum.BUSY ); 1053 set.add( ResultCodeEnum.OTHER ); 1054 set.add( ResultCodeEnum.SUCCESS ); 1055 set.add( ResultCodeEnum.REFERRAL ); 1056 set.add( ResultCodeEnum.LOOP_DETECT ); 1057 set.add( ResultCodeEnum.UNAVAILABLE ); 1058 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 1059 set.add( ResultCodeEnum.ALIAS_PROBLEM ); 1060 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1061 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1062 set.add( ResultCodeEnum.SIZE_LIMIT_EXCEEDED ); 1063 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1064 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1065 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1066 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1067 set.add( ResultCodeEnum.INAPPROPRIATE_MATCHING ); 1068 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1069 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 1070 set.add( ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ); 1071 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1072 set.add( ResultCodeEnum.CANCELED ); 1073 set.add( ResultCodeEnum.E_SYNC_REFRESH_REQUIRED ); 1074 SEARCH_CODES = Collections.unmodifiableSet( set ); 1075 } 1076 1077 /** 1078 * A set of result code enumerations that may result from modify operations. 1079 * The set contains: 1080 * <ul> 1081 * <li><a href="#BUSY">BUSY</a></li> 1082 * <li><a href="#OTHER">OTHER</a></li> 1083 * <li><a href="#SUCCESS">SUCCESS</a></li> 1084 * <li><a href="#REFERRAL">REFERRAL</a></li> 1085 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 1086 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 1087 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 1088 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 1089 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 1090 * <li><a href="#NOT_ALLOWED_ON_RDN">NOT_ALLOWED_ON_RDN</a></li> 1091 * <li><a href="#NO_SUCH_ATTRIBUTE">NO_SUCH_ATTRIBUTE</a></li> 1092 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 1093 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 1094 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 1095 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 1096 * <li><a href="#CONSTRAINT_VIOLATION">CONSTRAINT_VIOLATION</a></li> 1097 * <li><a href="#OBJECT_CLASS_VIOLATION">OBJECT_CLASS_VIOLATION</a></li> 1098 * <li><a href="#INVALID_ATTRIBUTE_SYNTAX">INVALID_ATTRIBUTE_SYNTAX</a></li> 1099 * <li><a href="#UNDEFINED_ATTRIBUTE_TYPE">UNDEFINED_ATTRIBUTE_TYPE</a></li> 1100 * <li><a href="#ATTRIBUTE_OR_VALUE_EXISTS">ATTRIBUTE_OR_VALUE_EXISTS</a></li> 1101 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 1102 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 1103 * <li><a href="#OBJECT_CLASS_MODS_PROHIBITED">OBJECT_CLASS_MODS_PROHIBITED</a></li> 1104 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 1105 * </ul> 1106 */ 1107 public static final Set<ResultCodeEnum> MODIFY_CODES; 1108 static 1109 { 1110 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1111 set.add( ResultCodeEnum.BUSY ); 1112 set.add( ResultCodeEnum.OTHER ); 1113 set.add( ResultCodeEnum.SUCCESS ); 1114 set.add( ResultCodeEnum.REFERRAL ); 1115 set.add( ResultCodeEnum.LOOP_DETECT ); 1116 set.add( ResultCodeEnum.UNAVAILABLE ); 1117 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 1118 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1119 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1120 set.add( ResultCodeEnum.NOT_ALLOWED_ON_RDN ); 1121 set.add( ResultCodeEnum.NO_SUCH_ATTRIBUTE ); 1122 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1123 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1124 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1125 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1126 set.add( ResultCodeEnum.CONSTRAINT_VIOLATION ); 1127 set.add( ResultCodeEnum.OBJECT_CLASS_VIOLATION ); 1128 set.add( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX ); 1129 set.add( ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE ); 1130 set.add( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS ); 1131 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1132 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 1133 set.add( ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED ); 1134 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1135 set.add( ResultCodeEnum.CANCELED ); 1136 MODIFY_CODES = Collections.unmodifiableSet( set ); 1137 } 1138 1139 /** 1140 * A set of result code enumerations that may result from add operations. 1141 * The set contains: 1142 * <ul> 1143 * <li><a href="#BUSY">BUSY</a></li> 1144 * <li><a href="#OTHER">OTHER</a></li> 1145 * <li><a href="#SUCCESS">SUCCESS</a></li> 1146 * <li><a href="#REFERRAL">REFERRAL</a></li> 1147 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 1148 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 1149 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 1150 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 1151 * <li><a href="#NAMING_VIOLATION">NAMING_VIOLATION</a></li> 1152 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 1153 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 1154 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 1155 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 1156 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 1157 * <li><a href="#ENTRY_ALREADY_EXISTS">ENTRY_ALREADY_EXISTS</a></li> 1158 * <li><a href="#CONSTRAINT_VIOLATION">CONSTRAINT_VIOLATION</a></li> 1159 * <li><a href="#OBJECT_CLASS_VIOLATION">OBJECT_CLASS_VIOLATION</a></li> 1160 * <li><a href="#INVALID_ATTRIBUTE_SYNTAX">INVALID_ATTRIBUTE_SYNTAX</a></li> 1161 * <li><a href="#ATTRIBUTE_OR_VALUE_EXISTS">ATTRIBUTE_OR_VALUE_EXISTS</a></li> 1162 * <li><a href="#UNDEFINED_ATTRIBUTE_TYPE">UNDEFINED_ATTRIBUTE_TYPE</a></li> 1163 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 1164 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 1165 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 1166 * </ul> 1167 */ 1168 public static final Set<ResultCodeEnum> ADD_CODES; 1169 static 1170 { 1171 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1172 set.add( ResultCodeEnum.BUSY ); 1173 set.add( ResultCodeEnum.OTHER ); 1174 set.add( ResultCodeEnum.SUCCESS ); 1175 set.add( ResultCodeEnum.REFERRAL ); 1176 set.add( ResultCodeEnum.LOOP_DETECT ); 1177 set.add( ResultCodeEnum.UNAVAILABLE ); 1178 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 1179 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1180 set.add( ResultCodeEnum.NAMING_VIOLATION ); 1181 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1182 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1183 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1184 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1185 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1186 set.add( ResultCodeEnum.ENTRY_ALREADY_EXISTS ); 1187 set.add( ResultCodeEnum.CONSTRAINT_VIOLATION ); 1188 set.add( ResultCodeEnum.OBJECT_CLASS_VIOLATION ); 1189 set.add( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX ); 1190 set.add( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS ); 1191 set.add( ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE ); 1192 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1193 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 1194 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1195 set.add( ResultCodeEnum.CANCELED ); 1196 ADD_CODES = Collections.unmodifiableSet( set ); 1197 } 1198 1199 /** 1200 * A set of result code enumerations that may result from delete operations. 1201 * The set may contain: 1202 * <ul> 1203 * <li><a href="#BUSY">BUSY</a></li> 1204 * <li><a href="#OTHER">OTHER</a></li> 1205 * <li><a href="#SUCCESS">SUCCESS</a></li> 1206 * <li><a href="#REFERRAL">REFERRAL</a></li> 1207 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 1208 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 1209 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 1210 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 1211 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 1212 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 1213 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 1214 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 1215 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 1216 * <li><a href="#NOT_ALLOWED_ON_NON_LEAF">NOT_ALLOWED_ON_NON_LEAF</a></li> 1217 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 1218 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 1219 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 1220 * </ul> 1221 */ 1222 public static final Set<ResultCodeEnum> DELETE_CODES; 1223 static 1224 { 1225 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1226 set.add( ResultCodeEnum.BUSY ); 1227 set.add( ResultCodeEnum.OTHER ); 1228 set.add( ResultCodeEnum.SUCCESS ); 1229 set.add( ResultCodeEnum.REFERRAL ); 1230 set.add( ResultCodeEnum.LOOP_DETECT ); 1231 set.add( ResultCodeEnum.UNAVAILABLE ); 1232 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 1233 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1234 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1235 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1236 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1237 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1238 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1239 set.add( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF ); 1240 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1241 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 1242 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1243 set.add( ResultCodeEnum.CANCELED ); 1244 DELETE_CODES = Collections.unmodifiableSet( set ); 1245 } 1246 1247 /** 1248 * A set of result code enumerations resulting from modifyDn operations. The 1249 * set contains: 1250 * <ul> 1251 * <li><a href="#BUSY">BUSY</a></li> 1252 * <li><a href="#OTHER">OTHER</a></li> 1253 * <li><a href="#SUCCESS">SUCCESS</a></li> 1254 * <li><a href="#REFERRAL">REFERRAL</a></li> 1255 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 1256 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 1257 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 1258 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 1259 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 1260 * <li><a href="#NAMING_VIOLATION">NAMING_VIOLATION</a></li> 1261 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 1262 * <li><a href="#ENTRY_ALREADY_EXISTS">ENTRY_ALREADY_EXISTS</a></li> 1263 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 1264 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 1265 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 1266 * <li><a href="#NOT_ALLOWED_ON_NON_LEAF">NOT_ALLOWED_ON_NON_LEAF</a></li> 1267 * <li><a href="#AFFECTS_MULTIPLE_DSAS">AFFECTS_MULTIPLE_DSAS</a></li> 1268 * <li><a href="#CONSTRAINT_VIOLATION">CONSTRAINT_VIOLATION</a></li> 1269 * <li><a href="#OBJECT_CLASS_VIOLATION">OBJECT_CLASS_VIOLATION</a></li> 1270 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 1271 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 1272 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 1273 * </ul> 1274 */ 1275 public static final Set<ResultCodeEnum> MODIFYDN_CODES; 1276 static 1277 { 1278 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1279 set.add( ResultCodeEnum.BUSY ); 1280 set.add( ResultCodeEnum.OTHER ); 1281 set.add( ResultCodeEnum.SUCCESS ); 1282 set.add( ResultCodeEnum.REFERRAL ); 1283 set.add( ResultCodeEnum.LOOP_DETECT ); 1284 set.add( ResultCodeEnum.UNAVAILABLE ); 1285 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 1286 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1287 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1288 set.add( ResultCodeEnum.NAMING_VIOLATION ); 1289 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1290 set.add( ResultCodeEnum.ENTRY_ALREADY_EXISTS ); 1291 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1292 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1293 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1294 set.add( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF ); 1295 set.add( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS ); 1296 set.add( ResultCodeEnum.CONSTRAINT_VIOLATION ); 1297 set.add( ResultCodeEnum.OBJECT_CLASS_VIOLATION ); 1298 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1299 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 1300 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1301 set.add( ResultCodeEnum.CANCELED ); 1302 MODIFYDN_CODES = Collections.unmodifiableSet( set ); 1303 } 1304 1305 /** 1306 * A set of result code enumerations that may result from compare 1307 * operations. The set contains: 1308 * <ul> 1309 * <li><a href="#OPERATIONSERROR">OPERATIONSERROR</a></li> 1310 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 1311 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 1312 * <li><a href="#COMPAREFALSE">COMPAREFALSE</a></li> 1313 * <li><a href="#COMPARETRUE">COMPARETRUE</a></li> 1314 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 1315 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 1316 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 1317 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 1318 * <li><a href="#NO_SUCH_ATTRIBUTE">NO_SUCH_ATTRIBUTE</a></li> 1319 * <li><a href="#INVALID_ATTRIBUTE_SYNTAX">INVALID_ATTRIBUTE_SYNTAX</a></li> 1320 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 1321 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 1322 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 1323 * <li><a href="#BUSY">BUSY</a></li> 1324 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 1325 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 1326 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 1327 * <li><a href="#REFERRAL">REFERRAL</a></li> 1328 * <li><a href="#OTHER">OTHER</a></li> 1329 * </ul> 1330 */ 1331 public static final Set<ResultCodeEnum> COMPARE_CODES; 1332 static 1333 { 1334 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1335 set.add( ResultCodeEnum.OPERATIONS_ERROR ); 1336 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1337 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1338 set.add( ResultCodeEnum.COMPARE_FALSE ); 1339 set.add( ResultCodeEnum.COMPARE_TRUE ); 1340 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1341 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1342 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1343 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1344 set.add( ResultCodeEnum.NO_SUCH_ATTRIBUTE ); 1345 set.add( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX ); 1346 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 1347 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1348 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 1349 set.add( ResultCodeEnum.BUSY ); 1350 set.add( ResultCodeEnum.UNAVAILABLE ); 1351 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1352 set.add( ResultCodeEnum.LOOP_DETECT ); 1353 set.add( ResultCodeEnum.REFERRAL ); 1354 set.add( ResultCodeEnum.OTHER ); 1355 set.add( ResultCodeEnum.CANCELED ); 1356 COMPARE_CODES = Collections.unmodifiableSet( set ); 1357 } 1358 1359 /** 1360 * A set of result code enumerations that could result from extended 1361 * operations. The set contains: 1362 * <ul> 1363 * <li></li> 1364 * <li><a href="#SUCCESS">SUCCESS</a></li> 1365 * <li><a href="#OPERATIONSERROR">OPERATIONSERROR</a></li> 1366 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 1367 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 1368 * <li><a href="#SIZE_LIMIT_EXCEEDED">SIZE_LIMIT_EXCEEDED</a></li> 1369 * <li><a href="#COMPAREFALSE">COMPAREFALSE</a></li> 1370 * <li><a href="#COMPARETRUE">COMPARETRUE</a></li> 1371 * <li><a href="#AUTH_METHOD_NOT_SUPPORTED">AUTH_METHOD_NOT_SUPPORTED</a></li> 1372 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 1373 * <li><a href="#REFERRAL">REFERRAL</a></li> 1374 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 1375 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 1376 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 1377 * <li><a href="#SASL_BIND_IN_PROGRESS">SASL_BIND_IN_PROGRESS</a></li> 1378 * <li><a href="#NO_SUCH_ATTRIBUTE">NO_SUCH_ATTRIBUTE</a></li> 1379 * <li><a href="#UNDEFINED_ATTRIBUTE_TYPE">UNDEFINED_ATTRIBUTE_TYPE</a></li> 1380 * <li><a href="#INAPPROPRIATE_MATCHING">INAPPROPRIATE_MATCHING</a></li> 1381 * <li><a href="#CONSTRAINT_VIOLATION">CONSTRAINT_VIOLATION</a></li> 1382 * <li><a href="#ATTRIBUTE_OR_VALUE_EXISTS">ATTRIBUTE_OR_VALUE_EXISTS</a></li> 1383 * <li><a href="#INVALID_ATTRIBUTE_SYNTAX">INVALID_ATTRIBUTE_SYNTAX</a></li> 1384 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 1385 * <li><a href="#ALIAS_PROBLEM">ALIAS_PROBLEM</a></li> 1386 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 1387 * <li><a href="#ALIAS_DEREFERENCING_PROBLEM">ALIAS_DEREFERENCING_PROBLEM</a></li> 1388 * <li><a href="#INAPPROPRIATE_AUTHENTICATION">INAPPROPRIATE_AUTHENTICATION</a></li> 1389 * <li><a href="#INVALID_CREDENTIALS">INVALID_CREDENTIALS</a></li> 1390 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 1391 * <li><a href="#BUSY">BUSY</a></li> 1392 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 1393 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 1394 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 1395 * <li><a href="#NAMING_VIOLATION">NAMING_VIOLATION</a></li> 1396 * <li><a href="#OBJECT_CLASS_VIOLATION">OBJECT_CLASS_VIOLATION</a></li> 1397 * <li><a href="#NOT_ALLOWED_ON_NON_LEAF">NOT_ALLOWED_ON_NON_LEAF</a></li> 1398 * <li><a href="#NOT_ALLOWED_ON_RDN">NOT_ALLOWED_ON_RDN</a></li> 1399 * <li><a href="#ENTRY_ALREADY_EXISTS">ENTRY_ALREADY_EXISTS</a></li> 1400 * <li><a href="#OBJECT_CLASS_MODS_PROHIBITED">OBJECT_CLASS_MODS_PROHIBITED</a></li> 1401 * <li><a href="#AFFECTS_MULTIPLE_DSAS">AFFECTS_MULTIPLE_DSAS</a></li> 1402 * <li><a href="#OTHER">OTHER</a></li> 1403 * </ul> 1404 */ 1405 public static final Set<ResultCodeEnum> EXTENDED_CODES; 1406 static 1407 { 1408 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1409 set.add( ResultCodeEnum.SUCCESS ); 1410 set.add( ResultCodeEnum.OPERATIONS_ERROR ); 1411 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1412 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1413 set.add( ResultCodeEnum.SIZE_LIMIT_EXCEEDED ); 1414 set.add( ResultCodeEnum.COMPARE_FALSE ); 1415 set.add( ResultCodeEnum.COMPARE_TRUE ); 1416 set.add( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED ); 1417 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1418 set.add( ResultCodeEnum.REFERRAL ); 1419 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1420 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1421 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1422 set.add( ResultCodeEnum.SASL_BIND_IN_PROGRESS ); 1423 set.add( ResultCodeEnum.NO_SUCH_ATTRIBUTE ); 1424 set.add( ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE ); 1425 set.add( ResultCodeEnum.INAPPROPRIATE_MATCHING ); 1426 set.add( ResultCodeEnum.CONSTRAINT_VIOLATION ); 1427 set.add( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS ); 1428 set.add( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX ); 1429 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 1430 set.add( ResultCodeEnum.ALIAS_PROBLEM ); 1431 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1432 set.add( ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ); 1433 set.add( ResultCodeEnum.INAPPROPRIATE_AUTHENTICATION ); 1434 set.add( ResultCodeEnum.INVALID_CREDENTIALS ); 1435 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 1436 set.add( ResultCodeEnum.BUSY ); 1437 set.add( ResultCodeEnum.UNAVAILABLE ); 1438 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1439 set.add( ResultCodeEnum.LOOP_DETECT ); 1440 set.add( ResultCodeEnum.NAMING_VIOLATION ); 1441 set.add( ResultCodeEnum.OBJECT_CLASS_VIOLATION ); 1442 set.add( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF ); 1443 set.add( ResultCodeEnum.NOT_ALLOWED_ON_RDN ); 1444 set.add( ResultCodeEnum.ENTRY_ALREADY_EXISTS ); 1445 set.add( ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED ); 1446 set.add( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS ); 1447 set.add( ResultCodeEnum.OTHER ); 1448 set.add( ResultCodeEnum.CANCELED ); 1449 EXTENDED_CODES = Collections.unmodifiableSet( set ); 1450 } 1451 1452 // ------------------------------------------------------------------------ 1453 // All Result Codes 1454 // ------------------------------------------------------------------------ 1455 1456 /** 1457 * Set of all result code enumerations. The set contains: 1458 * <ul> 1459 * <li><a href="#SUCCESS">SUCCESS</a></li> 1460 * <li><a href="#OPERATIONSERROR">OPERATIONSERROR</a></li> 1461 * <li><a href="#PROTOCOL_ERROR">PROTOCOL_ERROR</a></li> 1462 * <li><a href="#TIME_LIMIT_EXCEEDED">TIME_LIMIT_EXCEEDED</a></li> 1463 * <li><a href="#SIZE_LIMIT_EXCEEDED">SIZE_LIMIT_EXCEEDED</a></li> 1464 * <li><a href="#COMPAREFALSE">COMPAREFALSE</a></li> 1465 * <li><a href="#COMPARETRUE">COMPARETRUE</a></li> 1466 * <li><a href="#AUTH_METHOD_NOT_SUPPORTED">AUTH_METHOD_NOT_SUPPORTED</a></li> 1467 * <li><a href="#STRONG_AUTH_REQUIRED">STRONG_AUTH_REQUIRED</a></li> 1468 * <li><a href="#PARTIAL_RESULTS">PARTIAL_RESULTS</a></li> 1469 * <li><a href="#REFERRAL">REFERRAL</a></li> 1470 * <li><a href="#ADMIN_LIMIT_EXCEEDED">ADMIN_LIMIT_EXCEEDED</a></li> 1471 * <li><a href="#UNAVAILABLE_CRITICAL_EXTENSION">UNAVAILABLE_CRITICAL_EXTENSION</a></li> 1472 * <li><a href="#CONFIDENTIALITY_REQUIRED">CONFIDENTIALITY_REQUIRED</a></li> 1473 * <li><a href="#SASL_BIND_IN_PROGRESS">SASL_BIND_IN_PROGRESS</a></li> 1474 * <li><a href="#NO_SUCH_ATTRIBUTE">NO_SUCH_ATTRIBUTE</a></li> 1475 * <li><a href="#UNDEFINED_ATTRIBUTE_TYPE">UNDEFINED_ATTRIBUTE_TYPE</a></li> 1476 * <li><a href="#INAPPROPRIATE_MATCHING">INAPPROPRIATE_MATCHING</a></li> 1477 * <li><a href="#CONSTRAINT_VIOLATION">CONSTRAINT_VIOLATION</a></li> 1478 * <li><a href="#ATTRIBUTE_OR_VALUE_EXISTS">ATTRIBUTE_OR_VALUE_EXISTS</a></li> 1479 * <li><a href="#INVALID_ATTRIBUTE_SYNTAX">INVALID_ATTRIBUTE_SYNTAX</a></li> 1480 * <li><a href="#NO_SUCH_OBJECT">NO_SUCH_OBJECT</a></li> 1481 * <li><a href="#ALIAS_PROBLEM">ALIAS_PROBLEM</a></li> 1482 * <li><a href="#INVALID_DN_SYNTAX">INVALID_DN_SYNTAX</a></li> 1483 * <li><a href="#ALIAS_DEREFERENCING_PROBLEM">ALIAS_DEREFERENCING_PROBLEM</a></li> 1484 * <li><a href="#INAPPROPRIATE_AUTHENTICATION">INAPPROPRIATE_AUTHENTICATION</a></li> 1485 * <li><a href="#INVALID_CREDENTIALS">INVALID_CREDENTIALS</a></li> 1486 * <li><a href="#INSUFFICIENT_ACCESS_RIGHTS">INSUFFICIENT_ACCESS_RIGHTS</a></li> 1487 * <li><a href="#BUSY">BUSY</a></li> 1488 * <li><a href="#UNAVAILABLE">UNAVAILABLE</a></li> 1489 * <li><a href="#UNWILLING_TO_PERFORM">UNWILLING_TO_PERFORM</a></li> 1490 * <li><a href="#LOOP_DETECT">LOOP_DETECT</a></li> 1491 * <li><a href="#NAMING_VIOLATION">NAMING_VIOLATION</a></li> 1492 * <li><a href="#OBJECT_CLASS_VIOLATION">OBJECT_CLASS_VIOLATION</a></li> 1493 * <li><a href="#NOT_ALLOWED_ON_NON_LEAF">NOT_ALLOWED_ON_NON_LEAF</a></li> 1494 * <li><a href="#NOT_ALLOWED_ON_RDN">NOT_ALLOWED_ON_RDN</a></li> 1495 * <li><a href="#ENTRY_ALREADY_EXISTS">ENTRY_ALREADY_EXISTS</a></li> 1496 * <li><a href="#OBJECT_CLASS_MODS_PROHIBITED">OBJECT_CLASS_MODS_PROHIBITED</a></li> 1497 * <li><a href="#AFFECTS_MULTIPLE_DSAS">AFFECTS_MULTIPLE_DSAS</a></li> 1498 * <li><a href="#OTHER">OTHER</a></li> 1499 * </ul> 1500 */ 1501 public static final Set<ResultCodeEnum> ALL_CODES; 1502 static 1503 { 1504 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1505 set.add( ResultCodeEnum.SUCCESS ); 1506 set.add( ResultCodeEnum.OPERATIONS_ERROR ); 1507 set.add( ResultCodeEnum.PROTOCOL_ERROR ); 1508 set.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED ); 1509 set.add( ResultCodeEnum.SIZE_LIMIT_EXCEEDED ); 1510 set.add( ResultCodeEnum.COMPARE_FALSE ); 1511 set.add( ResultCodeEnum.COMPARE_TRUE ); 1512 set.add( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED ); 1513 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1514 set.add( ResultCodeEnum.PARTIAL_RESULTS ); 1515 set.add( ResultCodeEnum.REFERRAL ); 1516 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1517 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1518 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1519 set.add( ResultCodeEnum.SASL_BIND_IN_PROGRESS ); 1520 set.add( ResultCodeEnum.NO_SUCH_ATTRIBUTE ); 1521 set.add( ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE ); 1522 set.add( ResultCodeEnum.INAPPROPRIATE_MATCHING ); 1523 set.add( ResultCodeEnum.CONSTRAINT_VIOLATION ); 1524 set.add( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS ); 1525 set.add( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX ); 1526 set.add( ResultCodeEnum.NO_SUCH_OBJECT ); 1527 set.add( ResultCodeEnum.ALIAS_PROBLEM ); 1528 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1529 set.add( ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ); 1530 set.add( ResultCodeEnum.INAPPROPRIATE_AUTHENTICATION ); 1531 set.add( ResultCodeEnum.INVALID_CREDENTIALS ); 1532 set.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ); 1533 set.add( ResultCodeEnum.BUSY ); 1534 set.add( ResultCodeEnum.UNAVAILABLE ); 1535 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1536 set.add( ResultCodeEnum.LOOP_DETECT ); 1537 set.add( ResultCodeEnum.NAMING_VIOLATION ); 1538 set.add( ResultCodeEnum.OBJECT_CLASS_VIOLATION ); 1539 set.add( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF ); 1540 set.add( ResultCodeEnum.NOT_ALLOWED_ON_RDN ); 1541 set.add( ResultCodeEnum.ENTRY_ALREADY_EXISTS ); 1542 set.add( ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED ); 1543 set.add( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS ); 1544 set.add( ResultCodeEnum.OTHER ); 1545 set.add( ResultCodeEnum.CANNOT_CANCEL ); 1546 set.add( ResultCodeEnum.TOO_LATE ); 1547 set.add( ResultCodeEnum.NO_SUCH_OPERATION ); 1548 set.add( ResultCodeEnum.CANCELED ); 1549 set.add( ResultCodeEnum.E_SYNC_REFRESH_REQUIRED ); 1550 ALL_CODES = Collections.unmodifiableSet( set ); 1551 } 1552 1553 /** 1554 * @return The integer associated with the result code 1555 */ 1556 public int getResultCode() 1557 { 1558 return value; 1559 } 1560 1561 /** 1562 * @return The integer associated with the result code 1563 */ 1564 public static ResultCodeEnum getResultCode( int value ) 1565 { 1566 switch ( value ) 1567 { 1568 case 0 : return SUCCESS; 1569 case 1 : return OPERATIONS_ERROR; 1570 case 2 : return PROTOCOL_ERROR; 1571 case 3 : return TIME_LIMIT_EXCEEDED; 1572 case 4 : return SIZE_LIMIT_EXCEEDED; 1573 case 5 : return COMPARE_FALSE; 1574 case 6 : return COMPARE_TRUE; 1575 case 7 : return AUTH_METHOD_NOT_SUPPORTED; 1576 case 8 : return STRONG_AUTH_REQUIRED; 1577 case 9 : return PARTIAL_RESULTS; 1578 case 10 : return REFERRAL; 1579 case 11 : return ADMIN_LIMIT_EXCEEDED; 1580 case 12 : return UNAVAILABLE_CRITICAL_EXTENSION; 1581 case 13 : return CONFIDENTIALITY_REQUIRED; 1582 case 14 : return SASL_BIND_IN_PROGRESS; 1583 case 16 : return NO_SUCH_ATTRIBUTE; 1584 case 17 : return UNDEFINED_ATTRIBUTE_TYPE; 1585 case 18 : return INAPPROPRIATE_MATCHING; 1586 case 19 : return CONSTRAINT_VIOLATION; 1587 case 20 : return ATTRIBUTE_OR_VALUE_EXISTS; 1588 case 21 : return INVALID_ATTRIBUTE_SYNTAX; 1589 case 32 : return NO_SUCH_OBJECT; 1590 case 33 : return ALIAS_PROBLEM; 1591 case 34 : return INVALID_DN_SYNTAX; 1592 case 35 : return UNKNOWN; 1593 case 36 : return ALIAS_DEREFERENCING_PROBLEM; 1594 case 48 : return INAPPROPRIATE_AUTHENTICATION; 1595 case 49 : return INVALID_CREDENTIALS; 1596 case 50 : return INSUFFICIENT_ACCESS_RIGHTS; 1597 case 51 : return BUSY; 1598 case 52 : return UNAVAILABLE; 1599 case 53 : return UNWILLING_TO_PERFORM; 1600 case 54 : return LOOP_DETECT; 1601 case 64 : return NAMING_VIOLATION; 1602 case 65 : return OBJECT_CLASS_VIOLATION; 1603 case 66 : return NOT_ALLOWED_ON_NON_LEAF; 1604 case 67 : return NOT_ALLOWED_ON_RDN; 1605 case 68 : return ENTRY_ALREADY_EXISTS; 1606 case 69 : return OBJECT_CLASS_MODS_PROHIBITED; 1607 case 71 : return AFFECTS_MULTIPLE_DSAS; 1608 case 80 : return OTHER; 1609 case 118: return CANCELED; 1610 case 129: return NO_SUCH_OPERATION; 1611 case 120: return TOO_LATE; 1612 case 121: return CANNOT_CANCEL; 1613 case 4096: return E_SYNC_REFRESH_REQUIRED; 1614 default : return UNKNOWN; 1615 } 1616 } 1617 1618 1619 1620 /** 1621 * Gets the set of general error codes. 1622 * 1623 * @return array of result codes enumerations 1624 * @see #GENERAL_CODES 1625 */ 1626 public static Set<ResultCodeEnum> getGeneralCodes() 1627 { 1628 // Must clone to prevent array content alterations 1629 return GENERAL_CODES; 1630 } 1631 1632 1633 /** 1634 * Gets the set of result code enumerations that do not represent 1635 * operational failures. 1636 * 1637 * @return array of result codes enumerations 1638 * @see #NON_ERRONEOUS_CODES 1639 */ 1640 public static Set<ResultCodeEnum> getNonErroneousCodes() 1641 { 1642 // Must clone to prevent array content alterations 1643 return NON_ERRONEOUS_CODES; 1644 } 1645 1646 1647 /** 1648 * Gets an array of result code enumerations that report a problem related 1649 * to an attribute specified by the client in their request message.. 1650 * 1651 * @return array of result codes enumerations 1652 * @see #ATTRIBUTE_CODES 1653 */ 1654 public static Set<ResultCodeEnum> getAttributeCodes() 1655 { 1656 // Must clone to prevent array content alterations 1657 return ATTRIBUTE_CODES; 1658 } 1659 1660 1661 /** 1662 * Gets an array of result code enumerations that report a problem related 1663 * to a distinguished name provided as an argument to a request message. 1664 * 1665 * @return array of result codes enumerations 1666 * @see #NAME_CODES 1667 */ 1668 public static Set<ResultCodeEnum> getNameCodes() 1669 { 1670 // Must clone to prevent array content alterations 1671 return NAME_CODES; 1672 } 1673 1674 1675 /** 1676 * Gets an array of result code enumerations that report a problem related 1677 * to a problem in carrying out an operation for security reasons. 1678 * 1679 * @return array of result codes enumerations 1680 * @see #SECURITY_CODES 1681 */ 1682 public static Set<ResultCodeEnum> getSecurityCodes() 1683 { 1684 // Must clone to prevent array content alterations 1685 return SECURITY_CODES; 1686 } 1687 1688 1689 /** 1690 * Gets an array of result code enumerations that report a problem related 1691 * to the provision of the service. 1692 * 1693 * @return array of result codes enumerations 1694 * @see #SERVICE_CODES 1695 */ 1696 public static Set<ResultCodeEnum> getServiceCodes() 1697 { 1698 // Must clone to prevent array content alterations 1699 return SERVICE_CODES; 1700 } 1701 1702 1703 /** 1704 * Gets an array of result code enumerations that reports problems related 1705 * to attempts to add, delete, or modify information in the DIB. 1706 * 1707 * @return array of result codes enumerations 1708 * @see #UPDATE_CODES 1709 */ 1710 public static Set<ResultCodeEnum> getUpdateCodes() 1711 { 1712 // Must clone to prevent array content alterations 1713 return UPDATE_CODES; 1714 } 1715 1716 1717 /** 1718 * Gets an array of result code enumerations common to all operations. 1719 * 1720 * @return an array of common operation ResultCodeEnum's 1721 * @see #COMMON_CODES 1722 */ 1723 public static Set<ResultCodeEnum> getCommonCodes() 1724 { 1725 return COMMON_CODES; 1726 } 1727 1728 1729 /** 1730 * Gets an array of result code enumerations resulting from bind operations. 1731 * 1732 * @return an array of bind operation ResultCodeEnum's 1733 * @see #BIND_CODES 1734 */ 1735 public static Set<ResultCodeEnum> getBindCodes() 1736 { 1737 return BIND_CODES; 1738 } 1739 1740 1741 /** 1742 * Gets an array of result code enumerations resulting from search 1743 * operations. 1744 * 1745 * @return an array of search operation ResultCodeEnum's 1746 * @see #SEARCH_CODES 1747 */ 1748 public static Set<ResultCodeEnum> getSearchCodes() 1749 { 1750 return SEARCH_CODES; 1751 } 1752 1753 1754 /** 1755 * Gets an array of result code enumerations resulting from modify 1756 * operations. 1757 * 1758 * @return an array of modify operation ResultCodeEnum's 1759 * @see #MODIFY_CODES 1760 */ 1761 public static Set<ResultCodeEnum> getModifyCodes() 1762 { 1763 return MODIFY_CODES; 1764 } 1765 1766 1767 /** 1768 * Gets an array of result code enumerations resulting from add operations. 1769 * 1770 * @return an array of add operation ResultCodeEnum's 1771 * @see #ADD_CODES 1772 */ 1773 public static Set<ResultCodeEnum> getAddCodes() 1774 { 1775 return ADD_CODES; 1776 } 1777 1778 1779 /** 1780 * Gets an array of result code enumerations resulting from delete 1781 * operations. 1782 * 1783 * @return an array of delete operation ResultCodeEnum's 1784 * @see #DELETE_CODES 1785 */ 1786 public static Set<ResultCodeEnum> getDeleteCodes() 1787 { 1788 return DELETE_CODES; 1789 } 1790 1791 1792 /** 1793 * Gets an array of result code enumerations resulting from modifyDn 1794 * operations. 1795 * 1796 * @return an array of modifyDn operation ResultCodeEnum's 1797 * @see #MODIFYDN_CODES 1798 */ 1799 public static Set<ResultCodeEnum> getModifyDnCodes() 1800 { 1801 return MODIFYDN_CODES; 1802 } 1803 1804 1805 /** 1806 * Gets an array of result code enumerations resulting from compare 1807 * operations. 1808 * 1809 * @return an array of compare operation ResultCodeEnum's 1810 * @see #COMPARE_CODES 1811 */ 1812 public static Set<ResultCodeEnum> getCompareCodes() 1813 { 1814 return COMPARE_CODES; 1815 } 1816 1817 1818 /** 1819 * Gets an array of result code enumerations resulting from extended 1820 * operations. 1821 * 1822 * @return an array of extended operation ResultCodeEnum's 1823 * @see #EXTENDED_CODES 1824 */ 1825 public static Set<ResultCodeEnum> getExtendedCodes() 1826 { 1827 return EXTENDED_CODES; 1828 } 1829 1830 1831 /** 1832 * Gets all of the result code enumerations defined. 1833 * 1834 * @return an array of all defined result codes 1835 * @see #ALL_CODES 1836 */ 1837 public static Set<ResultCodeEnum> getAllCodes() 1838 { 1839 // Must clone to prevent array content tampering. 1840 return ALL_CODES; 1841 } 1842 1843 1844 // ------------------------------------------------------------------------ 1845 // Getting Result Code Enumeration Object Using Integer Values 1846 // ------------------------------------------------------------------------ 1847 // ------------------------------------------------------------------------ 1848 // JNDI Exception to ResultCodeEnum Mappings 1849 // ------------------------------------------------------------------------ 1850 1851 /** 1852 * A set of ResultCodes containing those that may correspond to NamingException. 1853 * <ul> 1854 * <li><a href="#OPERATIONSERROR">operationsError(1)</a></li> 1855 * <li><a href="#ALIAS_PROBLEM">aliasProblem(33)</a></li> 1856 * <li><a href="#ALIAS_DEREFERENCING_PROBLEM">aliasDereferencingProblem(36)</a></li> 1857 * <li><a href="#LOOP_DETECT">loopDetect(54)</a></li> 1858 * <li><a href="#AFFECTS_MULTIPLE_DSAS">affectsMultipleDSAs(71)</a></li> 1859 * <li><a href="#OTHER">other(80)</a></li> 1860 * </ul> 1861 */ 1862 public static final Set<ResultCodeEnum> NAMINGEXCEPTION_CODES; 1863 static 1864 { 1865 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1866 set.add( ResultCodeEnum.OPERATIONS_ERROR ); 1867 set.add( ResultCodeEnum.ALIAS_PROBLEM ); 1868 set.add( ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ); 1869 set.add( ResultCodeEnum.LOOP_DETECT ); 1870 set.add( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS ); 1871 set.add( ResultCodeEnum.OTHER ); 1872 NAMINGEXCEPTION_CODES = Collections.unmodifiableSet( set ); 1873 } 1874 1875 /** 1876 * A set of ResultCodes containing those that may correspond to a 1877 * {@link Exception}. 1878 * <ul> 1879 * <li><a href="#AUTH_METHOD_NOT_SUPPORTED">authMethodNotSupported(7)</a></li> 1880 * <li><a href="#STRONG_AUTH_REQUIRED">strongAuthRequired(8)</a></li> 1881 * <li><a href="#CONFIDENTIALITY_REQUIRED">confidentialityRequired(13)</a></li> 1882 * <li><a 1883 * href="#INAPPROPRIATE_AUTHENTICATION">inappropriateAuthentication(48)</a></li> 1884 * </ul> 1885 */ 1886 public static final Set<ResultCodeEnum> AUTHENTICATIONNOTSUPPOERTEDEXCEPTION_CODES; 1887 static 1888 { 1889 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1890 set.add( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED ); 1891 set.add( ResultCodeEnum.STRONG_AUTH_REQUIRED ); 1892 set.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED ); 1893 set.add( ResultCodeEnum.INAPPROPRIATE_AUTHENTICATION ); 1894 AUTHENTICATIONNOTSUPPOERTEDEXCEPTION_CODES = Collections.unmodifiableSet( set ); 1895 } 1896 1897 /** 1898 * A set of ResultCodes containing those that may correspond to a 1899 * {@link Exception}. 1900 * <ul> 1901 * <li><a href="#BUSY">busy(51)</a></li> 1902 * <li><a href="#UNAVAILABLE">unavailable(52)</a></li> 1903 * </ul> 1904 */ 1905 public static final Set<ResultCodeEnum> SERVICEUNAVAILABLE_CODES; 1906 static 1907 { 1908 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1909 set.add( ResultCodeEnum.BUSY ); 1910 set.add( ResultCodeEnum.UNAVAILABLE ); 1911 SERVICEUNAVAILABLE_CODES = Collections.unmodifiableSet( set ); 1912 } 1913 1914 /** 1915 * A set of ResultCodes containing those that may correspond to a 1916 * {@link Exception}. 1917 * <ul> 1918 * <li><a href="#CONSTRAINT_VIOLATION">constraintViolation(19)</a></li> 1919 * <li><a href="#INVALID_ATTRIBUTE_SYNTAX">invalidAttributeSyntax(21)</a></li> 1920 * </ul> 1921 */ 1922 public static final Set<ResultCodeEnum> INVALIDATTRIBUTEVALUEEXCEPTION_CODES; 1923 static 1924 { 1925 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1926 set.add( ResultCodeEnum.CONSTRAINT_VIOLATION ); 1927 set.add( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX ); 1928 INVALIDATTRIBUTEVALUEEXCEPTION_CODES = Collections.unmodifiableSet( set ); 1929 } 1930 1931 /** 1932 * A set of ResultCodes containing those that may correspond to a 1933 * {@link Exception}. 1934 * <ul> 1935 * <li><a href="#PARTIAL_RESULTS">partialResults(9)</a></li> 1936 * <li><a href="#REFERRAL">referral(10)</a></li> 1937 * </ul> 1938 */ 1939 public static final Set<ResultCodeEnum> PARTIAL_RESULTSEXCEPTION_CODES; 1940 static 1941 { 1942 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1943 set.add( ResultCodeEnum.PARTIAL_RESULTS ); 1944 set.add( ResultCodeEnum.REFERRAL ); 1945 PARTIAL_RESULTSEXCEPTION_CODES = Collections.unmodifiableSet( set ); 1946 } 1947 1948 /** 1949 * A set of ResultCodes containing those that may correspond to a 1950 * {@link Exception}. 1951 * <ul> 1952 * <li><a href="#REFERRAL">referal(9)</a></li> 1953 * <li><a href="#ADMIN_LIMIT_EXCEEDED">adminLimitExceeded(11)</a></li> 1954 * </ul> 1955 */ 1956 public static final Set<ResultCodeEnum> LIMITEXCEEDEDEXCEPTION_CODES; 1957 static 1958 { 1959 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1960 set.add( ResultCodeEnum.REFERRAL ); 1961 set.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED ); 1962 LIMITEXCEEDEDEXCEPTION_CODES = Collections.unmodifiableSet( set ); 1963 } 1964 1965 /** 1966 * A set of ResultCodes containing those that may correspond to a 1967 * {@link Exception}. 1968 * <ul> 1969 * <li><a 1970 * href="#UNAVAILABLECRITICALEXTENTION">unavailableCriticalExtention(12)</a></li> 1971 * <li><a href="#UNWILLING_TO_PERFORM">unwillingToPerform(53)</a></li> 1972 * </ul> 1973 */ 1974 public static final Set<ResultCodeEnum> OPERATIONNOTSUPPOERTEXCEPTION_CODES; 1975 static 1976 { 1977 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1978 set.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ); 1979 set.add( ResultCodeEnum.UNWILLING_TO_PERFORM ); 1980 OPERATIONNOTSUPPOERTEXCEPTION_CODES = Collections.unmodifiableSet( set ); 1981 } 1982 1983 /** 1984 * A set of ResultCodes containing those that may correspond to a 1985 * {@link Exception}. 1986 * <ul> 1987 * <li><a href="#INVALID_DN_SYNTAX">invalidDNSyntax(34)</a></li> 1988 * <li><a href="#NAMING_VIOLATION">namingViolation(64)</a></li> 1989 * </ul> 1990 */ 1991 public static final Set<ResultCodeEnum> INVALIDNAMEEXCEPTION_CODES; 1992 static 1993 { 1994 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 1995 set.add( ResultCodeEnum.INVALID_DN_SYNTAX ); 1996 set.add( ResultCodeEnum.NAMING_VIOLATION ); 1997 INVALIDNAMEEXCEPTION_CODES = Collections.unmodifiableSet( set ); 1998 } 1999 2000 /** 2001 * A set of ResultCodes containing those that may correspond to a 2002 * {@link javax.naming.directory.SchemaViolationException}. 2003 * <ul> 2004 * <li><a href="#OBJECT_CLASS_VIOLATION">objectClassViolation(65)</a></li> 2005 * <li><a href="#NOT_ALLOWED_ON_RDN">notAllowedOnRDN(67)</a></li> 2006 * <li><a href="#OBJECT_CLASS_MODS_PROHIBITED">objectClassModsProhibited(69)</a></li> 2007 * </ul> 2008 */ 2009 public static final Set<ResultCodeEnum> SCHEMAVIOLATIONEXCEPTION_CODES; 2010 static 2011 { 2012 Set<ResultCodeEnum> set = new HashSet<ResultCodeEnum>(); 2013 set.add( ResultCodeEnum.OBJECT_CLASS_VIOLATION ); 2014 set.add( ResultCodeEnum.NOT_ALLOWED_ON_RDN ); 2015 set.add( ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED ); 2016 SCHEMAVIOLATIONEXCEPTION_CODES = Collections.unmodifiableSet( set ); 2017 } 2018 2019 2020 /** 2021 * Takes a guess at the result code to use if it cannot figure it out from 2022 * known Throwable to result code mappings. Some however are ambiguous 2023 * mapping the same Throwable to multiple codes. If no code can be resolved 2024 * then {@link ResultCodeEnum#OTHER} is returned. 2025 * 2026 * @param t 2027 * the throwable to estimate a result code for 2028 * @param type 2029 * the type of operation being performed 2030 * @return the result code or a good estimate of one 2031 */ 2032 public static ResultCodeEnum getBestEstimate( Throwable t, MessageTypeEnum type ) 2033 { 2034 Set<ResultCodeEnum> set = getResultCodes( t ); 2035 2036 if ( set.isEmpty() ) 2037 { 2038 return ResultCodeEnum.OTHER; 2039 } 2040 2041 if ( set.size() == 1 ) 2042 { 2043 return set.iterator().next(); 2044 } 2045 2046 if ( type == null ) 2047 { 2048 Set<ResultCodeEnum> tmp = new HashSet<ResultCodeEnum>(); 2049 tmp.addAll( set ); 2050 tmp.removeAll( NON_ERRONEOUS_CODES ); 2051 2052 if ( tmp.isEmpty() ) 2053 { 2054 return ResultCodeEnum.OTHER; 2055 } 2056 2057 return tmp.iterator().next(); 2058 } 2059 2060 Set<ResultCodeEnum> candidates = EMPTY_RESULT_CODE_SET; 2061 2062 switch ( type ) 2063 { 2064 case ABANDON_REQUEST : 2065 return set.iterator().next(); 2066 2067 case ADD_REQUEST : 2068 candidates = intersection( set, ADD_CODES ); 2069 break; 2070 2071 case ADD_RESPONSE : 2072 candidates = intersection( set, ADD_CODES ); 2073 break; 2074 2075 case BIND_REQUEST : 2076 candidates = intersection( set, BIND_CODES ); 2077 break; 2078 2079 case BIND_RESPONSE : 2080 candidates = intersection( set, BIND_CODES ); 2081 break; 2082 2083 case COMPARE_REQUEST : 2084 candidates = intersection( set, COMPARE_CODES ); 2085 break; 2086 2087 case COMPARE_RESPONSE : 2088 candidates = intersection( set, COMPARE_CODES ); 2089 break; 2090 2091 case DEL_REQUEST : 2092 candidates = intersection( set, DELETE_CODES ); 2093 break; 2094 2095 case DEL_RESPONSE : 2096 candidates = intersection( set, DELETE_CODES ); 2097 break; 2098 2099 case EXTENDED_REQUEST : 2100 candidates = intersection( set, EXTENDED_CODES ); 2101 break; 2102 2103 case EXTENDED_RESPONSE : 2104 candidates = intersection( set, EXTENDED_CODES ); 2105 break; 2106 2107 case MODIFYDN_REQUEST : 2108 candidates = intersection( set, MODIFYDN_CODES ); 2109 break; 2110 2111 case MODIFYDN_RESPONSE : 2112 candidates = intersection( set, MODIFYDN_CODES ); 2113 break; 2114 2115 case MODIFY_REQUEST : 2116 candidates = intersection( set, MODIFY_CODES ); 2117 break; 2118 2119 case MODIFY_RESPONSE : 2120 candidates = intersection( set, MODIFY_CODES ); 2121 break; 2122 2123 case SEARCH_REQUEST : 2124 candidates = intersection( set, SEARCH_CODES ); 2125 break; 2126 2127 case SEARCH_RESULT_DONE : 2128 candidates = intersection( set, SEARCH_CODES ); 2129 break; 2130 2131 case SEARCH_RESULT_ENTRY : 2132 candidates = intersection( set, SEARCH_CODES ); 2133 break; 2134 2135 case SEARCH_RESULT_REFERENCE : 2136 candidates = intersection( set, SEARCH_CODES ); 2137 break; 2138 2139 case UNBIND_REQUEST : 2140 return set.iterator().next(); 2141 } 2142 2143 // we don't want any codes that do not have anything to do w/ errors 2144 candidates.removeAll( NON_ERRONEOUS_CODES ); 2145 2146 if ( candidates.isEmpty() ) 2147 { 2148 return ResultCodeEnum.OTHER; 2149 } 2150 2151 return candidates.iterator().next(); 2152 } 2153 2154 2155 private static Set<ResultCodeEnum> intersection( Set<ResultCodeEnum> s1, Set<ResultCodeEnum> s2 ) 2156 { 2157 if ( s1.isEmpty() || s2.isEmpty() ) 2158 { 2159 return new HashSet<ResultCodeEnum>(); 2160 } 2161 2162 Set<ResultCodeEnum> intersection = new HashSet<ResultCodeEnum>(); 2163 2164 if ( s1.size() <= s2.size() ) 2165 { 2166 for ( ResultCodeEnum item:s1 ) 2167 { 2168 if ( s2.contains( item ) ) 2169 { 2170 intersection.add( item ); 2171 } 2172 } 2173 } 2174 else 2175 { 2176 for ( ResultCodeEnum item:s2 ) 2177 { 2178 if ( s1.contains( item ) ) 2179 { 2180 intersection.add( item ); 2181 } 2182 } 2183 } 2184 2185 return intersection; 2186 } 2187 2188 2189 /** 2190 * Gets the set of result codes a Throwable may map to. If the throwable 2191 * does not map to any result code at all an empty set is returned. The 2192 * following Throwables and their subclasses map to result codes: 2193 * 2194 * <pre> 2195 * 2196 * Unambiguous Exceptions 2197 * ====================== 2198 * 2199 * CommunicationException ==> operationsError(1) 2200 * TimeLimitExceededException ==> timeLimitExceeded(3) 2201 * SizeLimitExceededException ==> sizeLimitExceeded(4) 2202 * AuthenticationException ==> invalidCredentials(49) 2203 * NoPermissionException ==> insufficientAccessRights(50) 2204 * NoSuchAttributeException ==> noSuchAttribute(16) 2205 * InvalidAttributeIdentifierException ==> undefinedAttributeType(17) 2206 * InvalidSearchFilterException ==> inappropriateMatching(18) 2207 * AttributeInUseException ==> attributeOrValueExists(20) 2208 * NameNotFoundException ==> NO_SUCH_OBJECT(32) 2209 * NameAlreadyBoundException ==> entryAlreadyExists(68) 2210 * ContextNotEmptyException ==> notAllowedOnNonLeaf(66) 2211 * 2212 * 2213 * Ambiguous Exceptions 2214 * ==================== 2215 * 2216 * NamingException 2217 * --------------- 2218 * operationsError(1) 2219 * aliasProblem(33) 2220 * aliasDereferencingProblem(36) 2221 * loopDetect(54) 2222 * affectsMultipleDSAs(71) 2223 * other(80) 2224 * 2225 * AuthenticationNotSupportedException 2226 * ----------------------------------- 2227 * authMethodNotSupported (7) 2228 * strongAuthRequired (8) 2229 * confidentialityRequired (13) 2230 * inappropriateAuthentication(48) 2231 * 2232 * ServiceUnavailableException 2233 * --------------------------- 2234 * busy(51) 2235 * unavailable(52) 2236 * 2237 * InvalidAttributeValueException 2238 * ------------------------------ 2239 * constraintViolation(19) 2240 * invalidAttributeSyntax(21) 2241 * 2242 * PartialResultException 2243 * ---------------------- 2244 * partialResults(9) 2245 * referral(10) 2246 * 2247 * LimitExceededException 2248 * ---------------------- 2249 * referal(9) 2250 * adminLimitExceeded(11) 2251 * 2252 * OperationNotSupportedException 2253 * ------------------------------ 2254 * unavailableCriticalExtention(12) 2255 * unwillingToPerform(53) 2256 * 2257 * InvalidNameException 2258 * -------------------- 2259 * invalidDNSyntax(34) 2260 * namingViolation(64) 2261 * 2262 * SchemaViolationException 2263 * ------------------------ 2264 * objectClassViolation(65) 2265 * notAllowedOnRDN(67) 2266 * objectClassModsProhibited(69) 2267 * 2268 * </pre> 2269 * 2270 * @param t 2271 * the Throwable to find the result code mappings for 2272 * @return the set of mapped result codes 2273 */ 2274 public static Set<ResultCodeEnum> getResultCodes( Throwable t ) 2275 { 2276 ResultCodeEnum rc; 2277 2278 if ( ( rc = getResultCode( t ) ) != null ) 2279 { 2280 return Collections.singleton( rc ); 2281 } 2282 2283 if ( t instanceof LdapSchemaViolationException ) 2284 { 2285 return SCHEMAVIOLATIONEXCEPTION_CODES; 2286 } 2287 2288 if ( t instanceof LdapInvalidDnException ) 2289 { 2290 return INVALIDNAMEEXCEPTION_CODES; 2291 } 2292 2293 if ( t instanceof LdapUnwillingToPerformException ) 2294 { 2295 return OPERATIONNOTSUPPOERTEXCEPTION_CODES; 2296 } 2297 2298 if ( t instanceof LimitExceededException ) 2299 { 2300 return LIMITEXCEEDEDEXCEPTION_CODES; 2301 } 2302 2303 if ( t instanceof PartialResultException ) 2304 { 2305 return PARTIAL_RESULTSEXCEPTION_CODES; 2306 } 2307 2308 if ( t instanceof LdapInvalidAttributeValueException ) 2309 { 2310 return INVALIDATTRIBUTEVALUEEXCEPTION_CODES; 2311 } 2312 2313 if ( t instanceof LdapServiceUnavailableException ) 2314 { 2315 return SERVICEUNAVAILABLE_CODES; 2316 } 2317 2318 if ( t instanceof LdapAuthenticationNotSupportedException ) 2319 { 2320 return AUTHENTICATIONNOTSUPPOERTEDEXCEPTION_CODES; 2321 } 2322 2323 // keep this last because others are subtypes and thier evaluation 2324 // may be shorted otherwise by this comparison here 2325 if ( t instanceof LdapException ) 2326 { 2327 return NAMINGEXCEPTION_CODES; 2328 } 2329 2330 return EMPTY_RESULT_CODE_SET; 2331 } 2332 2333 2334 /** 2335 * Gets an LDAP result code from a Throwable if it can resolve it 2336 * unambiguously or returns null if it cannot resolve the exception to a 2337 * single ResultCode. If the Throwable is an instance of LdapException this 2338 * is already done for us, otherwise we use the following mapping: 2339 * 2340 * <pre> 2341 * 2342 * Unambiguous Exceptions 2343 * ====================== 2344 * 2345 * CommunicationException ==> operationsError(1) 2346 * TimeLimitExceededException ==> timeLimitExceeded(3) 2347 * SizeLimitExceededException ==> sizeLimitExceeded(4) 2348 * AuthenticationException ==> invalidCredentials(49) 2349 * NoPermissionException ==> insufficientAccessRights(50) 2350 * NoSuchAttributeException ==> noSuchAttribute(16) 2351 * InvalidAttributeIdentifierException ==> undefinedAttributeType(17) 2352 * InvalidSearchFilterException ==> inappropriateMatching(18) 2353 * AttributeInUseException ==> attributeOrValueExists(20) 2354 * NameNotFoundException ==> NO_SUCH_OBJECT(32) 2355 * NameAlreadyBoundException ==> entryAlreadyExists(68) 2356 * ContextNotEmptyException ==> notAllowedOnNonLeaf(66) 2357 * </pre> 2358 * 2359 * If we cannot find a mapping then null is returned. 2360 * 2361 * @param t The exception for which we need a ResultCodeEnum 2362 * @return The ResultCodeEnum associated wit the given exception 2363 */ 2364 public static ResultCodeEnum getResultCode( Throwable t ) 2365 { 2366 if ( t instanceof LdapOperationException ) 2367 { 2368 return ( ( LdapOperationException ) t ).getResultCode(); 2369 } 2370 2371 if ( t instanceof CommunicationException ) 2372 { 2373 return ResultCodeEnum.PROTOCOL_ERROR; 2374 } 2375 2376 if ( t instanceof LdapTimeLimitExceededException ) 2377 { 2378 return ResultCodeEnum.TIME_LIMIT_EXCEEDED; 2379 } 2380 2381 if ( t instanceof SizeLimitExceededException ) 2382 { 2383 return ResultCodeEnum.SIZE_LIMIT_EXCEEDED; 2384 } 2385 2386 if ( t instanceof LdapAuthenticationException ) 2387 { 2388 return ResultCodeEnum.INVALID_CREDENTIALS; 2389 } 2390 2391 if ( t instanceof LdapNoPermissionException ) 2392 { 2393 return ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS; 2394 } 2395 2396 if ( t instanceof LdapNoSuchAttributeException ) 2397 { 2398 return ResultCodeEnum.NO_SUCH_ATTRIBUTE; 2399 } 2400 2401 if ( t instanceof LdapInvalidAttributeTypeException ) 2402 { 2403 return ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE; 2404 } 2405 2406 if ( t instanceof LdapInvalidSearchFilterException ) 2407 { 2408 return ResultCodeEnum.INAPPROPRIATE_MATCHING; 2409 } 2410 2411 if ( t instanceof LdapAttributeInUseException ) 2412 { 2413 return ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS; 2414 } 2415 2416 if ( t instanceof LdapNoSuchObjectException ) 2417 { 2418 return ResultCodeEnum.NO_SUCH_OBJECT; 2419 } 2420 2421 if ( t instanceof LdapEntryAlreadyExistsException ) 2422 { 2423 return ResultCodeEnum.ENTRY_ALREADY_EXISTS; 2424 } 2425 2426 if ( t instanceof LdapContextNotEmptyException ) 2427 { 2428 return ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF; 2429 } 2430 2431 return null; 2432 } 2433 }