001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.shared.ldap.codec.util;
021
022
023 /**
024 * This typesafe-enum represent the different resultCode of a LdapResult.
025 *
026 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
027 * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sam, 07 jui 2008) $,
028 */
029 public class LdapResultEnum
030 {
031 // ~ Static fields/initializers
032 // -----------------------------------------------------------------
033
034 public static final int SUCCESS = 0;
035
036 public static final int OPERATIONS_ERROR = 1;
037
038 public static final int PROTOCOL_ERROR = 2;
039
040 public static final int TIME_LIMIT_EXCEEDED = 3;
041
042 public static final int SIZE_LIMIT_EXCEEDED = 4;
043
044 public static final int COMPARE_FALSE = 5;
045
046 public static final int COMPARE_TRUE = 6;
047
048 public static final int AUTH_METHOD_NOT_SUPPORTED = 7;
049
050 public static final int STRONG_AUTH_REQUIRED = 8;
051
052 // -- 9 reserved --
053 public static final int RESERVED_9 = 9;
054
055 public static final int REFERRAL = 10; // -- new
056
057 public static final int ADMIN_LIMIT_EXCEEDED = 11; // -- new
058
059 public static final int UNAVAILABLE_CRITICAL_EXTENSION = 12; // -- new
060
061 public static final int CONFIDENTIALITY_REQUIRED = 13; // -- new
062
063 public static final int SASL_BIND_IN_PROGRESS = 14; // -- new
064
065 public static final int NO_SUCH_ATTRIBUTE = 16;
066
067 public static final int UNDEFINED_ATTRIBUTE_TYPE = 17;
068
069 public static final int INAPPROPRIATE_MATCHING = 18;
070
071 public static final int CONSTRAINT_VIOLATION = 19;
072
073 public static final int ATTRIBUTE_OR_VALUE_EXISTS = 20;
074
075 public static final int INVALID_ATTRIBUTE_SYNTAX = 21;
076
077 // -- 22-31 unused --
078 public static final int UNUSED_22 = 22;
079
080 public static final int UNUSED_23 = 23;
081
082 public static final int UNUSED_24 = 24;
083
084 public static final int UNUSED_25 = 25;
085
086 public static final int UNUSED_26 = 26;
087
088 public static final int UNUSED_27 = 27;
089
090 public static final int UNUSED_28 = 28;
091
092 public static final int UNUSED_29 = 29;
093
094 public static final int UNUSED_30 = 30;
095
096 public static final int UNUSED_31 = 31;
097
098 public static final int NO_SUCH_OBJECT = 32;
099
100 public static final int ALIAS_PROBLEM = 33;
101
102 public static final int INVALID_DN_SYNTAX = 34;
103
104 // Reserved
105 public static final int RESERVED_FOR_UNDEFINED_IS_LEAF = 35;
106
107 public static final int ALIAS_DEREFERENCING_PROBLEM = 36;
108
109 // -- 37-47 unused --
110 public static final int UNUSED_37 = 37;
111
112 public static final int UNUSED_38 = 38;
113
114 public static final int UNUSED_39 = 39;
115
116 public static final int UNUSED_40 = 40;
117
118 public static final int UNUSED_41 = 41;
119
120 public static final int UNUSED_42 = 42;
121
122 public static final int UNUSED_43 = 43;
123
124 public static final int UNUSED_44 = 44;
125
126 public static final int UNUSED_45 = 45;
127
128 public static final int UNUSED_46 = 46;
129
130 public static final int UNUSED_47 = 47;
131
132 public static final int INAPPROPRIATE_AUTHENTICATION = 48;
133
134 public static final int INVALID_CREDENTIALS = 49;
135
136 public static final int INSUFFICIENT_ACCESS_RIGHTS = 50;
137
138 public static final int BUSY = 51;
139
140 public static final int UNAVAILABLE = 52;
141
142 public static final int UNWILLING_TO_PERFORM = 53;
143
144 public static final int LOOP_DETECT = 54;
145
146 // -- 55-63 unused --
147 public static final int UNUSED_55 = 55;
148
149 public static final int UNUSED_56 = 56;
150
151 public static final int UNUSED_57 = 57;
152
153 public static final int UNUSED_58 = 58;
154
155 public static final int UNUSED_59 = 59;
156
157 public static final int UNUSED_60 = 60;
158
159 public static final int UNUSED_61 = 61;
160
161 public static final int UNUSED_62 = 62;
162
163 public static final int UNUSED_63 = 63;
164
165 public static final int NAMING_VIOLATION = 64;
166
167 public static final int OBJECT_CLASS_VIOLATION = 65;
168
169 public static final int NOT_ALLOWED_ON_NON_LEAF = 66;
170
171 public static final int NOT_ALLOWED_ON_RDN = 67;
172
173 public static final int ENTRY_ALREADY_EXISTS = 68;
174
175 public static final int OBJECT_CLASS_MODS_PROHIBITED = 69;
176
177 // -- 70 reserved for CLDAP --
178 public static final int RESERVED_FOR_CLDAP = 70;
179
180 public static final int AFFECTS_MULTIPLE_DSAS = 71; // -- new
181
182 // -- 72-79 unused --
183 public static final int UNUSED_72 = 72;
184
185 public static final int UNUSED_73 = 73;
186
187 public static final int UNUSED_74 = 74;
188
189 public static final int UNUSED_75 = 75;
190
191 public static final int UNUSED_76 = 76;
192
193 public static final int UNUSED_77 = 77;
194
195 public static final int UNUSED_78 = 78;
196
197 public static final int UNUSED_79 = 79;
198
199 public static final int OTHER = 80;
200
201 // -- 81-90 reserved for APIs --
202 public static final int RESERVED_FOR_APIS_81 = 81;
203
204 public static final int RESERVED_FOR_APIS_82 = 82;
205
206 public static final int RESERVED_FOR_APIS_83 = 83;
207
208 public static final int RESERVED_FOR_APIS_84 = 84;
209
210 public static final int RESERVED_FOR_APIS_85 = 85;
211
212 public static final int RESERVED_FOR_APIS_86 = 86;
213
214 public static final int RESERVED_FOR_APIS_87 = 87;
215
216 public static final int RESERVED_FOR_APIS_88 = 88;
217
218 public static final int RESERVED_FOR_APIS_89 = 89;
219
220 public static final int RESERVED_FOR_APIS_90 = 90;
221
222
223 public static final String errorCode( int resultCode )
224 {
225 switch ( resultCode )
226 {
227 case RESERVED_9:
228 return "Reserved (9)";
229 case UNUSED_22:
230 return "Unused (22)";
231 case UNUSED_23:
232 return "Unused (23)";
233 case UNUSED_24:
234 return "Unused (24)";
235 case UNUSED_25:
236 return "Unused (25)";
237 case UNUSED_26:
238 return "Unused (26)";
239 case UNUSED_27:
240 return "Unused (27)";
241 case UNUSED_28:
242 return "Unused (28)";
243 case UNUSED_29:
244 return "Unused (29)";
245 case UNUSED_30:
246 return "Unused (30)";
247 case UNUSED_31:
248 return "Unused (31)";
249 case RESERVED_FOR_UNDEFINED_IS_LEAF:
250 return "Reserved for undefined is leaf (35)";
251 case UNUSED_37:
252 return "unused (37)";
253 case UNUSED_38:
254 return "unused (38)";
255 case UNUSED_39:
256 return "unused (39)";
257 case UNUSED_40:
258 return "unused (40)";
259 case UNUSED_41:
260 return "unused (41)";
261 case UNUSED_42:
262 return "unused (42)";
263 case UNUSED_43:
264 return "unused (43)";
265 case UNUSED_44:
266 return "unused (44)";
267 case UNUSED_45:
268 return "unused (45)";
269 case UNUSED_46:
270 return "unused (46)";
271 case UNUSED_47:
272 return "unused (47)";
273 case UNUSED_55:
274 return "unused (55)";
275 case UNUSED_56:
276 return "unused (56)";
277 case UNUSED_57:
278 return "unused (57)";
279 case UNUSED_58:
280 return "unused (58)";
281 case UNUSED_59:
282 return "unused (59)";
283 case UNUSED_60:
284 return "unused (60)";
285 case UNUSED_61:
286 return "unused (61)";
287 case UNUSED_62:
288 return "unused (62)";
289 case UNUSED_63:
290 return "unused (63)";
291 case RESERVED_FOR_CLDAP:
292 return "RESERVED_FOR_CLDAP (70)";
293 case UNUSED_72:
294 return "unused (72)";
295 case UNUSED_73:
296 return "unused (73)";
297 case UNUSED_74:
298 return "unused (74)";
299 case UNUSED_75:
300 return "unused (75)";
301 case UNUSED_76:
302 return "unused (76)";
303 case UNUSED_77:
304 return "unused (77)";
305 case UNUSED_78:
306 return "unused (78)";
307 case UNUSED_79:
308 return "unused (79)";
309 case RESERVED_FOR_APIS_81:
310 return "RESERVED_FOR_APIS (81)";
311 case RESERVED_FOR_APIS_82:
312 return "RESERVED_FOR_APIS (82)";
313 case RESERVED_FOR_APIS_83:
314 return "RESERVED_FOR_APIS (83)";
315 case RESERVED_FOR_APIS_84:
316 return "RESERVED_FOR_APIS (84)";
317 case RESERVED_FOR_APIS_85:
318 return "RESERVED_FOR_APIS (85)";
319 case RESERVED_FOR_APIS_86:
320 return "RESERVED_FOR_APIS (86)";
321 case RESERVED_FOR_APIS_87:
322 return "RESERVED_FOR_APIS (87)";
323 case RESERVED_FOR_APIS_88:
324 return "RESERVED_FOR_APIS (88)";
325 case RESERVED_FOR_APIS_89:
326 return "RESERVED_FOR_APIS (89)";
327 case RESERVED_FOR_APIS_90:
328 return "RESERVED_FOR_APIS (90)";
329 default:
330 return "UNKOWN";
331 }
332 }
333 }