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