001/*
002 * Copyright 2007-2023 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2007-2023 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2007-2023 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk;
037
038
039
040import java.io.Serializable;
041import java.util.concurrent.ConcurrentHashMap;
042
043import com.unboundid.util.NotMutable;
044import com.unboundid.util.NotNull;
045import com.unboundid.util.Nullable;
046import com.unboundid.util.StaticUtils;
047import com.unboundid.util.ThreadSafety;
048import com.unboundid.util.ThreadSafetyLevel;
049
050import static com.unboundid.ldap.sdk.LDAPMessages.*;
051
052
053
054/**
055 * This class defines a number of constants associated with LDAP result codes.
056 * The {@code ResultCode} constant values defined in this class are immutable,
057 * and at most one result code object will ever be created for a given int
058 * value, so it is acceptable to compare result codes with either the
059 * {@link ResultCode#equals} method or the "{@code ==}" operator.
060 *<BR><BR>
061 * The result codes that are currently defined include:
062 * <BR>
063 * <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="50%"
064 *        SUMMARY="Result Code Names and Numeric Values">
065 *   <TR>
066 *     <TH ALIGN="LEFT">Name</TH>
067 *     <TH ALIGN="RIGHT">Integer Value</TH>
068 *   </TR>
069 *   <TR>
070 *     <TD ALIGN="LEFT">SUCCESS</TD>
071 *     <TD ALIGN="RIGHT">0</TD>
072 *   </TR>
073 *   <TR>
074 *     <TD ALIGN="LEFT">OPERATIONS_ERROR</TD>
075 *     <TD ALIGN="RIGHT">1</TD>
076 *   </TR>
077 *   <TR>
078 *     <TD ALIGN="LEFT">PROTOCOL_ERROR</TD>
079 *     <TD ALIGN="RIGHT">2</TD>
080 *   </TR>
081 *   <TR>
082 *     <TD ALIGN="LEFT">TIME_LIMIT_EXCEEDED</TD>
083 *     <TD ALIGN="RIGHT">3</TD>
084 *   </TR>
085 *   <TR>
086 *     <TD ALIGN="LEFT">SIZE_LIMIT_EXCEEDED</TD>
087 *     <TD ALIGN="RIGHT">4</TD>
088 *   </TR>
089 *   <TR>
090 *     <TD ALIGN="LEFT">COMPARE_FALSE</TD>
091 *     <TD ALIGN="RIGHT">5</TD>
092 *   </TR>
093 *   <TR>
094 *     <TD ALIGN="LEFT">COMPARE_TRUE</TD>
095 *     <TD ALIGN="RIGHT">6</TD>
096 *   </TR>
097 *   <TR>
098 *     <TD ALIGN="LEFT">AUTH_METHOD_NOT_SUPPORTED</TD>
099 *     <TD ALIGN="RIGHT">7</TD>
100 *   </TR>
101 *   <TR>
102 *     <TD ALIGN="LEFT">STRONG_AUTH_REQUIRED</TD>
103 *     <TD ALIGN="RIGHT">8</TD>
104 *   </TR>
105 *   <TR>
106 *     <TD ALIGN="LEFT">REFERRAL</TD>
107 *     <TD ALIGN="RIGHT">10</TD>
108 *   </TR>
109 *   <TR>
110 *    <TD ALIGN="LEFT">ADMIN_LIMIT_EXCEEDED</TD>
111 *     <TD ALIGN="RIGHT">11</TD>
112 *   </TR>
113 *   <TR>
114 *     <TD ALIGN="LEFT">UNAVAILABLE_CRITICAL_EXTENSION</TD>
115 *     <TD ALIGN="RIGHT">12</TD>
116 *   </TR>
117 *   <TR>
118 *     <TD ALIGN="LEFT">CONFIDENTIALITY_REQUIRED</TD>
119 *     <TD ALIGN="RIGHT">13</TD>
120 *   </TR>
121 *   <TR>
122 *     <TD ALIGN="LEFT">SASL_BIND_IN_PROGRESS</TD>
123 *     <TD ALIGN="RIGHT">14</TD>
124 *   </TR>
125 *   <TR>
126 *     <TD ALIGN="LEFT">NO_SUCH_ATTRIBUTE</TD>
127 *     <TD ALIGN="RIGHT">16</TD>
128 *   </TR>
129 *   <TR>
130 *     <TD ALIGN="LEFT">UNDEFINED_ATTRIBUTE_TYPE</TD>
131 *     <TD ALIGN="RIGHT">17</TD>
132 *   </TR>
133 *   <TR>
134 *     <TD ALIGN="LEFT">INAPPROPRIATE_MATCHING</TD>
135 *     <TD ALIGN="RIGHT">18</TD>
136 *   </TR>
137 *   <TR>
138 *     <TD ALIGN="LEFT">CONSTRAINT_VIOLATION</TD>
139 *     <TD ALIGN="RIGHT">19</TD>
140 *   </TR>
141 *   <TR>
142 *     <TD ALIGN="LEFT">ATTRIBUTE_OR_VALUE_EXISTS</TD>
143 *     <TD ALIGN="RIGHT">20</TD>
144 *   </TR>
145 *   <TR>
146 *     <TD ALIGN="LEFT">INVALID_ATTRIBUTE_SYNTAX</TD>
147 *     <TD ALIGN="RIGHT">21</TD>
148 *   </TR>
149 *   <TR>
150 *     <TD ALIGN="LEFT">NO_SUCH_OBJECT</TD>
151 *     <TD ALIGN="RIGHT">32</TD>
152 *   </TR>
153 *   <TR>
154 *     <TD ALIGN="LEFT">ALIAS_PROBLEM</TD>
155 *     <TD ALIGN="RIGHT">33</TD>
156 *   </TR>
157 *   <TR>
158 *     <TD ALIGN="LEFT">INVALID_DN_SYNTAX</TD>
159 *     <TD ALIGN="RIGHT">34</TD>
160 *   </TR>
161 *   <TR>
162 *     <TD ALIGN="LEFT">ALIAS_DEREFERENCING_PROBLEM</TD>
163 *     <TD ALIGN="RIGHT">36</TD>
164 *   </TR>
165 *   <TR>
166 *     <TD ALIGN="LEFT">INAPPROPRIATE_AUTHENTICATION</TD>
167 *     <TD ALIGN="RIGHT">48</TD>
168 *   </TR>
169 *   <TR>
170 *     <TD ALIGN="LEFT">INVALID_CREDENTIALS</TD>
171 *     <TD ALIGN="RIGHT">49</TD>
172 *   </TR>
173 *   <TR>
174 *     <TD ALIGN="LEFT">INSUFFICIENT_ACCESS_RIGHTS</TD>
175 *     <TD ALIGN="RIGHT">50</TD>
176 *   </TR>
177 *   <TR>
178 *     <TD ALIGN="LEFT">BUSY</TD>
179 *     <TD ALIGN="RIGHT">51</TD>
180 *   </TR>
181 *   <TR>
182 *     <TD ALIGN="LEFT">UNAVAILABLE</TD>
183 *     <TD ALIGN="RIGHT">52</TD>
184 *   </TR>
185 *   <TR>
186 *     <TD ALIGN="LEFT">UNWILLING_TO_PERFORM</TD>
187 *     <TD ALIGN="RIGHT">53</TD>
188 *   </TR>
189 *   <TR>
190 *     <TD ALIGN="LEFT">LOOP_DETECT</TD>
191 *     <TD ALIGN="RIGHT">54</TD>
192 *   </TR>
193 *   <TR>
194 *     <TD ALIGN="LEFT">SORT_CONTROL_MISSING</TD>
195 *     <TD ALIGN="RIGHT">60</TD>
196 *   </TR>
197 *   <TR>
198 *     <TD ALIGN="LEFT">OFFSET_RANGE_ERROR</TD>
199 *     <TD ALIGN="RIGHT">61</TD>
200 *   </TR>
201 *   <TR>
202 *     <TD ALIGN="LEFT">NAMING_VIOLATION</TD>
203 *     <TD ALIGN="RIGHT">64</TD>
204 *   </TR>
205 *   <TR>
206 *     <TD ALIGN="LEFT">OBJECT_CLASS_VIOLATION</TD>
207 *     <TD ALIGN="RIGHT">65</TD>
208 *   </TR>
209 *   <TR>
210 *     <TD ALIGN="LEFT">NOT_ALLOWED_ON_NONLEAF</TD>
211 *     <TD ALIGN="RIGHT">66</TD>
212 *   </TR>
213 *   <TR>
214 *     <TD ALIGN="LEFT">NOT_ALLOWED_ON_NONLEAF</TD>
215 *     <TD ALIGN="RIGHT">66</TD>
216 *   </TR>
217 *   <TR>
218 *     <TD ALIGN="LEFT">NOT_ALLOWED_ON_RDN</TD>
219 *     <TD ALIGN="RIGHT">67</TD>
220 *   </TR>
221 *   <TR>
222 *     <TD ALIGN="LEFT">ENTRY_ALREADY_EXISTS</TD>
223 *     <TD ALIGN="RIGHT">68</TD>
224 *   </TR>
225 *   <TR>
226 *     <TD ALIGN="LEFT">OBJECT_CLASS_MODS_PROHIBITED</TD>
227 *     <TD ALIGN="RIGHT">69</TD>
228 *   </TR>
229 *   <TR>
230 *     <TD ALIGN="LEFT">AFFECTS_MULTIPLE_DSAS</TD>
231 *     <TD ALIGN="RIGHT">71</TD>
232 *   </TR>
233 *   <TR>
234 *     <TD ALIGN="LEFT">VIRTUAL_LIST_VIEW_ERROR</TD>
235 *     <TD ALIGN="RIGHT">76</TD>
236 *   </TR>
237 *   <TR>
238 *     <TD ALIGN="LEFT">OTHER</TD>
239 *     <TD ALIGN="RIGHT">80</TD>
240 *   </TR>
241 *   <TR>
242 *     <TD ALIGN="LEFT">SERVER_DOWN</TD>
243 *     <TD ALIGN="RIGHT">81</TD>
244 *   </TR>
245 *   <TR>
246 *     <TD ALIGN="LEFT">LOCAL_ERROR</TD>
247 *     <TD ALIGN="RIGHT">82</TD>
248 *   </TR>
249 *   <TR>
250 *     <TD ALIGN="LEFT">ENCODING_ERROR</TD>
251 *     <TD ALIGN="RIGHT">83</TD>
252 *   </TR>
253 *   <TR>
254 *     <TD ALIGN="LEFT">DECODING_ERROR</TD>
255 *     <TD ALIGN="RIGHT">84</TD>
256 *   </TR>
257 *   <TR>
258 *     <TD ALIGN="LEFT">TIMEOUT</TD>
259 *     <TD ALIGN="RIGHT">85</TD>
260 *   </TR>
261 *   <TR>
262 *     <TD ALIGN="LEFT">AUTH_UNKNOWN</TD>
263 *     <TD ALIGN="RIGHT">86</TD>
264 *   </TR>
265 *   <TR>
266 *     <TD ALIGN="LEFT">FILTER_ERROR</TD>
267 *      <TD ALIGN="RIGHT">87</TD>
268 *   </TR>
269 *   <TR>
270 *     <TD ALIGN="LEFT">USER_CANCELED</TD>
271 *     <TD ALIGN="RIGHT">88</TD>
272 *   </TR>
273 *   <TR>
274 *     <TD ALIGN="LEFT">PARAM_ERROR</TD>
275 *     <TD ALIGN="RIGHT">89</TD>
276 *   </TR>
277 *   <TR>
278 *     <TD ALIGN="LEFT">NO_MEMORY</TD>
279 *     <TD ALIGN="RIGHT">90</TD>
280 *   </TR>
281 *   <TR>
282 *     <TD ALIGN="LEFT">CONNECT_ERROR</TD>
283 *     <TD ALIGN="RIGHT">91</TD>
284 *   </TR>
285 *   <TR>
286 *     <TD ALIGN="LEFT">NOT_SUPPORTED</TD>
287 *     <TD ALIGN="RIGHT">92</TD>
288 *   </TR>
289 *   <TR>
290 *     <TD ALIGN="LEFT">CONTROL_NOT_FOUND</TD>
291 *     <TD ALIGN="RIGHT">93</TD>
292 *   </TR>
293 *   <TR>
294 *     <TD ALIGN="LEFT">NO_RESULTS_RETURNED</TD>
295 *     <TD ALIGN="RIGHT">94</TD>
296 *   </TR>
297 *   <TR>
298 *     <TD ALIGN="LEFT">MORE_RESULTS_TO_RETURN</TD>
299 *     <TD ALIGN="RIGHT">95</TD>
300 *   </TR>
301 *   <TR>
302 *     <TD ALIGN="LEFT">CLIENT_LOOP</TD>
303 *     <TD ALIGN="RIGHT">96</TD>
304 *   </TR>
305 *   <TR>
306 *     <TD ALIGN="LEFT">REFERRAL_LIMIT_EXCEEDED</TD>
307 *     <TD ALIGN="RIGHT">97</TD>
308 *   </TR>
309 *   <TR>
310 *     <TD ALIGN="LEFT">CANCELED</TD>
311 *     <TD ALIGN="RIGHT">118</TD>
312 *   </TR>
313 *   <TR>
314 *     <TD ALIGN="LEFT">NO_SUCH_OPERATION</TD>
315 *     <TD ALIGN="RIGHT">119</TD>
316 *   </TR>
317 *   <TR>
318 *     <TD ALIGN="LEFT">TOO_LATE</TD>
319 *     <TD ALIGN="RIGHT">120</TD>
320 *   </TR>
321 *   <TR>
322 *     <TD ALIGN="LEFT">CANNOT_CANCEL</TD>
323 *     <TD ALIGN="RIGHT">121</TD>
324 *   </TR>
325 *   <TR>
326 *     <TD ALIGN="LEFT">ASSERTION_FAILED</TD>
327 *     <TD ALIGN="RIGHT">122</TD>
328 *   </TR>
329 *   <TR>
330 *     <TD ALIGN="LEFT">AUTHORIZATION_DENIED</TD>
331 *     <TD ALIGN="RIGHT">123</TD>
332 *   </TR>
333 *   <TR>
334 *     <TD ALIGN="LEFT">E_SYNC_REFRESH_REQUIRED</TD>
335 *     <TD ALIGN="RIGHT">4096</TD>
336 *   </TR>
337 *   <TR>
338 *     <TD ALIGN="LEFT">NO_OPERATION</TD>
339 *     <TD ALIGN="RIGHT">16654</TD>
340 *   </TR>
341 *   <TR>
342 *     <TD ALIGN="LEFT">INTERACTIVE_TRANSACTION_ABORTED</TD>
343 *     <TD ALIGN="RIGHT">30221001</TD>
344 *   </TR>
345 *   <TR>
346 *     <TD ALIGN="LEFT">DATABASE_LOCK_CONFLICT</TD>
347 *     <TD ALIGN="RIGHT">30221002</TD>
348 *   </TR>
349 *   <TR>
350 *     <TD ALIGN="LEFT">MIRRORED_SUBTREE_DIGEST_MISMATCH</TD>
351 *     <TD ALIGN="RIGHT">30221003</TD>
352 *   </TR>
353 *   <TR>
354 *     <TD ALIGN="LEFT">TOKEN_DELIVERY_MECHANISM_UNAVAILABLE</TD>
355 *     <TD ALIGN="RIGHT">30221004</TD>
356 *   </TR>
357 *   <TR>
358 *     <TD ALIGN="LEFT">TOKEN_DELIVERY_ATTEMPT_FAILED</TD>
359 *     <TD ALIGN="RIGHT">30221005</TD>
360 *   </TR>
361 *   <TR>
362 *     <TD ALIGN="LEFT">TOKEN_DELIVERY_INVALID_RECIPIENT_ID</TD>
363 *     <TD ALIGN="RIGHT">30221006</TD>
364 *   </TR>
365 *   <TR>
366 *     <TD ALIGN="LEFT">TOKEN_DELIVERY_INVALID_ACCOUNT_STATE</TD>
367 *     <TD ALIGN="RIGHT">30221007</TD>
368 *   </TR>
369 * </TABLE>
370 */
371@NotMutable()
372@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
373public final class ResultCode
374       implements Serializable
375{
376  /**
377   * The integer value (0) for the "SUCCESS" result code.
378   */
379  public static final int SUCCESS_INT_VALUE = 0;
380
381
382
383  /**
384   * The result code (0) that will be used to indicate a successful operation.
385   */
386  @NotNull public static final ResultCode SUCCESS =
387       new ResultCode(INFO_RC_SUCCESS.get(), SUCCESS_INT_VALUE);
388
389
390
391  /**
392   * The integer value (1) for the "OPERATIONS_ERROR" result code.
393   */
394  public static final int OPERATIONS_ERROR_INT_VALUE = 1;
395
396
397
398  /**
399   * The result code (1) that will be used to indicate that an operation was
400   * requested out of sequence.
401   */
402  @NotNull public static final ResultCode OPERATIONS_ERROR =
403       new ResultCode(INFO_RC_OPERATIONS_ERROR.get(),
404                      OPERATIONS_ERROR_INT_VALUE);
405
406
407
408  /**
409   * The integer value (2) for the "PROTOCOL_ERROR" result code.
410   */
411  public static final int PROTOCOL_ERROR_INT_VALUE = 2;
412
413
414
415  /**
416   * The result code (2) that will be used to indicate that the client sent a
417   * malformed request.
418   */
419  @NotNull public static final ResultCode PROTOCOL_ERROR =
420       new ResultCode(INFO_RC_PROTOCOL_ERROR.get(), PROTOCOL_ERROR_INT_VALUE);
421
422
423
424  /**
425   * The integer value (3) for the "TIME_LIMIT_EXCEEDED" result code.
426   */
427  public static final int TIME_LIMIT_EXCEEDED_INT_VALUE = 3;
428
429
430
431  /**
432   * The result code (3) that will be used to indicate that the server was
433   * unable to complete processing on the request in the allotted time limit.
434   */
435  @NotNull public static final ResultCode TIME_LIMIT_EXCEEDED =
436       new ResultCode(INFO_RC_TIME_LIMIT_EXCEEDED.get(),
437                      TIME_LIMIT_EXCEEDED_INT_VALUE);
438
439
440
441  /**
442   * The integer value (4) for the "SIZE_LIMIT_EXCEEDED" result code.
443   */
444  public static final int SIZE_LIMIT_EXCEEDED_INT_VALUE = 4;
445
446
447
448  /**
449   * The result code (4) that will be used to indicate that the server found
450   * more matching entries than the configured request size limit.
451   */
452  @NotNull public static final ResultCode SIZE_LIMIT_EXCEEDED =
453       new ResultCode(INFO_RC_SIZE_LIMIT_EXCEEDED.get(),
454                      SIZE_LIMIT_EXCEEDED_INT_VALUE);
455
456
457
458  /**
459   * The integer value (5) for the "COMPARE_FALSE" result code.
460   */
461  public static final int COMPARE_FALSE_INT_VALUE = 5;
462
463
464
465  /**
466   * The result code (5) that will be used if a requested compare assertion does
467   * not match the target entry.
468   */
469  @NotNull public static final ResultCode COMPARE_FALSE =
470       new ResultCode(INFO_RC_COMPARE_FALSE.get(), COMPARE_FALSE_INT_VALUE);
471
472
473
474  /**
475   * The integer value (6) for the "COMPARE_TRUE" result code.
476   */
477  public static final int COMPARE_TRUE_INT_VALUE = 6;
478
479
480
481  /**
482   * The result code (6) that will be used if a requested compare assertion
483   * matched the target entry.
484   */
485  @NotNull public static final ResultCode COMPARE_TRUE =
486       new ResultCode(INFO_RC_COMPARE_TRUE.get(), COMPARE_TRUE_INT_VALUE);
487
488
489
490  /**
491   * The integer value (7) for the "AUTH_METHOD_NOT_SUPPORTED" result code.
492   */
493  public static final int AUTH_METHOD_NOT_SUPPORTED_INT_VALUE = 7;
494
495
496
497  /**
498   * The result code (7) that will be used if the client requested a form of
499   * authentication that is not supported by the server.
500   */
501  @NotNull public static final ResultCode AUTH_METHOD_NOT_SUPPORTED =
502       new ResultCode(INFO_RC_AUTH_METHOD_NOT_SUPPORTED.get(),
503                      AUTH_METHOD_NOT_SUPPORTED_INT_VALUE);
504
505
506
507  /**
508   * The integer value (8) for the "STRONG_AUTH_REQUIRED" result code.
509   */
510  public static final int STRONG_AUTH_REQUIRED_INT_VALUE = 8;
511
512
513
514  /**
515   * The result code (8) that will be used if the client requested an operation
516   * that requires a strong authentication mechanism.
517   */
518  @NotNull public static final ResultCode STRONG_AUTH_REQUIRED =
519       new ResultCode(INFO_RC_STRONG_AUTH_REQUIRED.get(),
520                      STRONG_AUTH_REQUIRED_INT_VALUE);
521
522
523
524  /**
525   * The integer value (10) for the "REFERRAL" result code.
526   */
527  public static final int REFERRAL_INT_VALUE = 10;
528
529
530
531  /**
532   * The result code (10) that will be used if the server sends a referral to
533   * the client to refer to data in another location.
534   */
535  @NotNull public static final ResultCode REFERRAL =
536       new ResultCode(INFO_RC_REFERRAL.get(), REFERRAL_INT_VALUE);
537
538
539
540  /**
541   * The integer value (11) for the "ADMIN_LIMIT_EXCEEDED" result code.
542   */
543  public static final int ADMIN_LIMIT_EXCEEDED_INT_VALUE = 11;
544
545
546
547  /**
548   * The result code (11) that will be used if a server administrative limit has
549   * been exceeded.
550   */
551  @NotNull public static final ResultCode ADMIN_LIMIT_EXCEEDED =
552       new ResultCode(INFO_RC_ADMIN_LIMIT_EXCEEDED.get(),
553                      ADMIN_LIMIT_EXCEEDED_INT_VALUE);
554
555
556
557  /**
558   * The integer value (12) for the "UNAVAILABLE_CRITICAL_EXTENSION" result
559   * code.
560   */
561  public static final int UNAVAILABLE_CRITICAL_EXTENSION_INT_VALUE = 12;
562
563
564
565  /**
566   * The result code (12) that will be used if the client requests a critical
567   * control that is not supported by the server.
568   */
569  @NotNull public static final ResultCode UNAVAILABLE_CRITICAL_EXTENSION =
570       new ResultCode(INFO_RC_UNAVAILABLE_CRITICAL_EXTENSION.get(),
571                      UNAVAILABLE_CRITICAL_EXTENSION_INT_VALUE);
572
573
574
575  /**
576   * The integer value (13) for the "CONFIDENTIALITY_REQUIRED" result code.
577   */
578  public static final int CONFIDENTIALITY_REQUIRED_INT_VALUE = 13;
579
580
581
582  /**
583   * The result code (13) that will be used if the server requires a secure
584   * communication mechanism for the requested operation.
585   */
586  @NotNull public static final ResultCode CONFIDENTIALITY_REQUIRED =
587       new ResultCode(INFO_RC_CONFIDENTIALITY_REQUIRED.get(),
588                      CONFIDENTIALITY_REQUIRED_INT_VALUE);
589
590
591
592  /**
593   * The integer value (14) for the "SASL_BIND_IN_PROGRESS" result code.
594   */
595  public static final int SASL_BIND_IN_PROGRESS_INT_VALUE = 14;
596
597
598
599  /**
600   * The result code (14) that will be returned from the server after SASL bind
601   * stages in which more processing is required.
602   */
603  @NotNull public static final ResultCode SASL_BIND_IN_PROGRESS =
604       new ResultCode(INFO_RC_SASL_BIND_IN_PROGRESS.get(),
605                      SASL_BIND_IN_PROGRESS_INT_VALUE);
606
607
608
609  /**
610   * The integer value (16) for the "NO_SUCH_ATTRIBUTE" result code.
611   */
612  public static final int NO_SUCH_ATTRIBUTE_INT_VALUE = 16;
613
614
615
616  /**
617   * The result code (16) that will be used if the client referenced an
618   * attribute that does not exist in the target entry.
619   */
620  @NotNull public static final ResultCode NO_SUCH_ATTRIBUTE =
621       new ResultCode(INFO_RC_NO_SUCH_ATTRIBUTE.get(),
622                      NO_SUCH_ATTRIBUTE_INT_VALUE);
623
624
625
626  /**
627   * The integer value (17) for the "UNDEFINED_ATTRIBUTE_TYPE" result code.
628   */
629  public static final int UNDEFINED_ATTRIBUTE_TYPE_INT_VALUE = 17;
630
631
632
633  /**
634   * The result code (17) that will be used if the client referenced an
635   * attribute that is not defined in the server schema.
636   */
637  @NotNull public static final ResultCode UNDEFINED_ATTRIBUTE_TYPE =
638       new ResultCode(INFO_RC_UNDEFINED_ATTRIBUTE_TYPE.get(),
639                      UNDEFINED_ATTRIBUTE_TYPE_INT_VALUE);
640
641
642
643  /**
644   * The integer value (18) for the "INAPPROPRIATE_MATCHING" result code.
645   */
646  public static final int INAPPROPRIATE_MATCHING_INT_VALUE = 18;
647
648
649
650  /**
651   * The result code (18) that will be used if the client attempted to use an
652   * attribute in a search filter in a manner not supported by the matching
653   * rules associated with that attribute.
654   */
655  @NotNull public static final ResultCode INAPPROPRIATE_MATCHING =
656       new ResultCode(INFO_RC_INAPPROPRIATE_MATCHING.get(),
657                      INAPPROPRIATE_MATCHING_INT_VALUE);
658
659
660
661  /**
662   * The integer value (19) for the "CONSTRAINT_VIOLATION" result code.
663   */
664  public static final int CONSTRAINT_VIOLATION_INT_VALUE = 19;
665
666
667
668  /**
669   * The result code (19) that will be used if the requested operation would
670   * violate some constraint defined in the server.
671   */
672  @NotNull public static final ResultCode CONSTRAINT_VIOLATION =
673       new ResultCode(INFO_RC_CONSTRAINT_VIOLATION.get(),
674                      CONSTRAINT_VIOLATION_INT_VALUE);
675
676
677
678  /**
679   * The integer value (20) for the "ATTRIBUTE_OR_VALUE_EXISTS" result code.
680   */
681  public static final int ATTRIBUTE_OR_VALUE_EXISTS_INT_VALUE = 20;
682
683
684
685  /**
686   * The result code (20) that will be used if the client attempts to modify an
687   * entry in a way that would create a duplicate value, or create multiple
688   * values for a single-valued attribute.
689   */
690  @NotNull public static final ResultCode ATTRIBUTE_OR_VALUE_EXISTS =
691       new ResultCode(INFO_RC_ATTRIBUTE_OR_VALUE_EXISTS.get(),
692                      ATTRIBUTE_OR_VALUE_EXISTS_INT_VALUE);
693
694
695
696  /**
697   * The integer value (21) for the "INVALID_ATTRIBUTE_SYNTAX" result code.
698   */
699  public static final int INVALID_ATTRIBUTE_SYNTAX_INT_VALUE = 21;
700
701
702
703  /**
704   * The result code (21) that will be used if the client attempts to perform an
705   * operation that would create an attribute value that violates the syntax
706   * for that attribute.
707   */
708  @NotNull public static final ResultCode INVALID_ATTRIBUTE_SYNTAX =
709       new ResultCode(INFO_RC_INVALID_ATTRIBUTE_SYNTAX.get(),
710                      INVALID_ATTRIBUTE_SYNTAX_INT_VALUE);
711
712
713
714  /**
715   * The integer value (32) for the "NO_SUCH_OBJECT" result code.
716   */
717  public static final int NO_SUCH_OBJECT_INT_VALUE = 32;
718
719
720
721  /**
722   * The result code (32) that will be used if the client targeted an entry that
723   * does not exist.
724   */
725  @NotNull public static final ResultCode NO_SUCH_OBJECT =
726       new ResultCode(INFO_RC_NO_SUCH_OBJECT.get(), NO_SUCH_OBJECT_INT_VALUE);
727
728
729
730  /**
731   * The integer value (33) for the "ALIAS_PROBLEM" result code.
732   */
733  public static final int ALIAS_PROBLEM_INT_VALUE = 33;
734
735
736
737  /**
738   * The result code (33) that will be used if the client targeted an entry that
739   * as an alias.
740   */
741  @NotNull public static final ResultCode ALIAS_PROBLEM =
742       new ResultCode(INFO_RC_ALIAS_PROBLEM.get(), ALIAS_PROBLEM_INT_VALUE);
743
744
745
746  /**
747   * The integer value (34) for the "INVALID_DN_SYNTAX" result code.
748   */
749  public static final int INVALID_DN_SYNTAX_INT_VALUE = 34;
750
751
752
753  /**
754   * The result code (34) that will be used if the client provided an invalid
755   * DN.
756   */
757  @NotNull public static final ResultCode INVALID_DN_SYNTAX =
758       new ResultCode(INFO_RC_INVALID_DN_SYNTAX.get(),
759                      INVALID_DN_SYNTAX_INT_VALUE);
760
761
762
763  /**
764   * The integer value (36) for the "ALIAS_DEREFERENCING_PROBLEM" result code.
765   */
766  public static final int ALIAS_DEREFERENCING_PROBLEM_INT_VALUE = 36;
767
768
769
770  /**
771   * The result code (36) that will be used if a problem is encountered while
772   * the server is attempting to dereference an alias.
773   */
774  @NotNull public static final ResultCode ALIAS_DEREFERENCING_PROBLEM =
775       new ResultCode(INFO_RC_ALIAS_DEREFERENCING_PROBLEM.get(),
776                      ALIAS_DEREFERENCING_PROBLEM_INT_VALUE);
777
778
779
780  /**
781   * The integer value (48) for the "INAPPROPRIATE_AUTHENTICATION" result code.
782   */
783  public static final int INAPPROPRIATE_AUTHENTICATION_INT_VALUE = 48;
784
785
786
787  /**
788   * The result code (48) that will be used if the client attempts to perform a
789   * type of authentication that is not supported for the target user.
790   */
791  @NotNull public static final ResultCode INAPPROPRIATE_AUTHENTICATION =
792       new ResultCode(INFO_RC_INAPPROPRIATE_AUTHENTICATION.get(),
793                      INAPPROPRIATE_AUTHENTICATION_INT_VALUE);
794
795
796
797  /**
798   * The integer value (49) for the "INVALID_CREDENTIALS" result code.
799   */
800  public static final int INVALID_CREDENTIALS_INT_VALUE = 49;
801
802
803
804  /**
805   * The result code (49) that will be used if the client provided invalid
806   * credentials while trying to authenticate.
807   */
808  @NotNull public static final ResultCode INVALID_CREDENTIALS =
809       new ResultCode(INFO_RC_INVALID_CREDENTIALS.get(),
810                      INVALID_CREDENTIALS_INT_VALUE);
811
812
813
814  /**
815   * The integer value (50) for the "INSUFFICIENT_ACCESS_RIGHTS" result code.
816   */
817  public static final int INSUFFICIENT_ACCESS_RIGHTS_INT_VALUE = 50;
818
819
820
821  /**
822   * The result code (50) that will be used if the client does not have
823   * permission to perform the requested operation.
824   */
825  @NotNull public static final ResultCode INSUFFICIENT_ACCESS_RIGHTS =
826       new ResultCode(INFO_RC_INSUFFICIENT_ACCESS_RIGHTS.get(),
827                      INSUFFICIENT_ACCESS_RIGHTS_INT_VALUE);
828
829
830
831  /**
832   * The integer value (51) for the "BUSY" result code.
833   */
834  public static final int BUSY_INT_VALUE = 51;
835
836
837
838  /**
839   * The result code (51) that will be used if the server is too busy to process
840   * the requested operation.
841   */
842  @NotNull public static final ResultCode BUSY =
843       new ResultCode(INFO_RC_BUSY.get(), BUSY_INT_VALUE);
844
845
846
847  /**
848   * The integer value (52) for the "UNAVAILABLE" result code.
849   */
850  public static final int UNAVAILABLE_INT_VALUE = 52;
851
852
853
854  /**
855   * The result code (52) that will be used if the server is unavailable.
856   */
857  @NotNull public static final ResultCode UNAVAILABLE =
858       new ResultCode(INFO_RC_UNAVAILABLE.get(), UNAVAILABLE_INT_VALUE);
859
860
861
862  /**
863   * The integer value (53) for the "UNWILLING_TO_PERFORM" result code.
864   */
865  public static final int UNWILLING_TO_PERFORM_INT_VALUE = 53;
866
867
868
869  /**
870   * The result code (53) that will be used if the server is not willing to
871   * perform the requested operation.
872   */
873  @NotNull public static final ResultCode UNWILLING_TO_PERFORM =
874       new ResultCode(INFO_RC_UNWILLING_TO_PERFORM.get(),
875                      UNWILLING_TO_PERFORM_INT_VALUE);
876
877
878
879  /**
880   * The integer value (54) for the "LOOP_DETECT" result code.
881   */
882  public static final int LOOP_DETECT_INT_VALUE = 54;
883
884
885
886  /**
887   * The result code (54) that will be used if the server detects a chaining or
888   * alias loop.
889   */
890  @NotNull public static final ResultCode LOOP_DETECT =
891       new ResultCode(INFO_RC_LOOP_DETECT.get(), LOOP_DETECT_INT_VALUE);
892
893
894
895  /**
896   * The integer value (60) for the "SORT_CONTROL_MISSING" result code.
897   */
898  public static final int SORT_CONTROL_MISSING_INT_VALUE = 60;
899
900
901
902  /**
903   * The result code (60) that will be used if the client sends a virtual list
904   * view control without a server-side sort control.
905   */
906  @NotNull public static final ResultCode SORT_CONTROL_MISSING =
907       new ResultCode(INFO_RC_SORT_CONTROL_MISSING.get(),
908                      SORT_CONTROL_MISSING_INT_VALUE);
909
910
911
912  /**
913   * The integer value (61) for the "OFFSET_RANGE_ERROR" result code.
914   */
915  public static final int OFFSET_RANGE_ERROR_INT_VALUE = 61;
916
917
918
919  /**
920   * The result code (61) that will be used if the client provides a virtual
921   * list view control with a target offset that is out of range for the
922   * available data set.
923   */
924  @NotNull public static final ResultCode OFFSET_RANGE_ERROR =
925       new ResultCode(INFO_RC_OFFSET_RANGE_ERROR.get(),
926                      OFFSET_RANGE_ERROR_INT_VALUE);
927
928
929
930  /**
931   * The integer value (64) for the "NAMING_VIOLATION" result code.
932   */
933  public static final int NAMING_VIOLATION_INT_VALUE = 64;
934
935
936
937  /**
938   * The result code (64) that will be used if the client request violates a
939   * naming constraint (e.g., a name form or DIT structure rule) defined in the
940   * server.
941   */
942  @NotNull public static final ResultCode NAMING_VIOLATION =
943       new ResultCode(INFO_RC_NAMING_VIOLATION.get(),
944                      NAMING_VIOLATION_INT_VALUE);
945
946
947
948  /**
949   * The integer value (65) for the "OBJECT_CLASS_VIOLATION" result code.
950   */
951  public static final int OBJECT_CLASS_VIOLATION_INT_VALUE = 65;
952
953
954
955  /**
956   * The result code (65) that will be used if the client request violates an
957   * object class constraint (e.g., an undefined object class, a
958   * disallowed attribute, or a missing required attribute) defined in the
959   * server.
960   */
961  @NotNull public static final ResultCode OBJECT_CLASS_VIOLATION =
962       new ResultCode(INFO_RC_OBJECT_CLASS_VIOLATION.get(),
963                      OBJECT_CLASS_VIOLATION_INT_VALUE);
964
965
966
967  /**
968   * The integer value (66) for the "NOT_ALLOWED_ON_NONLEAF" result code.
969   */
970  public static final int NOT_ALLOWED_ON_NONLEAF_INT_VALUE = 66;
971
972
973
974  /**
975   * The result code (66) that will be used if the requested operation is not
976   * allowed to be performed on non-leaf entries.
977   */
978  @NotNull public static final ResultCode NOT_ALLOWED_ON_NONLEAF =
979       new ResultCode(INFO_RC_NOT_ALLOWED_ON_NONLEAF.get(),
980                      NOT_ALLOWED_ON_NONLEAF_INT_VALUE);
981
982
983
984  /**
985   * The integer value (67) for the "NOT_ALLOWED_ON_RDN" result code.
986   */
987  public static final int NOT_ALLOWED_ON_RDN_INT_VALUE = 67;
988
989
990
991  /**
992   * The result code (67) that will be used if the requested operation would
993   * alter the RDN of the entry but the operation was not a modify DN request.
994   */
995  @NotNull public static final ResultCode NOT_ALLOWED_ON_RDN =
996       new ResultCode(INFO_RC_NOT_ALLOWED_ON_RDN.get(),
997                      NOT_ALLOWED_ON_RDN_INT_VALUE);
998
999
1000
1001  /**
1002   * The integer value (68) for the "ENTRY_ALREADY_EXISTS" result code.
1003   */
1004  public static final int ENTRY_ALREADY_EXISTS_INT_VALUE = 68;
1005
1006
1007
1008  /**
1009   * The result code (68) that will be used if the requested operation would
1010   * create a conflict with an entry that already exists in the server.
1011   */
1012  @NotNull public static final ResultCode ENTRY_ALREADY_EXISTS =
1013       new ResultCode(INFO_RC_ENTRY_ALREADY_EXISTS.get(),
1014                      ENTRY_ALREADY_EXISTS_INT_VALUE);
1015
1016
1017
1018  /**
1019   * The integer value (69) for the "OBJECT_CLASS_MODS_PROHIBITED" result code.
1020   */
1021  public static final int OBJECT_CLASS_MODS_PROHIBITED_INT_VALUE = 69;
1022
1023
1024
1025  /**
1026   * The result code (69) that will be used if the requested operation would
1027   * alter the set of object classes defined in the entry in a disallowed
1028   * manner.
1029   */
1030  @NotNull public static final ResultCode OBJECT_CLASS_MODS_PROHIBITED =
1031       new ResultCode(INFO_RC_OBJECT_CLASS_MODS_PROHIBITED.get(),
1032                      OBJECT_CLASS_MODS_PROHIBITED_INT_VALUE);
1033
1034
1035
1036  /**
1037   * The integer value (71) for the "AFFECTS_MULTIPLE_DSAS" result code.
1038   */
1039  public static final int AFFECTS_MULTIPLE_DSAS_INT_VALUE = 71;
1040
1041
1042
1043  /**
1044   * The result code (71) that will be used if the requested operation would
1045   * impact entries in multiple data sources.
1046   */
1047  @NotNull public static final ResultCode AFFECTS_MULTIPLE_DSAS =
1048       new ResultCode(INFO_RC_AFFECTS_MULTIPLE_DSAS.get(),
1049                      AFFECTS_MULTIPLE_DSAS_INT_VALUE);
1050
1051
1052
1053  /**
1054   * The integer value (76) for the "VIRTUAL_LIST_VIEW_ERROR" result code.
1055   */
1056  public static final int VIRTUAL_LIST_VIEW_ERROR_INT_VALUE = 76;
1057
1058
1059
1060  /**
1061   * The result code (76) that will be used if an error occurred while
1062   * performing processing associated with the virtual list view control.
1063   */
1064  @NotNull public static final ResultCode VIRTUAL_LIST_VIEW_ERROR =
1065       new ResultCode(INFO_RC_VIRTUAL_LIST_VIEW_ERROR.get(),
1066                      VIRTUAL_LIST_VIEW_ERROR_INT_VALUE);
1067
1068
1069
1070  /**
1071   * The integer value (80) for the "OTHER" result code.
1072   */
1073  public static final int OTHER_INT_VALUE = 80;
1074
1075
1076
1077  /**
1078   * The result code (80) that will be used if none of the other result codes
1079   * are appropriate.
1080   */
1081  @NotNull public static final ResultCode OTHER =
1082       new ResultCode(INFO_RC_OTHER.get(), OTHER_INT_VALUE);
1083
1084
1085
1086  /**
1087   * The integer value (81) for the "SERVER_DOWN" result code.
1088   */
1089  public static final int SERVER_DOWN_INT_VALUE = 81;
1090
1091
1092
1093  /**
1094   * The client-side result code (81) that will be used if an established
1095   * connection to the server is lost.
1096   */
1097  @NotNull public static final ResultCode SERVER_DOWN =
1098       new ResultCode(INFO_RC_SERVER_DOWN.get(), SERVER_DOWN_INT_VALUE);
1099
1100
1101
1102  /**
1103   * The integer value (82) for the "LOCAL_ERROR" result code.
1104   */
1105  public static final int LOCAL_ERROR_INT_VALUE = 82;
1106
1107
1108
1109  /**
1110   * The client-side result code (82) that will be used if a generic client-side
1111   * error occurs during processing.
1112   */
1113  @NotNull public static final ResultCode LOCAL_ERROR =
1114       new ResultCode(INFO_RC_LOCAL_ERROR.get(), LOCAL_ERROR_INT_VALUE);
1115
1116
1117
1118  /**
1119   * The integer value (83) for the "ENCODING_ERROR" result code.
1120   */
1121  public static final int ENCODING_ERROR_INT_VALUE = 83;
1122
1123
1124
1125  /**
1126   * The client-side result code (83) that will be used if an error occurs while
1127   * encoding a request.
1128   */
1129  @NotNull public static final ResultCode ENCODING_ERROR =
1130       new ResultCode(INFO_RC_ENCODING_ERROR.get(), ENCODING_ERROR_INT_VALUE);
1131
1132
1133
1134  /**
1135   * The integer value (84) for the "DECODING_ERROR" result code.
1136   */
1137  public static final int DECODING_ERROR_INT_VALUE = 84;
1138
1139
1140
1141  /**
1142   * The client-side result code (84) that will be used if an error occurs while
1143   * decoding a response.
1144   */
1145  @NotNull public static final ResultCode DECODING_ERROR =
1146       new ResultCode(INFO_RC_DECODING_ERROR.get(), DECODING_ERROR_INT_VALUE);
1147
1148
1149
1150  /**
1151   * The integer value (85) for the "TIMEOUT" result code.
1152   */
1153  public static final int TIMEOUT_INT_VALUE = 85;
1154
1155
1156
1157  /**
1158   * The client-side result code (85) that will be used if a client timeout
1159   * occurs while waiting for a response from the server.
1160   */
1161  @NotNull public static final ResultCode TIMEOUT =
1162       new ResultCode(INFO_RC_TIMEOUT.get(), TIMEOUT_INT_VALUE);
1163
1164
1165
1166  /**
1167   * The integer value (86) for the "AUTH_UNKNOWN" result code.
1168   */
1169  public static final int AUTH_UNKNOWN_INT_VALUE = 86;
1170
1171
1172
1173  /**
1174   * The client-side result code (86) that will be used if the client attempts
1175   * to use an unknown authentication type.
1176   */
1177  @NotNull public static final ResultCode AUTH_UNKNOWN =
1178       new ResultCode(INFO_RC_AUTH_UNKNOWN.get(), AUTH_UNKNOWN_INT_VALUE);
1179
1180
1181
1182  /**
1183   * The integer value (87) for the "FILTER_ERROR" result code.
1184   */
1185  public static final int FILTER_ERROR_INT_VALUE = 87;
1186
1187
1188
1189  /**
1190   * The client-side result code (87) that will be used if an error occurs while
1191   * attempting to encode a search filter.
1192   */
1193  @NotNull public static final ResultCode FILTER_ERROR =
1194       new ResultCode(INFO_RC_FILTER_ERROR.get(), FILTER_ERROR_INT_VALUE);
1195
1196
1197
1198  /**
1199   * The integer value (88) for the "USER_CANCELED" result code.
1200   */
1201  public static final int USER_CANCELED_INT_VALUE = 88;
1202
1203
1204
1205  /**
1206   * The client-side result code (88) that will be used if the end user canceled
1207   * the operation in progress.
1208   */
1209  @NotNull public static final ResultCode USER_CANCELED =
1210       new ResultCode(INFO_RC_USER_CANCELED.get(), USER_CANCELED_INT_VALUE);
1211
1212
1213
1214  /**
1215   * The integer value (89) for the "PARAM_ERROR" result code.
1216   */
1217  public static final int PARAM_ERROR_INT_VALUE = 89;
1218
1219
1220
1221  /**
1222   * The client-side result code (89) that will be used if there is a problem
1223   * with the parameters provided for a request.
1224   */
1225  @NotNull public static final ResultCode PARAM_ERROR =
1226       new ResultCode(INFO_RC_PARAM_ERROR.get(), PARAM_ERROR_INT_VALUE);
1227
1228
1229
1230  /**
1231   * The integer value (90) for the "NO_MEMORY" result code.
1232   */
1233  public static final int NO_MEMORY_INT_VALUE = 90;
1234
1235
1236
1237  /**
1238   * The client-side result code (90) that will be used if the client does not
1239   * have sufficient memory to perform the requested operation.
1240   */
1241  @NotNull public static final ResultCode NO_MEMORY =
1242       new ResultCode(INFO_RC_NO_MEMORY.get(), NO_MEMORY_INT_VALUE);
1243
1244
1245
1246  /**
1247   * The integer value (91) for the "CONNECT_ERROR" result code.
1248   */
1249  public static final int CONNECT_ERROR_INT_VALUE = 91;
1250
1251
1252
1253  /**
1254   * The client-side result code (91) that will be used if an error occurs while
1255   * attempting to connect to a target server.
1256   */
1257  @NotNull public static final ResultCode CONNECT_ERROR =
1258       new ResultCode(INFO_RC_CONNECT_ERROR.get(), CONNECT_ERROR_INT_VALUE);
1259
1260
1261
1262  /**
1263   * The integer value (92) for the "NOT_SUPPORTED" result code.
1264   */
1265  public static final int NOT_SUPPORTED_INT_VALUE = 92;
1266
1267
1268
1269  /**
1270   * The client-side result code (92) that will be used if the requested
1271   * operation is not supported.
1272   */
1273  @NotNull public static final ResultCode NOT_SUPPORTED =
1274       new ResultCode(INFO_RC_NOT_SUPPORTED.get(), NOT_SUPPORTED_INT_VALUE);
1275
1276
1277
1278  /**
1279   * The integer value (93) for the "CONTROL_NOT_FOUND" result code.
1280   */
1281  public static final int CONTROL_NOT_FOUND_INT_VALUE = 93;
1282
1283
1284
1285  /**
1286   * The client-side result code (93) that will be used if the response from the
1287   * server did not include an expected control.
1288   */
1289  @NotNull public static final ResultCode CONTROL_NOT_FOUND =
1290       new ResultCode(INFO_RC_CONTROL_NOT_FOUND.get(),
1291                      CONTROL_NOT_FOUND_INT_VALUE);
1292
1293
1294
1295  /**
1296   * The integer value (94) for the "NO_RESULTS_RETURNED" result code.
1297   */
1298  public static final int NO_RESULTS_RETURNED_INT_VALUE = 94;
1299
1300
1301
1302  /**
1303   * The client-side result code (94) that will be used if the server did not
1304   * send any results.
1305   */
1306  @NotNull public static final ResultCode NO_RESULTS_RETURNED =
1307       new ResultCode(INFO_RC_NO_RESULTS_RETURNED.get(),
1308                      NO_RESULTS_RETURNED_INT_VALUE);
1309
1310
1311
1312  /**
1313   * The integer value (95) for the "MORE_RESULTS_TO_RETURN" result code.
1314   */
1315  public static final int MORE_RESULTS_TO_RETURN_INT_VALUE = 95;
1316
1317
1318
1319  /**
1320   * The client-side result code (95) that will be used if there are still more
1321   * results to return.
1322   */
1323  @NotNull public static final ResultCode MORE_RESULTS_TO_RETURN =
1324       new ResultCode(INFO_RC_MORE_RESULTS_TO_RETURN.get(),
1325                      MORE_RESULTS_TO_RETURN_INT_VALUE);
1326
1327
1328
1329  /**
1330   * The integer value (96) for the "CLIENT_LOOP" result code.
1331   */
1332  public static final int CLIENT_LOOP_INT_VALUE = 96;
1333
1334
1335
1336  /**
1337   * The client-side result code (96) that will be used if the client detects a
1338   * loop while attempting to follow referrals.
1339   */
1340  @NotNull public static final ResultCode CLIENT_LOOP =
1341       new ResultCode(INFO_RC_CLIENT_LOOP.get(), CLIENT_LOOP_INT_VALUE);
1342
1343
1344
1345  /**
1346   * The integer value (97) for the "REFERRAL_LIMIT_EXCEEDED" result code.
1347   */
1348  public static final int REFERRAL_LIMIT_EXCEEDED_INT_VALUE = 97;
1349
1350
1351
1352  /**
1353   * The client-side result code (97) that will be used if the client
1354   * encountered too many referrals in the course of processing an operation.
1355   */
1356  @NotNull public static final ResultCode REFERRAL_LIMIT_EXCEEDED =
1357       new ResultCode(INFO_RC_REFERRAL_LIMIT_EXCEEDED.get(),
1358                      REFERRAL_LIMIT_EXCEEDED_INT_VALUE);
1359
1360
1361
1362  /**
1363   * The integer value (118) for the "CANCELED" result code.
1364   */
1365  public static final int CANCELED_INT_VALUE = 118;
1366
1367
1368
1369  /**
1370   * The result code (118) that will be used if the operation was canceled.
1371   */
1372  @NotNull public static final ResultCode CANCELED =
1373       new ResultCode(INFO_RC_CANCELED.get(), CANCELED_INT_VALUE);
1374
1375
1376
1377  /**
1378   * The integer value (119) for the "NO_SUCH_OPERATION" result code.
1379   */
1380  public static final int NO_SUCH_OPERATION_INT_VALUE = 119;
1381
1382
1383
1384  /**
1385   * The result code (119) that will be used if the client attempts to cancel an
1386   * operation for which the server has no knowledge (e.g., because the
1387   * operation had already completed or no such operation had been requested).
1388   */
1389  @NotNull public static final ResultCode NO_SUCH_OPERATION =
1390       new ResultCode(INFO_RC_NO_SUCH_OPERATION.get(),
1391                      NO_SUCH_OPERATION_INT_VALUE);
1392
1393
1394
1395  /**
1396   * The integer value (120) for the "TOO_LATE" result code.
1397   */
1398  public static final int TOO_LATE_INT_VALUE = 120;
1399
1400
1401
1402  /**
1403   * The result code (120) that will be used if the client attempts to cancel an
1404   * operation too late in the processing for that operation.
1405   */
1406  @NotNull public static final ResultCode TOO_LATE =
1407       new ResultCode(INFO_RC_TOO_LATE.get(), TOO_LATE_INT_VALUE);
1408
1409
1410
1411  /**
1412   * The integer value (121) for the "CANNOT_CANCEL" result code.
1413   */
1414  public static final int CANNOT_CANCEL_INT_VALUE = 121;
1415
1416
1417
1418  /**
1419   * The result code (121) that will be used if the client attempts to cancel an
1420   * operation that cannot be canceled.
1421   */
1422  @NotNull public static final ResultCode CANNOT_CANCEL =
1423       new ResultCode(INFO_RC_CANNOT_CANCEL.get(), CANNOT_CANCEL_INT_VALUE);
1424
1425
1426
1427  /**
1428   * The integer value (122) for the "ASSERTION_FAILED" result code.
1429   */
1430  public static final int ASSERTION_FAILED_INT_VALUE = 122;
1431
1432
1433
1434  /**
1435   * The result code (122) that will be used if the requested operation included
1436   * the LDAP assertion control but the assertion did not match the target
1437   * entry.
1438   */
1439  @NotNull public static final ResultCode ASSERTION_FAILED =
1440       new ResultCode(INFO_RC_ASSERTION_FAILED.get(),
1441                      ASSERTION_FAILED_INT_VALUE);
1442
1443
1444
1445  /**
1446   * The integer value (123) for the "AUTHORIZATION_DENIED" result code.
1447   */
1448  public static final int AUTHORIZATION_DENIED_INT_VALUE = 123;
1449
1450
1451
1452  /**
1453   * The result code (123) that will be used if the client is denied the ability
1454   * to use the proxied authorization control.
1455   */
1456  @NotNull public static final ResultCode AUTHORIZATION_DENIED =
1457       new ResultCode(INFO_RC_AUTHORIZATION_DENIED.get(),
1458                      AUTHORIZATION_DENIED_INT_VALUE);
1459
1460
1461
1462  /**
1463   * The integer value (4096) for the "E_SYNC_REFRESH_REQUIRED" result code.
1464   */
1465  public static final int E_SYNC_REFRESH_REQUIRED_INT_VALUE = 4096;
1466
1467
1468
1469  /**
1470   * The result code (4096) that will be used if a client using the content
1471   * synchronization request control requests an incremental update but the
1472   * server is unable to honor that request and requires the client to request
1473   * an initial content.
1474   */
1475  @NotNull public static final ResultCode E_SYNC_REFRESH_REQUIRED =
1476       new ResultCode(INFO_RC_E_SYNC_REFRESH_REQUIRED.get(),
1477                      E_SYNC_REFRESH_REQUIRED_INT_VALUE);
1478
1479
1480
1481  /**
1482   * The integer value (16654) for the "NO_OPERATION" result code.
1483   */
1484  public static final int NO_OPERATION_INT_VALUE = 16_654;
1485
1486
1487
1488  /**
1489   * The result code (16654) for operations that completed successfully but no
1490   * changes were made to the server because the LDAP no-op control was included
1491   * in the request.
1492   */
1493  @NotNull public static final ResultCode NO_OPERATION =
1494       new ResultCode(INFO_RC_NO_OPERATION.get(), NO_OPERATION_INT_VALUE);
1495
1496
1497
1498  /**
1499   * The integer value (30221001) for the "INTERACTIVE_TRANSACTION_ABORTED"
1500   * result code.
1501   */
1502  public static final int INTERACTIVE_TRANSACTION_ABORTED_INT_VALUE =
1503       30_221_001;
1504
1505
1506
1507  /**
1508   * The result code (30221001) for use if an interactive transaction has been
1509   * aborted, either due to an explicit request from a client or by the server
1510   * without a client request.
1511   */
1512  @NotNull public static final ResultCode INTERACTIVE_TRANSACTION_ABORTED =
1513       new ResultCode(INFO_RC_INTERACTIVE_TRANSACTION_ABORTED.get(),
1514                      INTERACTIVE_TRANSACTION_ABORTED_INT_VALUE);
1515
1516
1517
1518  /**
1519   * The integer value (30221002) for the "DATABASE_LOCK_CONFLICT" result code.
1520   */
1521  public static final int DATABASE_LOCK_CONFLICT_INT_VALUE = 30_221_002;
1522
1523
1524
1525  /**
1526   * The result code (30221002) for use if an operation fails because of a
1527   * database lock conflict (e.g., a deadlock or lock timeout).
1528   */
1529  @NotNull public static final ResultCode DATABASE_LOCK_CONFLICT =
1530       new ResultCode(INFO_RC_DATABASE_LOCK_CONFLICT.get(),
1531                      DATABASE_LOCK_CONFLICT_INT_VALUE);
1532
1533
1534
1535  /**
1536   * The integer value (30221003) for the "MIRRORED_SUBTREE_DIGEST_MISMATCH"
1537   * result code.
1538   */
1539  public static final int MIRRORED_SUBTREE_DIGEST_MISMATCH_INT_VALUE =
1540       30_221_003;
1541
1542
1543
1544  /**
1545   * The result code (30221003) that should be used by a node in a topology of
1546   * servers to indicate that its subtree digest does not match that of its
1547   * master's.
1548   */
1549  @NotNull public static final ResultCode MIRRORED_SUBTREE_DIGEST_MISMATCH =
1550      new ResultCode(INFO_RC_MIRRORED_SUBTREE_DIGEST_MISMATCH.get(),
1551          MIRRORED_SUBTREE_DIGEST_MISMATCH_INT_VALUE);
1552
1553
1554
1555  /**
1556   * The integer value (30221004) for the "TOKEN_DELIVERY_MECHANISM_UNAVAILABLE"
1557   * result code.
1558   */
1559  public static final int TOKEN_DELIVERY_MECHANISM_UNAVAILABLE_INT_VALUE =
1560       30_221_004;
1561
1562
1563
1564  /**
1565   * The result code (30221004) that should be used to indicate that the server
1566   * could not deliver a one-time password, password reset token, or single-use
1567   * token because none of the attempted delivery mechanisms were supported for
1568   * the target user.
1569   */
1570  @NotNull public static final ResultCode TOKEN_DELIVERY_MECHANISM_UNAVAILABLE =
1571      new ResultCode(INFO_RC_TOKEN_DELIVERY_MECHANISM_UNAVAILABLE.get(),
1572          TOKEN_DELIVERY_MECHANISM_UNAVAILABLE_INT_VALUE);
1573
1574
1575
1576  /**
1577   * The integer value (30221005) for the "TOKEN_DELIVERY_ATTEMPT_FAILED"
1578   * result code.
1579   */
1580  public static final int TOKEN_DELIVERY_ATTEMPT_FAILED_INT_VALUE = 30_221_005;
1581
1582
1583
1584  /**
1585   * The result code (30221005) that should be used to indicate that the server
1586   * could not deliver a one-time password, password reset token, or single-use
1587   * token because a failure was encountered while attempting to deliver the
1588   * token through all of the supported mechanisms.
1589   */
1590  @NotNull public static final ResultCode TOKEN_DELIVERY_ATTEMPT_FAILED =
1591      new ResultCode(INFO_RC_TOKEN_DELIVERY_ATTEMPT_FAILED.get(),
1592          TOKEN_DELIVERY_ATTEMPT_FAILED_INT_VALUE);
1593
1594
1595
1596  /**
1597   * The integer value (30221006) for the "TOKEN_DELIVERY_INVALID_RECIPIENT_ID"
1598   * result code.
1599   */
1600  public static final int TOKEN_DELIVERY_INVALID_RECIPIENT_ID_INT_VALUE =
1601       30_221_006;
1602
1603
1604
1605  /**
1606   * The result code (30221006) that should be used to indicate that the server
1607   * could not deliver a one-time password, password reset token, or single-use
1608   * token because the client specified a recipient ID that was not appropriate
1609   * for the target user.
1610   */
1611  @NotNull public static final ResultCode TOKEN_DELIVERY_INVALID_RECIPIENT_ID =
1612      new ResultCode(INFO_RC_TOKEN_DELIVERY_INVALID_RECIPIENT_ID.get(),
1613          TOKEN_DELIVERY_INVALID_RECIPIENT_ID_INT_VALUE);
1614
1615
1616
1617  /**
1618   * The integer value (30221007) for the "TOKEN_DELIVERY_INVALID_ACCOUNT_STATE"
1619   * result code.
1620   */
1621  public static final int TOKEN_DELIVERY_INVALID_ACCOUNT_STATE_INT_VALUE =
1622       30_221_007;
1623
1624
1625
1626  /**
1627   * The result code (30221007) that should be used to indicate that the server
1628   * could not deliver a one-time password, password reset token, or single-use
1629   * token because the target user account was in an invalid state for receiving
1630   * such tokens (e.g., the account is disabled or locked, the password is
1631   * expired, etc.).
1632   */
1633  @NotNull public static final ResultCode TOKEN_DELIVERY_INVALID_ACCOUNT_STATE =
1634      new ResultCode(INFO_RC_TOKEN_DELIVERY_INVALID_ACCOUNT_STATE.get(),
1635          TOKEN_DELIVERY_INVALID_ACCOUNT_STATE_INT_VALUE);
1636
1637
1638
1639  /**
1640   * The set of result code objects created with undefined int result code
1641   * values.
1642   */
1643  @NotNull private static final ConcurrentHashMap<Integer,ResultCode>
1644       UNDEFINED_RESULT_CODES =
1645            new ConcurrentHashMap<>(StaticUtils.computeMapCapacity(10));
1646
1647
1648
1649  /**
1650   * The serial version UID for this serializable class.
1651   */
1652  private static final long serialVersionUID = 7609311304252378100L;
1653
1654
1655
1656  // The integer value for this result code.
1657  private final int intValue;
1658
1659  // The name for this result code.
1660  @NotNull private final String name;
1661
1662  // The string representation for this result code.
1663  @NotNull private final String stringRepresentation;
1664
1665
1666
1667  /**
1668   * Creates a new result code with the specified integer value.
1669   *
1670   * @param  intValue  The integer value for this result code.
1671   */
1672  private ResultCode(final int intValue)
1673  {
1674    this.intValue = intValue;
1675
1676    name                 = String.valueOf(intValue);
1677    stringRepresentation = name;
1678  }
1679
1680
1681
1682  /**
1683   * Creates a new result code with the specified name and integer value.
1684   *
1685   * @param  name      The name for this result code.
1686   * @param  intValue  The integer value for this result code.
1687   */
1688  private ResultCode(@NotNull final String name, final int intValue)
1689  {
1690    this.name     = name;
1691    this.intValue = intValue;
1692
1693    stringRepresentation = intValue + " (" + name + ')';
1694  }
1695
1696
1697
1698  /**
1699   * Retrieves the name for this result code.
1700   *
1701   * @return  The name for this result code.
1702   */
1703  @NotNull()
1704  public String getName()
1705  {
1706    return name;
1707  }
1708
1709
1710
1711  /**
1712   * Retrieves the integer value for this result code.
1713   *
1714   * @return  The integer value for this result code.
1715   */
1716  public int intValue()
1717  {
1718    return intValue;
1719  }
1720
1721
1722
1723  /**
1724   * Retrieves the result code with the specified integer value.  If the
1725   * provided integer value does not correspond to a predefined
1726   * {@code ResultCode} object, then a new {@code ResultCode} object will be
1727   * created and returned.  Any new result codes created will also be cached
1728   * and returned for any subsequent requests with that integer value so the
1729   * same object will always be returned for a given integer value.
1730   *
1731   * @param  intValue  The integer value for which to retrieve the corresponding
1732   *                   result code.
1733   *
1734   * @return  The result code with the specified integer value, or a new result
1735   *          code
1736   */
1737  @NotNull()
1738  public static ResultCode valueOf(final int intValue)
1739  {
1740    return valueOf(intValue, null);
1741  }
1742
1743
1744
1745  /**
1746   * Retrieves the result code with the specified integer value.  If the
1747   * provided integer value does not correspond to a predefined
1748   * {@code ResultCode} object, then a new {@code ResultCode} object will be
1749   * created and returned.  Any new result codes created will also be cached
1750   * and returned for any subsequent requests with that integer value so the
1751   * same object will always be returned for a given integer value.
1752   *
1753   * @param  intValue  The integer value for which to retrieve the corresponding
1754   *                   result code.
1755   * @param  name      The user-friendly name to use for the result code if no
1756   *                   result code has been previously accessed with the same
1757   *                   integer value.  It may be {@code null} if this is not
1758   *                   known or a string representation of the integer value
1759   *                   should be used.
1760   *
1761   * @return  The result code with the specified integer value, or a new result
1762   *          code
1763   */
1764  @NotNull()
1765  public static ResultCode valueOf(final int intValue,
1766                                   @Nullable final String name)
1767  {
1768    return valueOf(intValue, name, true);
1769  }
1770
1771
1772
1773  /**
1774   * Retrieves the result code with the specified integer value.  If the
1775   * provided integer value does not correspond to an already-defined
1776   * {@code ResultCode} object, then this method may optionally create and
1777   * return a new {@code ResultCode}.  Any new result codes created will also be
1778   * cached and returned for any subsequent requests with that integer value so
1779   * the same object will always be returned for a given integer value.
1780   *
1781   * @param  intValue             The integer value for which to retrieve the
1782   *                              corresponding result code.
1783   * @param  name                 The user-friendly name to use for the result
1784   *                              code if no result code has been previously
1785   *                              accessed with the same integer value.  It may
1786   *                              be {@code null} if this is not known or a
1787   *                              string representation of the integer value
1788   *                              should be used.
1789   * @param  createNewResultCode  Indicates whether to create a new result code
1790   *                              object with the specified integer value and
1791   *                              name if that value does not correspond to
1792   *                              any already-defined result code.
1793   *
1794   * @return  The existing result code with the specified integer value if one
1795   *          already existed, a newly-created result code with the specified
1796   *          name and integer value if none already existed but
1797   *          {@code createNewResultCode} is {@code true}, or {@code null} if no
1798   *          result code already existed with the specified integer value and
1799   *          {@code createNewResultCode} is {@code false}.
1800   */
1801  @Nullable()
1802  public static ResultCode valueOf(final int intValue,
1803                                   @Nullable final String name,
1804                                   final boolean createNewResultCode)
1805  {
1806    switch (intValue)
1807    {
1808      case SUCCESS_INT_VALUE:
1809        return SUCCESS;
1810      case OPERATIONS_ERROR_INT_VALUE:
1811        return OPERATIONS_ERROR;
1812      case PROTOCOL_ERROR_INT_VALUE:
1813        return PROTOCOL_ERROR;
1814      case TIME_LIMIT_EXCEEDED_INT_VALUE:
1815        return TIME_LIMIT_EXCEEDED;
1816      case SIZE_LIMIT_EXCEEDED_INT_VALUE:
1817        return SIZE_LIMIT_EXCEEDED;
1818      case COMPARE_FALSE_INT_VALUE:
1819        return COMPARE_FALSE;
1820      case COMPARE_TRUE_INT_VALUE:
1821        return COMPARE_TRUE;
1822      case AUTH_METHOD_NOT_SUPPORTED_INT_VALUE:
1823        return AUTH_METHOD_NOT_SUPPORTED;
1824      case STRONG_AUTH_REQUIRED_INT_VALUE:
1825        return STRONG_AUTH_REQUIRED;
1826      case REFERRAL_INT_VALUE:
1827        return REFERRAL;
1828      case ADMIN_LIMIT_EXCEEDED_INT_VALUE:
1829        return ADMIN_LIMIT_EXCEEDED;
1830      case UNAVAILABLE_CRITICAL_EXTENSION_INT_VALUE:
1831        return UNAVAILABLE_CRITICAL_EXTENSION;
1832      case CONFIDENTIALITY_REQUIRED_INT_VALUE:
1833        return CONFIDENTIALITY_REQUIRED;
1834      case SASL_BIND_IN_PROGRESS_INT_VALUE:
1835        return SASL_BIND_IN_PROGRESS;
1836      case NO_SUCH_ATTRIBUTE_INT_VALUE:
1837        return NO_SUCH_ATTRIBUTE;
1838      case UNDEFINED_ATTRIBUTE_TYPE_INT_VALUE:
1839        return UNDEFINED_ATTRIBUTE_TYPE;
1840      case INAPPROPRIATE_MATCHING_INT_VALUE:
1841        return INAPPROPRIATE_MATCHING;
1842      case CONSTRAINT_VIOLATION_INT_VALUE:
1843        return CONSTRAINT_VIOLATION;
1844      case ATTRIBUTE_OR_VALUE_EXISTS_INT_VALUE:
1845        return ATTRIBUTE_OR_VALUE_EXISTS;
1846      case INVALID_ATTRIBUTE_SYNTAX_INT_VALUE:
1847        return INVALID_ATTRIBUTE_SYNTAX;
1848      case NO_SUCH_OBJECT_INT_VALUE:
1849        return NO_SUCH_OBJECT;
1850      case ALIAS_PROBLEM_INT_VALUE:
1851        return ALIAS_PROBLEM;
1852      case INVALID_DN_SYNTAX_INT_VALUE:
1853        return INVALID_DN_SYNTAX;
1854      case ALIAS_DEREFERENCING_PROBLEM_INT_VALUE:
1855        return ALIAS_DEREFERENCING_PROBLEM;
1856      case INAPPROPRIATE_AUTHENTICATION_INT_VALUE:
1857        return INAPPROPRIATE_AUTHENTICATION;
1858      case INVALID_CREDENTIALS_INT_VALUE:
1859        return INVALID_CREDENTIALS;
1860      case INSUFFICIENT_ACCESS_RIGHTS_INT_VALUE:
1861        return INSUFFICIENT_ACCESS_RIGHTS;
1862      case BUSY_INT_VALUE:
1863        return BUSY;
1864      case UNAVAILABLE_INT_VALUE:
1865        return UNAVAILABLE;
1866      case UNWILLING_TO_PERFORM_INT_VALUE:
1867        return UNWILLING_TO_PERFORM;
1868      case LOOP_DETECT_INT_VALUE:
1869        return LOOP_DETECT;
1870      case SORT_CONTROL_MISSING_INT_VALUE:
1871        return SORT_CONTROL_MISSING;
1872      case OFFSET_RANGE_ERROR_INT_VALUE:
1873        return OFFSET_RANGE_ERROR;
1874      case NAMING_VIOLATION_INT_VALUE:
1875        return NAMING_VIOLATION;
1876      case OBJECT_CLASS_VIOLATION_INT_VALUE:
1877        return OBJECT_CLASS_VIOLATION;
1878      case NOT_ALLOWED_ON_NONLEAF_INT_VALUE:
1879        return NOT_ALLOWED_ON_NONLEAF;
1880      case NOT_ALLOWED_ON_RDN_INT_VALUE:
1881        return NOT_ALLOWED_ON_RDN;
1882      case ENTRY_ALREADY_EXISTS_INT_VALUE:
1883        return ENTRY_ALREADY_EXISTS;
1884      case OBJECT_CLASS_MODS_PROHIBITED_INT_VALUE:
1885        return OBJECT_CLASS_MODS_PROHIBITED;
1886      case AFFECTS_MULTIPLE_DSAS_INT_VALUE:
1887        return AFFECTS_MULTIPLE_DSAS;
1888      case VIRTUAL_LIST_VIEW_ERROR_INT_VALUE:
1889        return VIRTUAL_LIST_VIEW_ERROR;
1890      case OTHER_INT_VALUE:
1891        return OTHER;
1892      case SERVER_DOWN_INT_VALUE:
1893        return SERVER_DOWN;
1894      case LOCAL_ERROR_INT_VALUE:
1895        return LOCAL_ERROR;
1896      case ENCODING_ERROR_INT_VALUE:
1897        return ENCODING_ERROR;
1898      case DECODING_ERROR_INT_VALUE:
1899        return DECODING_ERROR;
1900      case TIMEOUT_INT_VALUE:
1901        return TIMEOUT;
1902      case AUTH_UNKNOWN_INT_VALUE:
1903        return AUTH_UNKNOWN;
1904      case FILTER_ERROR_INT_VALUE:
1905        return FILTER_ERROR;
1906      case USER_CANCELED_INT_VALUE:
1907        return USER_CANCELED;
1908      case PARAM_ERROR_INT_VALUE:
1909        return PARAM_ERROR;
1910      case NO_MEMORY_INT_VALUE:
1911        return NO_MEMORY;
1912      case CONNECT_ERROR_INT_VALUE:
1913        return CONNECT_ERROR;
1914      case NOT_SUPPORTED_INT_VALUE:
1915        return NOT_SUPPORTED;
1916      case CONTROL_NOT_FOUND_INT_VALUE:
1917        return CONTROL_NOT_FOUND;
1918      case NO_RESULTS_RETURNED_INT_VALUE:
1919        return NO_RESULTS_RETURNED;
1920      case MORE_RESULTS_TO_RETURN_INT_VALUE:
1921        return MORE_RESULTS_TO_RETURN;
1922      case CLIENT_LOOP_INT_VALUE:
1923        return CLIENT_LOOP;
1924      case REFERRAL_LIMIT_EXCEEDED_INT_VALUE:
1925        return REFERRAL_LIMIT_EXCEEDED;
1926      case CANCELED_INT_VALUE:
1927        return CANCELED;
1928      case NO_SUCH_OPERATION_INT_VALUE:
1929        return NO_SUCH_OPERATION;
1930      case TOO_LATE_INT_VALUE:
1931        return TOO_LATE;
1932      case CANNOT_CANCEL_INT_VALUE:
1933        return CANNOT_CANCEL;
1934      case ASSERTION_FAILED_INT_VALUE:
1935        return ASSERTION_FAILED;
1936      case AUTHORIZATION_DENIED_INT_VALUE:
1937        return AUTHORIZATION_DENIED;
1938      case E_SYNC_REFRESH_REQUIRED_INT_VALUE:
1939        return E_SYNC_REFRESH_REQUIRED;
1940      case NO_OPERATION_INT_VALUE:
1941        return NO_OPERATION;
1942      case INTERACTIVE_TRANSACTION_ABORTED_INT_VALUE:
1943        return INTERACTIVE_TRANSACTION_ABORTED;
1944      case DATABASE_LOCK_CONFLICT_INT_VALUE:
1945        return DATABASE_LOCK_CONFLICT;
1946      case MIRRORED_SUBTREE_DIGEST_MISMATCH_INT_VALUE:
1947        return MIRRORED_SUBTREE_DIGEST_MISMATCH;
1948      case TOKEN_DELIVERY_MECHANISM_UNAVAILABLE_INT_VALUE:
1949        return TOKEN_DELIVERY_MECHANISM_UNAVAILABLE;
1950      case TOKEN_DELIVERY_ATTEMPT_FAILED_INT_VALUE:
1951        return TOKEN_DELIVERY_ATTEMPT_FAILED;
1952      case TOKEN_DELIVERY_INVALID_RECIPIENT_ID_INT_VALUE:
1953        return TOKEN_DELIVERY_INVALID_RECIPIENT_ID;
1954      case TOKEN_DELIVERY_INVALID_ACCOUNT_STATE_INT_VALUE:
1955        return TOKEN_DELIVERY_INVALID_ACCOUNT_STATE;
1956    }
1957
1958    ResultCode rc = UNDEFINED_RESULT_CODES.get(intValue);
1959    if (rc == null)
1960    {
1961      if (! createNewResultCode)
1962      {
1963        return null;
1964      }
1965
1966      if (name == null)
1967      {
1968        rc = new ResultCode(intValue);
1969      }
1970      else
1971      {
1972        rc = new ResultCode(name, intValue);
1973      }
1974
1975      final ResultCode existingRC =
1976           UNDEFINED_RESULT_CODES.putIfAbsent(intValue, rc);
1977      if (existingRC != null)
1978      {
1979        return existingRC;
1980      }
1981    }
1982
1983    return rc;
1984  }
1985
1986
1987
1988  /**
1989   * Retrieves an array of all result codes defined in the LDAP SDK.  This will
1990   * not include dynamically-generated values.
1991   *
1992   * @return  An array of all result codes defined in the LDAP SDK.
1993   */
1994  @NotNull()
1995  public static ResultCode[] values()
1996  {
1997    return new ResultCode[]
1998    {
1999      SUCCESS,
2000      OPERATIONS_ERROR,
2001      PROTOCOL_ERROR,
2002      TIME_LIMIT_EXCEEDED,
2003      SIZE_LIMIT_EXCEEDED,
2004      COMPARE_FALSE,
2005      COMPARE_TRUE,
2006      AUTH_METHOD_NOT_SUPPORTED,
2007      STRONG_AUTH_REQUIRED,
2008      REFERRAL,
2009      ADMIN_LIMIT_EXCEEDED,
2010      UNAVAILABLE_CRITICAL_EXTENSION,
2011      CONFIDENTIALITY_REQUIRED,
2012      SASL_BIND_IN_PROGRESS,
2013      NO_SUCH_ATTRIBUTE,
2014      UNDEFINED_ATTRIBUTE_TYPE,
2015      INAPPROPRIATE_MATCHING,
2016      CONSTRAINT_VIOLATION,
2017      ATTRIBUTE_OR_VALUE_EXISTS,
2018      INVALID_ATTRIBUTE_SYNTAX,
2019      NO_SUCH_OBJECT,
2020      ALIAS_PROBLEM,
2021      INVALID_DN_SYNTAX,
2022      ALIAS_DEREFERENCING_PROBLEM,
2023      INAPPROPRIATE_AUTHENTICATION,
2024      INVALID_CREDENTIALS,
2025      INSUFFICIENT_ACCESS_RIGHTS,
2026      BUSY,
2027      UNAVAILABLE,
2028      UNWILLING_TO_PERFORM,
2029      LOOP_DETECT,
2030      SORT_CONTROL_MISSING,
2031      OFFSET_RANGE_ERROR,
2032      NAMING_VIOLATION,
2033      OBJECT_CLASS_VIOLATION,
2034      NOT_ALLOWED_ON_NONLEAF,
2035      NOT_ALLOWED_ON_RDN,
2036      ENTRY_ALREADY_EXISTS,
2037      OBJECT_CLASS_MODS_PROHIBITED,
2038      AFFECTS_MULTIPLE_DSAS,
2039      VIRTUAL_LIST_VIEW_ERROR,
2040      OTHER,
2041      SERVER_DOWN,
2042      LOCAL_ERROR,
2043      ENCODING_ERROR,
2044      DECODING_ERROR,
2045      TIMEOUT,
2046      AUTH_UNKNOWN,
2047      FILTER_ERROR,
2048      USER_CANCELED,
2049      PARAM_ERROR,
2050      NO_MEMORY,
2051      CONNECT_ERROR,
2052      NOT_SUPPORTED,
2053      CONTROL_NOT_FOUND,
2054      NO_RESULTS_RETURNED,
2055      MORE_RESULTS_TO_RETURN,
2056      CLIENT_LOOP,
2057      REFERRAL_LIMIT_EXCEEDED,
2058      CANCELED,
2059      NO_SUCH_OPERATION,
2060      TOO_LATE,
2061      CANNOT_CANCEL,
2062      ASSERTION_FAILED,
2063      AUTHORIZATION_DENIED,
2064      E_SYNC_REFRESH_REQUIRED,
2065      NO_OPERATION,
2066      INTERACTIVE_TRANSACTION_ABORTED,
2067      DATABASE_LOCK_CONFLICT,
2068      MIRRORED_SUBTREE_DIGEST_MISMATCH,
2069      TOKEN_DELIVERY_MECHANISM_UNAVAILABLE,
2070      TOKEN_DELIVERY_ATTEMPT_FAILED,
2071      TOKEN_DELIVERY_INVALID_RECIPIENT_ID,
2072      TOKEN_DELIVERY_INVALID_ACCOUNT_STATE
2073    };
2074  }
2075
2076
2077
2078  /**
2079   * Indicates whether this result code is one that should be used for
2080   * client-side errors rather than returned by the server.
2081   *
2082   * @return  {@code true} if this result code is a client-side result code, or
2083   *          {@code false} if it is one that may be returned by the server.
2084   */
2085  public boolean isClientSideResultCode()
2086  {
2087    return isClientSideResultCode(this);
2088  }
2089
2090
2091
2092  /**
2093   * Indicates whether the provided result code is one that should be used for
2094   * client-side errors rather than returned by the server.
2095   *
2096   * @param  resultCode  The result code for which to make the determination.
2097   *
2098   * @return  {@code true} if the provided result code is a client-side result
2099   *          code, or {@code false} if it is one that may be returned by the
2100   *          server.
2101   */
2102  public static boolean isClientSideResultCode(
2103                             @NotNull final ResultCode resultCode)
2104  {
2105    switch (resultCode.intValue())
2106    {
2107      case SERVER_DOWN_INT_VALUE:
2108      case LOCAL_ERROR_INT_VALUE:
2109      case ENCODING_ERROR_INT_VALUE:
2110      case DECODING_ERROR_INT_VALUE:
2111      case TIMEOUT_INT_VALUE:
2112      case AUTH_UNKNOWN_INT_VALUE:
2113      case FILTER_ERROR_INT_VALUE:
2114      case USER_CANCELED_INT_VALUE:
2115      case PARAM_ERROR_INT_VALUE:
2116      case NO_MEMORY_INT_VALUE:
2117      case CONNECT_ERROR_INT_VALUE:
2118      case NOT_SUPPORTED_INT_VALUE:
2119      case CONTROL_NOT_FOUND_INT_VALUE:
2120      case NO_RESULTS_RETURNED_INT_VALUE:
2121      case MORE_RESULTS_TO_RETURN_INT_VALUE:
2122      case CLIENT_LOOP_INT_VALUE:
2123      case REFERRAL_LIMIT_EXCEEDED_INT_VALUE:
2124        return true;
2125      default:
2126        return false;
2127    }
2128  }
2129
2130
2131
2132  /**
2133   * Indicates whether the connection on which this result code was received is
2134   * likely still usable.  Note that this is a best guess, and it may or may not
2135   * be correct.  It will attempt to be conservative so that a connection is
2136   * more likely to be classified as unusable when it may still be valid than to
2137   * be classified as usable when that is no longer the case.
2138   *
2139   * @return  {@code true} if it is likely that the connection on which this
2140   *          result code was received is still usable, or {@code false} if it
2141   *          may no longer be valid.
2142   */
2143  public boolean isConnectionUsable()
2144  {
2145    return isConnectionUsable(this);
2146  }
2147
2148
2149
2150  /**
2151   * Indicates whether the connection on which the provided result code was
2152   * received is likely still usable.  Note that this is a best guess based on
2153   * the provided result code, and it may or may not be correct.  It will
2154   * attempt to be conservative so that a connection is more likely to be
2155   * classified as unusable when it may still be valid than to be classified
2156   * as usable when that is no longer the case.
2157   *
2158   * @param  resultCode  The result code for which to make the determination.
2159   *
2160   * @return  {@code true} if it is likely that the connection on which the
2161   *          provided result code was received is still usable, or
2162   *          {@code false} if it may no longer be valid.
2163   */
2164  public static boolean isConnectionUsable(@NotNull final ResultCode resultCode)
2165  {
2166    switch (resultCode.intValue())
2167    {
2168      case OPERATIONS_ERROR_INT_VALUE:
2169      case PROTOCOL_ERROR_INT_VALUE:
2170      case BUSY_INT_VALUE:
2171      case UNAVAILABLE_INT_VALUE:
2172      case OTHER_INT_VALUE:
2173      case SERVER_DOWN_INT_VALUE:
2174      case LOCAL_ERROR_INT_VALUE:
2175      case ENCODING_ERROR_INT_VALUE:
2176      case DECODING_ERROR_INT_VALUE:
2177      case TIMEOUT_INT_VALUE:
2178      case NO_MEMORY_INT_VALUE:
2179      case CONNECT_ERROR_INT_VALUE:
2180        return false;
2181      default:
2182        return true;
2183    }
2184  }
2185
2186
2187
2188  /**
2189   * The hash code for this result code.
2190   *
2191   * @return  The hash code for this result code.
2192   */
2193  @Override()
2194  public int hashCode()
2195  {
2196    return intValue;
2197  }
2198
2199
2200
2201  /**
2202   * Indicates whether the provided object is equal to this result code.
2203   *
2204   * @param  o  The object for which to make the determination.
2205   *
2206   * @return  {@code true} if the provided object is a result code that is equal
2207   *          to this result code, or {@code false} if not.
2208   */
2209  @Override()
2210  public boolean equals(@Nullable final Object o)
2211  {
2212    if (o == null)
2213    {
2214      return false;
2215    }
2216    else if (o == this)
2217    {
2218      return true;
2219    }
2220    else if (o instanceof ResultCode)
2221    {
2222      return (intValue == ((ResultCode) o).intValue);
2223    }
2224    else
2225    {
2226      return false;
2227    }
2228  }
2229
2230
2231
2232  /**
2233   * Retrieves a string representation of this result code.
2234   *
2235   * @return  A string representation of this result code.
2236   */
2237  @Override()
2238  @NotNull()
2239  public String toString()
2240  {
2241    return stringRepresentation;
2242  }
2243}