001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2006-2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.types;
028    import org.opends.messages.Message;
029    
030    
031    import org.opends.server.protocols.ldap.LDAPResultCode;
032    
033    import static org.opends.messages.CoreMessages.*;
034    
035    
036    
037    /**
038     * This enumeration defines the set of possible result codes that may
039     * be used for providing clients with information about result of
040     * processing an operation.
041     */
042    @org.opends.server.types.PublicAPI(
043         stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
044         mayInstantiate=false,
045         mayExtend=false,
046         mayInvoke=true)
047    public enum ResultCode
048    {
049      /**
050       * The result code that should only be used if the actual result
051       * code has not yet been determined.
052       */
053      UNDEFINED(-1, null),
054    
055    
056    
057      /**
058       * The result code that indicates that the operation completed
059       * successfully.
060       */
061      SUCCESS(LDAPResultCode.SUCCESS, INFO_RESULT_SUCCESS.get()),
062    
063    
064    
065      /**
066       * The result code that indicates that an internal error prevented
067       * the operation from being processed properly.
068       */
069      OPERATIONS_ERROR(LDAPResultCode.OPERATIONS_ERROR,
070                       INFO_RESULT_OPERATIONS_ERROR.get()),
071    
072    
073    
074      /**
075       * The result code that indicates that the client sent a malformed
076       * or illegal request to the server.
077       */
078      PROTOCOL_ERROR(LDAPResultCode.PROTOCOL_ERROR,
079                     INFO_RESULT_PROTOCOL_ERROR.get()),
080    
081    
082    
083      /**
084       * The result code that indicates that a time limit was exceeded
085       * while attempting to process the request.
086       */
087      TIME_LIMIT_EXCEEDED(LDAPResultCode.TIME_LIMIT_EXCEEDED,
088                          INFO_RESULT_TIME_LIMIT_EXCEEDED.get()),
089    
090    
091    
092      /**
093       * The result code that indicates that a size limit was exceeded
094       * while attempting to process the request.
095       */
096      SIZE_LIMIT_EXCEEDED(LDAPResultCode.SIZE_LIMIT_EXCEEDED,
097                          INFO_RESULT_SIZE_LIMIT_EXCEEDED.get()),
098    
099    
100    
101      /**
102       * The result code that indicates that the attribute value assertion
103       * included in a compare request did not match the targeted entry.
104       */
105      COMPARE_FALSE(LDAPResultCode.COMPARE_FALSE,
106                    INFO_RESULT_COMPARE_FALSE.get()),
107    
108    
109    
110      /**
111       * The result code that indicates that the attribute value assertion
112       * included in a compare request did match the targeted entry.
113       */
114      COMPARE_TRUE(LDAPResultCode.COMPARE_TRUE,
115                   INFO_RESULT_COMPARE_TRUE.get()),
116    
117    
118    
119      /**
120       * The result code that indicates that the requested authentication
121       * attempt failed because it referenced an invalid SASL mechanism.
122       */
123      AUTH_METHOD_NOT_SUPPORTED(LDAPResultCode.AUTH_METHOD_NOT_SUPPORTED,
124                             INFO_RESULT_AUTH_METHOD_NOT_SUPPORTED.get()),
125    
126    
127    
128      /**
129       * The result code that indicates that the requested operation could
130       * not be processed because it requires that the client has
131       * completed a strong form of authentication.
132       */
133      STRONG_AUTH_REQUIRED(LDAPResultCode.STRONG_AUTH_REQUIRED,
134                           INFO_RESULT_STRONG_AUTH_REQUIRED.get()),
135    
136    
137    
138      /**
139       * The result code that indicates that a referral was encountered.
140       */
141      REFERRAL(LDAPResultCode.REFERRAL, INFO_RESULT_REFERRAL.get()),
142    
143    
144    
145      /**
146       * The result code that indicates that processing on the requested
147       * operation could not continue because an administrative limit was
148       * exceeded.
149       */
150      ADMIN_LIMIT_EXCEEDED(LDAPResultCode.ADMIN_LIMIT_EXCEEDED,
151                           INFO_RESULT_ADMIN_LIMIT_EXCEEDED.get()),
152    
153    
154    
155      /**
156       * The result code that indicates that the requested operation
157       * failed because it included a critical extension that is
158       * unsupported or inappropriate for that request.
159       */
160      UNAVAILABLE_CRITICAL_EXTENSION(
161           LDAPResultCode.UNAVAILABLE_CRITICAL_EXTENSION,
162           INFO_RESULT_UNAVAILABLE_CRITICAL_EXTENSION.get()),
163    
164    
165    
166      /**
167       * The result code that indicates that the requested operation could
168       * not be processed because it requires confidentiality for the
169       * communication between the client and the server.
170       */
171      CONFIDENTIALITY_REQUIRED(LDAPResultCode.CONFIDENTIALITY_REQUIRED,
172                              INFO_RESULT_CONFIDENTIALITY_REQUIRED.get()),
173    
174    
175    
176      /**
177       * The result code that should be used for intermediate responses in
178       * multi-stage SASL bind operations.
179       */
180      SASL_BIND_IN_PROGRESS(LDAPResultCode.SASL_BIND_IN_PROGRESS,
181                            INFO_RESULT_SASL_BIND_IN_PROGRESS.get()),
182    
183    
184    
185      /**
186       * The result code that indicates that the requested operation
187       * failed because it targeted an attribute or attribute value that
188       * did not exist in the specified entry.
189       */
190      NO_SUCH_ATTRIBUTE(LDAPResultCode.NO_SUCH_ATTRIBUTE,
191                        INFO_RESULT_NO_SUCH_ATTRIBUTE.get()),
192    
193    
194    
195      /**
196       * The result code that indicates that the requested operation
197       * failed because it referenced an attribute that is not defined in
198       * the server schema.
199       */
200      UNDEFINED_ATTRIBUTE_TYPE(LDAPResultCode.UNDEFINED_ATTRIBUTE_TYPE,
201                              INFO_RESULT_UNDEFINED_ATTRIBUTE_TYPE.get()),
202    
203    
204    
205      /**
206       * The result code that indicates that the requested operation
207       * failed because it attempted to perform an inappropriate type of
208       * matching against an attribute.
209       */
210      INAPPROPRIATE_MATCHING(LDAPResultCode.INAPPROPRIATE_MATCHING,
211                             INFO_RESULT_INAPPROPRIATE_MATCHING.get()),
212    
213    
214    
215      /**
216       * The result code that indicates that the requested operation
217       * failed because it would have violated some constraint defined in
218       * the server.
219       */
220      CONSTRAINT_VIOLATION(LDAPResultCode.CONSTRAINT_VIOLATION,
221                           INFO_RESULT_CONSTRAINT_VIOLATION.get()),
222    
223    
224    
225      /**
226       * The result code that indicates that the requested operation
227       * failed because it would have resulted in a conflict with an
228       * existing attribute or attribute value in the target entry.
229       */
230      ATTRIBUTE_OR_VALUE_EXISTS(LDAPResultCode.ATTRIBUTE_OR_VALUE_EXISTS,
231                             INFO_RESULT_ATTRIBUTE_OR_VALUE_EXISTS.get()),
232    
233    
234    
235      /**
236       * The result code that indicates that the requested operation
237       * failed because it violated the syntax for a specified attribute.
238       */
239      INVALID_ATTRIBUTE_SYNTAX(LDAPResultCode.INVALID_ATTRIBUTE_SYNTAX,
240                              INFO_RESULT_INVALID_ATTRIBUTE_SYNTAX.get()),
241    
242    
243    
244      /**
245       * The result code that indicates that the requested operation
246       * failed because it referenced an entry that does not exist.
247       */
248      NO_SUCH_OBJECT(LDAPResultCode.NO_SUCH_OBJECT,
249                     INFO_RESULT_NO_SUCH_OBJECT.get()),
250    
251    
252    
253      /**
254       * The result code that indicates that the requested operation
255       * failed because it attempted to perform an illegal operation on an
256       * alias.
257       */
258      ALIAS_PROBLEM(LDAPResultCode.ALIAS_PROBLEM,
259                    INFO_RESULT_ALIAS_PROBLEM.get()),
260    
261    
262    
263      /**
264       * The result code that indicates that the requested operation
265       * failed because it would have resulted in an entry with an invalid
266       * or malformed DN.
267       */
268      INVALID_DN_SYNTAX(LDAPResultCode.INVALID_DN_SYNTAX,
269                        INFO_RESULT_INVALID_DN_SYNTAX.get()),
270    
271    
272    
273      /**
274       * The result code that indicates that a problem was encountered
275       * while attempting to dereference an alias for a search operation.
276       */
277      ALIAS_DEREFERENCING_PROBLEM(
278           LDAPResultCode.ALIAS_DEREFERENCING_PROBLEM,
279           INFO_RESULT_ALIAS_DEREFERENCING_PROBLEM.get()),
280    
281    
282    
283      /**
284       * The result code that indicates that an authentication attempt
285       * failed because the requested type of authentication was not
286       * appropriate for the targeted entry.
287       */
288      INAPPROPRIATE_AUTHENTICATION(
289           LDAPResultCode.INAPPROPRIATE_AUTHENTICATION,
290           INFO_RESULT_INAPPROPRIATE_AUTHENTICATION.get()),
291    
292    
293    
294      /**
295       * The result code that indicates that an authentication attempt
296       * failed because the user did not provide a valid set of
297       * credentials.
298       */
299      INVALID_CREDENTIALS(LDAPResultCode.INVALID_CREDENTIALS,
300                          INFO_RESULT_INVALID_CREDENTIALS.get()),
301    
302    
303    
304      /**
305       * The result code that indicates that the client does not have
306       * sufficient permission to perform the requested operation.
307       */
308      INSUFFICIENT_ACCESS_RIGHTS(
309           LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
310           INFO_RESULT_INSUFFICIENT_ACCESS_RIGHTS.get()),
311    
312    
313    
314      /**
315       * The result code that indicates that the server is too busy to
316       * process the requested operation.
317       */
318      BUSY(LDAPResultCode.BUSY, INFO_RESULT_BUSY.get()),
319    
320    
321    
322      /**
323       * The result code that indicates that either the entire server or
324       * one or more required resources were not available for use in
325       * processing the request.
326       */
327      UNAVAILABLE(LDAPResultCode.UNAVAILABLE,
328              INFO_RESULT_UNAVAILABLE.get()),
329    
330    
331    
332      /**
333       * The result code that indicates that the server is unwilling to
334       * perform the requested operation.
335       */
336      UNWILLING_TO_PERFORM(LDAPResultCode.UNWILLING_TO_PERFORM,
337                           INFO_RESULT_UNWILLING_TO_PERFORM.get()),
338    
339    
340    
341      /**
342       * The result code that indicates that a referral or chaining
343       * loop was detected while processing the request.
344       */
345      LOOP_DETECT(LDAPResultCode.LOOP_DETECT,
346              INFO_RESULT_LOOP_DETECT.get()),
347    
348    
349    
350      /**
351       * The result code that indicates that a search request included a
352       * VLV request control without a server-side sort control.
353       */
354      SORT_CONTROL_MISSING(LDAPResultCode.SORT_CONTROL_MISSING,
355                           INFO_RESULT_SORT_CONTROL_MISSING.get()),
356    
357    
358    
359      /**
360       * The result code that indicates that a search request included a
361       * VLV request control with an invalid offset.
362       */
363      OFFSET_RANGE_ERROR(LDAPResultCode.OFFSET_RANGE_ERROR,
364                         INFO_RESULT_OFFSET_RANGE_ERROR.get()),
365    
366    
367    
368      /**
369       * The result code that indicates that the requested operation
370       * failed because it would have violated the server's naming
371       * configuration.
372       */
373      NAMING_VIOLATION(LDAPResultCode.NAMING_VIOLATION,
374                       INFO_RESULT_NAMING_VIOLATION.get()),
375    
376    
377    
378      /**
379       * The result code that indicates that the requested operation
380       * failed because it would have resulted in an entry that violated
381       * the server schema.
382       */
383      OBJECTCLASS_VIOLATION(LDAPResultCode.OBJECTCLASS_VIOLATION,
384                            INFO_RESULT_OBJECTCLASS_VIOLATION.get()),
385    
386    
387    
388      /**
389       * The result code that indicates that the requested operation is
390       * not allowed for non-leaf entries.
391       */
392      NOT_ALLOWED_ON_NONLEAF(LDAPResultCode.NOT_ALLOWED_ON_NONLEAF,
393                             INFO_RESULT_NOT_ALLOWED_ON_NONLEAF.get()),
394    
395    
396    
397      /**
398       * The result code that indicates that the requested operation is
399       * not allowed on an RDN attribute.
400       */
401      NOT_ALLOWED_ON_RDN(LDAPResultCode.NOT_ALLOWED_ON_RDN,
402                         INFO_RESULT_NOT_ALLOWED_ON_RDN.get()),
403    
404    
405    
406      /**
407       * The result code that indicates that the requested operation
408       * failed because it would have resulted in an entry that conflicts
409       * with an entry that already exists.
410       */
411      ENTRY_ALREADY_EXISTS(LDAPResultCode.ENTRY_ALREADY_EXISTS,
412                           INFO_RESULT_ENTRY_ALREADY_EXISTS.get()),
413    
414    
415    
416      /**
417       * The result code that indicates that the operation could not be
418       * processed because it would have modified the objectclasses
419       * associated with an entry in an illegal manner.
420       */
421      OBJECTCLASS_MODS_PROHIBITED(
422           LDAPResultCode.OBJECTCLASS_MODS_PROHIBITED,
423           INFO_RESULT_OBJECTCLASS_MODS_PROHIBITED.get()),
424    
425    
426    
427      /**
428       * The result code that indicates that the operation could not be
429       * processed because it would impact multiple DSAs or other
430       * repositories.
431       */
432      AFFECTS_MULTIPLE_DSAS(LDAPResultCode.AFFECTS_MULTIPLE_DSAS,
433                            INFO_RESULT_AFFECTS_MULTIPLE_DSAS.get()),
434    
435    
436    
437      /**
438       * The result code that indicates that the operation could not be
439       * processed because there was an error while processing the virtual
440       * list view control.
441       */
442      VIRTUAL_LIST_VIEW_ERROR(LDAPResultCode.VIRTUAL_LIST_VIEW_ERROR,
443                              INFO_RESULT_VIRTUAL_LIST_VIEW_ERROR.get()),
444    
445    
446    
447      /**
448       * The result code that should be used if no other result code is
449       * appropriate.
450       */
451      OTHER(LDAPResultCode.OTHER, INFO_RESULT_OTHER.get()),
452    
453    
454    
455      /**
456       * The client-side result code that should be used if an established
457       * connection is lost.  This should not be used over protocol.
458       */
459      CLIENT_SIDE_SERVER_DOWN(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
460                              INFO_RESULT_CLIENT_SIDE_SERVER_DOWN.get()),
461    
462    
463    
464      /**
465       * The client-side result code that should be used if a local
466       * (client-side) error occurs.  This should not be used over
467       * protocol.
468       */
469      CLIENT_SIDE_LOCAL_ERROR(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
470                              INFO_RESULT_CLIENT_SIDE_LOCAL_ERROR.get()),
471    
472    
473    
474      /**
475       * The client-side result code that should be used if an error
476       * occurs while encoding a request.  This should not be used over
477       * protocol.
478       */
479      CLIENT_SIDE_ENCODING_ERROR(
480           LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
481           INFO_RESULT_CLIENT_SIDE_ENCODING_ERROR.get()),
482    
483    
484    
485      /**
486       * The client-side result code that should be used if an error
487       * occurs while decoding a response.  This should not be used over
488       * protocol.
489       */
490      CLIENT_SIDE_DECODING_ERROR(
491           LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
492           INFO_RESULT_CLIENT_SIDE_DECODING_ERROR.get()),
493    
494    
495    
496      /**
497       * The client-side result code that should be used if a client-side
498       * timeout occurs.  This should not be used over protocol.
499       */
500      CLIENT_SIDE_TIMEOUT(LDAPResultCode.CLIENT_SIDE_TIMEOUT,
501                          INFO_RESULT_CLIENT_SIDE_TIMEOUT.get()),
502    
503    
504    
505      /**
506       * The client-side result code that should be used if an unknown or
507       * unsupported authentication mechanism is requested.  This should
508       * not be used over protocol.
509       */
510      CLIENT_SIDE_AUTH_UNKNOWN(LDAPResultCode.CLIENT_SIDE_AUTH_UNKNOWN,
511                             INFO_RESULT_CLIENT_SIDE_AUTH_UNKNOWN.get()),
512    
513    
514    
515      /**
516       * The client-side result code that should be used if a malformed
517       * search filter is provided.  This should not be used over
518       * protocol.
519       */
520      CLIENT_SIDE_FILTER_ERROR(LDAPResultCode.CLIENT_SIDE_FILTER_ERROR,
521                             INFO_RESULT_CLIENT_SIDE_FILTER_ERROR.get()),
522    
523    
524    
525      /**
526       * The client-side result code that should be used if a user
527       * cancelled a client-side operation.  This should not be used over
528       * protocol.
529       */
530      CLIENT_SIDE_USER_CANCELLED(
531           LDAPResultCode.CLIENT_SIDE_USER_CANCELLED,
532           INFO_RESULT_CLIENT_SIDE_USER_CANCELLED.get()),
533    
534    
535    
536      /**
537       * The client-side result code that should be used if there was an
538       * error in the parameter(s) provided.  This should not be used over
539       * protocol.
540       */
541      CLIENT_SIDE_PARAM_ERROR(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
542                              INFO_RESULT_CLIENT_SIDE_PARAM_ERROR.get()),
543    
544    
545    
546      /**
547       * The client-side result code that should be used if the client
548       * cannot obtain enough memory to perform the requested operation.
549       * This should not be used over protocol.
550       */
551      CLIENT_SIDE_NO_MEMORY(LDAPResultCode.CLIENT_SIDE_NO_MEMORY,
552                            INFO_RESULT_CLIENT_SIDE_NO_MEMORY.get()),
553    
554    
555    
556      /**
557       * The client-side result code that should be used if a connection
558       * cannot be established.  This should not be used over protocol.
559       */
560      CLIENT_SIDE_CONNECT_ERROR(LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR,
561                             INFO_RESULT_CLIENT_SIDE_CONNECT_ERROR.get()),
562    
563    
564    
565      /**
566       * The client-side result code that should be used if a user
567       * requests an unsupported operation.  This should not be used over
568       * protocol.
569       */
570      CLIENT_SIDE_NOT_SUPPORTED(LDAPResultCode.CLIENT_SIDE_NOT_SUPPORTED,
571                             INFO_RESULT_CLIENT_SIDE_NOT_SUPPORTED.get()),
572    
573    
574    
575      /**
576       * The client-side result code that should be used if an expected
577       * control is not found in a response.  This should not be used over
578       * protocol.
579       */
580      CLIENT_SIDE_CONTROL_NOT_FOUND(
581           LDAPResultCode.CLIENT_SIDE_CONTROL_NOT_FOUND,
582           INFO_RESULT_CLIENT_SIDE_CONTROL_NOT_FOUND.get()),
583    
584    
585    
586      /**
587       * The client-side result code that should be used if no results
588       * were returned for a search operation that expected them.  This
589       * should not be used over protocol.
590       */
591      CLIENT_SIDE_NO_RESULTS_RETURNED(
592           LDAPResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
593           INFO_RESULT_CLIENT_SIDE_NO_RESULTS_RETURNED.get()),
594    
595    
596    
597      /**
598       * The client-side result code that should be used if there are more
599       * results to be processed.  This should not be used over protocol.
600       */
601      CLIENT_SIDE_MORE_RESULTS_TO_RETURN(
602           LDAPResultCode.CLIENT_SIDE_MORE_RESULTS_TO_RETURN,
603           INFO_RESULT_CLIENT_SIDE_MORE_RESULTS_TO_RETURN.get()),
604    
605    
606    
607      /**
608       * The client-side result code that should be used if a referral
609       * loop is detected.  This should not be used over protocol.
610       */
611      CLIENT_SIDE_CLIENT_LOOP(LDAPResultCode.CLIENT_SIDE_CLIENT_LOOP,
612                              INFO_RESULT_CLIENT_SIDE_CLIENT_LOOP.get()),
613    
614    
615    
616      /**
617       * The client-side result code that should be used if the referral
618       * hop limit was exceeded.  This should not be used over protocol.
619       */
620      CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED(
621           LDAPResultCode.CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED,
622           INFO_RESULT_CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED.get()),
623    
624    
625    
626      /**
627       * The result code that indicates that a cancel request was
628       * successful, or that the specified operation was canceled.
629       */
630      CANCELED(LDAPResultCode.CANCELED, INFO_RESULT_CANCELED.get()),
631    
632    
633    
634      /**
635       * The result code that indicates that a cancel request was
636       * unsuccessful because the targeted operation did not exist or had
637       * already completed.
638       */
639      NO_SUCH_OPERATION(LDAPResultCode.NO_SUCH_OPERATION,
640                        INFO_RESULT_NO_SUCH_OPERATION.get()),
641    
642    
643    
644      /**
645       * The result code that indicates that a cancel request was
646       * unsuccessful because processing on the targeted operation had
647       * already reached a point at which it could not be canceled.
648       */
649      TOO_LATE(LDAPResultCode.TOO_LATE, INFO_RESULT_TOO_LATE.get()),
650    
651    
652    
653      /**
654       * The result code that indicates that a cancel request was
655       * unsuccessful because the targeted operation was one that could
656       * not be canceled.
657       */
658      CANNOT_CANCEL(LDAPResultCode.CANNOT_CANCEL,
659                    INFO_RESULT_CANNOT_CANCEL.get()),
660    
661    
662    
663      /**
664       * The result code that indicates that the filter contained in an
665       * assertion control failed to match the target entry.
666       */
667      ASSERTION_FAILED(LDAPResultCode.ASSERTION_FAILED,
668                       INFO_RESULT_ASSERTION_FAILED.get()),
669    
670    
671    
672      /**
673       * The result code that should be used if the server will not allow
674       * the client to use the requested authorization.
675       */
676      AUTHORIZATION_DENIED(LDAPResultCode.AUTHORIZATION_DENIED,
677                           INFO_RESULT_AUTHORIZATION_DENIED.get()),
678    
679    
680    
681      /**
682       * The result code that should be used if the server did not
683       * actually complete processing on the associated operation because
684       * the request included the LDAP No-Op control.
685       */
686      NO_OPERATION(LDAPResultCode.NO_OPERATION,
687                   INFO_RESULT_NO_OPERATION.get());
688    
689    
690    
691      // The integer value for this result code.
692      private int intValue;
693    
694      // The short human-readable name for this result code.
695      private Message resultCodeName;
696    
697    
698    
699      /**
700       * Creates a new result code with the specified int value and unique
701       * identifier.
702       *
703       * @param  intValue      The integer value for this result code.
704       * @param  name          The name for this result code.
705       */
706      private ResultCode(int intValue, Message name)
707      {
708        this.intValue       = intValue;
709        this.resultCodeName = name;
710      }
711    
712    
713    
714      /**
715       * Retrieves the integer value for this result code.
716       *
717       * @return  The integer value for this result code.
718       */
719      public int getIntValue()
720      {
721        return intValue;
722      }
723    
724    
725    
726      /**
727       * Retrieves the result code with the provided int value.
728       *
729       * @param  intValue  The value for which to retrieve the
730       *                   corresponding result code.
731       *
732       * @return  The result code with the provided int value, or
733       *          <CODE>ResultCode.OTHER</CODE> if there is no recognized
734       *          result code with the provided int value.
735       */
736      public static ResultCode valueOf(int intValue)
737      {
738        switch (intValue)
739        {
740          case LDAPResultCode.SUCCESS:
741            return SUCCESS;
742          case LDAPResultCode.OPERATIONS_ERROR:
743            return OPERATIONS_ERROR;
744          case LDAPResultCode.PROTOCOL_ERROR:
745            return PROTOCOL_ERROR;
746          case LDAPResultCode.TIME_LIMIT_EXCEEDED:
747            return TIME_LIMIT_EXCEEDED;
748          case LDAPResultCode.SIZE_LIMIT_EXCEEDED:
749            return SIZE_LIMIT_EXCEEDED;
750          case LDAPResultCode.COMPARE_FALSE:
751            return COMPARE_FALSE;
752          case LDAPResultCode.COMPARE_TRUE:
753            return COMPARE_TRUE;
754          case LDAPResultCode.AUTH_METHOD_NOT_SUPPORTED:
755            return AUTH_METHOD_NOT_SUPPORTED;
756          case LDAPResultCode.STRONG_AUTH_REQUIRED:
757            return STRONG_AUTH_REQUIRED;
758          case LDAPResultCode.REFERRAL:
759            return REFERRAL;
760          case LDAPResultCode.ADMIN_LIMIT_EXCEEDED:
761            return ADMIN_LIMIT_EXCEEDED;
762          case LDAPResultCode.UNAVAILABLE_CRITICAL_EXTENSION:
763            return UNAVAILABLE_CRITICAL_EXTENSION;
764          case LDAPResultCode.CONFIDENTIALITY_REQUIRED:
765            return CONFIDENTIALITY_REQUIRED;
766          case LDAPResultCode.SASL_BIND_IN_PROGRESS:
767            return SASL_BIND_IN_PROGRESS;
768          case LDAPResultCode.NO_SUCH_ATTRIBUTE:
769            return NO_SUCH_ATTRIBUTE;
770          case LDAPResultCode.UNDEFINED_ATTRIBUTE_TYPE:
771            return UNDEFINED_ATTRIBUTE_TYPE;
772          case LDAPResultCode.INAPPROPRIATE_MATCHING:
773            return INAPPROPRIATE_MATCHING;
774          case LDAPResultCode.CONSTRAINT_VIOLATION:
775            return CONSTRAINT_VIOLATION;
776          case LDAPResultCode.ATTRIBUTE_OR_VALUE_EXISTS:
777            return ATTRIBUTE_OR_VALUE_EXISTS;
778          case LDAPResultCode.INVALID_ATTRIBUTE_SYNTAX:
779            return INVALID_ATTRIBUTE_SYNTAX;
780          case LDAPResultCode.NO_SUCH_OBJECT:
781            return NO_SUCH_OBJECT;
782          case LDAPResultCode.ALIAS_PROBLEM:
783            return ALIAS_PROBLEM;
784          case LDAPResultCode.INVALID_DN_SYNTAX:
785            return INVALID_DN_SYNTAX;
786          case LDAPResultCode.ALIAS_DEREFERENCING_PROBLEM:
787            return ALIAS_DEREFERENCING_PROBLEM;
788          case LDAPResultCode.INAPPROPRIATE_AUTHENTICATION:
789            return INAPPROPRIATE_AUTHENTICATION;
790          case LDAPResultCode.INVALID_CREDENTIALS:
791            return INVALID_CREDENTIALS;
792          case LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS:
793            return INSUFFICIENT_ACCESS_RIGHTS;
794          case LDAPResultCode.BUSY:
795            return BUSY;
796          case LDAPResultCode.UNAVAILABLE:
797            return UNAVAILABLE;
798          case LDAPResultCode.UNWILLING_TO_PERFORM:
799            return UNWILLING_TO_PERFORM;
800          case LDAPResultCode.LOOP_DETECT:
801            return LOOP_DETECT;
802          case LDAPResultCode.SORT_CONTROL_MISSING:
803            return SORT_CONTROL_MISSING;
804          case LDAPResultCode.OFFSET_RANGE_ERROR:
805            return OFFSET_RANGE_ERROR;
806          case LDAPResultCode.NAMING_VIOLATION:
807            return NAMING_VIOLATION;
808          case LDAPResultCode.OBJECTCLASS_VIOLATION:
809            return OBJECTCLASS_VIOLATION;
810          case LDAPResultCode.NOT_ALLOWED_ON_NONLEAF:
811            return NOT_ALLOWED_ON_NONLEAF;
812          case LDAPResultCode.NOT_ALLOWED_ON_RDN:
813            return NOT_ALLOWED_ON_RDN;
814          case LDAPResultCode.ENTRY_ALREADY_EXISTS:
815            return ENTRY_ALREADY_EXISTS;
816          case LDAPResultCode.OBJECTCLASS_MODS_PROHIBITED:
817            return OBJECTCLASS_MODS_PROHIBITED;
818          case LDAPResultCode.AFFECTS_MULTIPLE_DSAS:
819            return AFFECTS_MULTIPLE_DSAS;
820          case LDAPResultCode.VIRTUAL_LIST_VIEW_ERROR:
821            return VIRTUAL_LIST_VIEW_ERROR;
822          case LDAPResultCode.CLIENT_SIDE_SERVER_DOWN:
823            return CLIENT_SIDE_SERVER_DOWN;
824          case LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR:
825            return CLIENT_SIDE_LOCAL_ERROR;
826          case LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR:
827            return CLIENT_SIDE_ENCODING_ERROR;
828          case LDAPResultCode.CLIENT_SIDE_DECODING_ERROR:
829            return CLIENT_SIDE_DECODING_ERROR;
830          case LDAPResultCode.CLIENT_SIDE_TIMEOUT:
831            return CLIENT_SIDE_TIMEOUT;
832          case LDAPResultCode.CLIENT_SIDE_AUTH_UNKNOWN:
833            return CLIENT_SIDE_AUTH_UNKNOWN;
834          case LDAPResultCode.CLIENT_SIDE_FILTER_ERROR:
835            return CLIENT_SIDE_FILTER_ERROR;
836          case LDAPResultCode.CLIENT_SIDE_USER_CANCELLED:
837            return CLIENT_SIDE_USER_CANCELLED;
838          case LDAPResultCode.CLIENT_SIDE_PARAM_ERROR:
839            return CLIENT_SIDE_PARAM_ERROR;
840          case LDAPResultCode.CLIENT_SIDE_NO_MEMORY:
841            return CLIENT_SIDE_NO_MEMORY;
842          case LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR:
843            return CLIENT_SIDE_CONNECT_ERROR;
844          case LDAPResultCode.CLIENT_SIDE_NOT_SUPPORTED:
845            return CLIENT_SIDE_NOT_SUPPORTED;
846          case LDAPResultCode.CLIENT_SIDE_CONTROL_NOT_FOUND:
847            return CLIENT_SIDE_CONTROL_NOT_FOUND;
848          case LDAPResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED:
849            return CLIENT_SIDE_NO_RESULTS_RETURNED;
850          case LDAPResultCode.CLIENT_SIDE_MORE_RESULTS_TO_RETURN:
851            return CLIENT_SIDE_MORE_RESULTS_TO_RETURN;
852          case LDAPResultCode.CLIENT_SIDE_CLIENT_LOOP:
853            return CLIENT_SIDE_CLIENT_LOOP;
854          case LDAPResultCode.CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED:
855            return CLIENT_SIDE_REFERRAL_LIMIT_EXCEEDED;
856          case LDAPResultCode.CANCELED:
857            return CANCELED;
858          case LDAPResultCode.NO_SUCH_OPERATION:
859            return NO_SUCH_OPERATION;
860          case LDAPResultCode.TOO_LATE:
861            return TOO_LATE;
862          case LDAPResultCode.CANNOT_CANCEL:
863            return CANNOT_CANCEL;
864          case LDAPResultCode.ASSERTION_FAILED:
865            return ASSERTION_FAILED;
866          case LDAPResultCode.AUTHORIZATION_DENIED:
867            return AUTHORIZATION_DENIED;
868          case LDAPResultCode.NO_OPERATION:
869            // FIXME -- We will also need to handle the official result
870            //          code when it is allocated.
871            return NO_OPERATION;
872          default:
873            return ResultCode.OTHER;
874        }
875      }
876    
877    
878    
879      /**
880       * Retrieves the short human-readable name for this result code.
881       *
882       * @return  The short human-readable name for this result code.
883       */
884      public Message getResultCodeName()
885      {
886        return resultCodeName;
887      }
888    
889    
890    
891      /**
892       * Retrieves a string representation of this result code.
893       *
894       * @return  A string representation of this result code.
895       */
896      public String toString()
897      {
898        return resultCodeName != null ? resultCodeName.toString() : null;
899      }
900    }
901