1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.core.authz.support;
21
22
23 import java.util.ArrayList;
24 import java.util.Comparator;
25 import java.util.Iterator;
26 import java.util.Map;
27 import java.util.Set;
28
29 import javax.naming.NamingException;
30
31 import org.apache.directory.server.core.authz.support.ACITupleFilter;
32 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
33 import org.apache.directory.shared.ldap.schema.AttributeType;
34 import org.apache.directory.shared.ldap.schema.MatchingRule;
35 import org.apache.directory.shared.ldap.schema.Normalizer;
36 import org.apache.directory.shared.ldap.schema.OidNormalizer;
37 import org.apache.directory.shared.ldap.schema.Syntax;
38 import org.apache.directory.shared.ldap.schema.UsageEnum;
39 import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
40 import org.apache.directory.shared.ldap.util.StringTools;
41
42
43
44
45
46
47
48
49
50 public class DummyAttributeTypeRegistry implements AttributeTypeRegistry
51 {
52 private final boolean returnOperational;
53
54
55 public DummyAttributeTypeRegistry(boolean returnOperational)
56 {
57 this.returnOperational = returnOperational;
58 }
59
60
61 public AttributeType lookup( final String id ) throws NamingException
62 {
63 if ( returnOperational )
64 {
65 return new AttributeType()
66 {
67 private static final long serialVersionUID = 1L;
68
69
70 public boolean isSingleValue()
71 {
72 return false;
73 }
74
75
76 public boolean isCanUserModify()
77 {
78 return false;
79 }
80
81
82 public boolean isCollective()
83 {
84 return false;
85 }
86
87
88 public UsageEnum getUsage()
89 {
90 return null;
91 }
92
93
94 public AttributeType getSuperior() throws NamingException
95 {
96 return null;
97 }
98
99
100 public Syntax getSyntax() throws NamingException
101 {
102 return null;
103 }
104
105
106 public int getLength()
107 {
108 return 0;
109 }
110
111
112 public MatchingRule getEquality() throws NamingException
113 {
114 return new MatchingRule()
115 {
116 private static final long serialVersionUID = 1L;
117
118 public Syntax getSyntax() throws NamingException
119 {
120 return null;
121 }
122
123 public Comparator getComparator() throws NamingException
124 {
125 return null;
126 }
127
128 public Normalizer getNormalizer() throws NamingException
129 {
130 return new Normalizer()
131 {
132 private static final long serialVersionUID = 1L;
133
134 public Object normalize( Object value ) throws NamingException
135 {
136 return StringTools.deepTrimToLower( value.toString() );
137 }
138 };
139 }
140
141 public boolean isObsolete()
142 {
143 return false;
144 }
145
146 public String getOid()
147 {
148 return null;
149 }
150
151 public String[] getNamesRef()
152 {
153 return null;
154 }
155
156 public String getName()
157 {
158 return null;
159 }
160
161 public String getDescription()
162 {
163 return null;
164 }
165
166 public String getSchema()
167 {
168 return null;
169 }
170
171 public void setSchema( String schemaName )
172 {
173 }
174 };
175 }
176
177
178 public MatchingRule getOrdering() throws NamingException
179 {
180 return null;
181 }
182
183
184 public MatchingRule getSubstr() throws NamingException
185 {
186 return null;
187 }
188
189
190 public boolean isAncestorOf( AttributeType descendant ) throws NamingException
191 {
192 return false;
193 }
194
195
196 public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
197 {
198 return false;
199 }
200
201
202 public boolean isObsolete()
203 {
204 return false;
205 }
206
207
208 public String getOid()
209 {
210 return String.valueOf( id.hashCode() );
211 }
212
213
214 public String[] getNamesRef()
215 {
216 return new String[]
217 { id };
218 }
219
220
221 public String getName()
222 {
223 return id;
224 }
225
226
227 public String getDescription()
228 {
229 return id;
230 }
231
232
233 public String getSchema()
234 {
235 return null;
236 }
237
238
239 public void setSchema( String schemaName )
240 {
241 }
242 };
243 }
244 else
245 {
246 return new AttributeType()
247 {
248 private static final long serialVersionUID = 1L;
249
250 public boolean isSingleValue()
251 {
252 return false;
253 }
254
255
256 public boolean isCanUserModify()
257 {
258 return true;
259 }
260
261
262 public boolean isCollective()
263 {
264 return false;
265 }
266
267
268 public UsageEnum getUsage()
269 {
270 return null;
271 }
272
273
274 public AttributeType getSuperior() throws NamingException
275 {
276 return null;
277 }
278
279
280 public Syntax getSyntax() throws NamingException
281 {
282 return new Syntax()
283 {
284
285 private static final long serialVersionUID = 1L;
286
287 public boolean isHumanReadable()
288 {
289 return true;
290 }
291
292 public SyntaxChecker getSyntaxChecker() throws NamingException
293 {
294 return null;
295 }
296
297 public boolean isObsolete()
298 {
299 return false;
300 }
301
302 public String getOid()
303 {
304 return null;
305 }
306
307 public String[] getNamesRef()
308 {
309 return null;
310 }
311
312 public String getName()
313 {
314 return null;
315 }
316
317 public String getDescription()
318 {
319 return null;
320 }
321
322 public String getSchema()
323 {
324 return null;
325 }
326
327 public void setSchema( String schemaName )
328 {
329 }
330 };
331 }
332
333
334 public int getLength()
335 {
336 return 0;
337 }
338
339
340 public MatchingRule getEquality() throws NamingException
341 {
342 return new MatchingRule()
343 {
344 private static final long serialVersionUID = 1L;
345
346 public Syntax getSyntax() throws NamingException
347 {
348 return new Syntax()
349 {
350 private static final long serialVersionUID = 1L;
351
352
353 public boolean isHumanReadable()
354 {
355 return true;
356 }
357
358 public SyntaxChecker getSyntaxChecker() throws NamingException
359 {
360 return null;
361 }
362
363 public boolean isObsolete()
364 {
365 return false;
366 }
367
368 public String getOid()
369 {
370 return null;
371 }
372
373 public String[] getNamesRef()
374 {
375 return null;
376 }
377
378 public String getName()
379 {
380 return null;
381 }
382
383 public String getDescription()
384 {
385 return null;
386 }
387
388 public String getSchema()
389 {
390 return null;
391 }
392
393 public void setSchema( String schemaName )
394 {
395 }
396 };
397 }
398
399 public Comparator getComparator() throws NamingException
400 {
401 return null;
402 }
403
404 public Normalizer getNormalizer() throws NamingException
405 {
406 return new Normalizer()
407 {
408 private static final long serialVersionUID = 1L;
409
410 public Object normalize( Object value ) throws NamingException
411 {
412 return StringTools.deepTrimToLower( value.toString() );
413 }
414 };
415 }
416
417 public boolean isObsolete()
418 {
419 return false;
420 }
421
422 public String getOid()
423 {
424 return null;
425 }
426
427 public String[] getNamesRef()
428 {
429 return null;
430 }
431
432 public String getName()
433 {
434 return null;
435 }
436
437 public String getDescription()
438 {
439 return null;
440 }
441
442 public String getSchema()
443 {
444 return null;
445 }
446
447 public void setSchema( String schemaName )
448 {
449 }
450 };
451 }
452
453
454 public MatchingRule getOrdering() throws NamingException
455 {
456 return null;
457 }
458
459
460 public MatchingRule getSubstr() throws NamingException
461 {
462 return null;
463 }
464
465
466 public boolean isAncestorOf( AttributeType descendant ) throws NamingException
467 {
468 return false;
469 }
470
471
472 public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
473 {
474 return false;
475 }
476
477
478 public boolean isObsolete()
479 {
480 return false;
481 }
482
483
484 public String getOid()
485 {
486 return String.valueOf( id.hashCode() );
487 }
488
489
490 public String[] getNamesRef()
491 {
492 return new String[]
493 { id };
494 }
495
496
497 public String getName()
498 {
499 return id;
500 }
501
502
503 public String getDescription()
504 {
505 return id;
506 }
507
508
509 public String getSchema()
510 {
511 return null;
512 }
513
514
515 public void setSchema( String schemaName )
516 {
517 }
518 };
519 }
520 }
521
522
523 public String getSchemaName( String id ) throws NamingException
524 {
525 return "dummy";
526 }
527
528
529 public boolean hasAttributeType( String id )
530 {
531 return true;
532 }
533
534
535 public Iterator list()
536 {
537 return new ArrayList().iterator();
538 }
539
540
541 public Map<String,OidNormalizer> getNormalizerMapping() throws NamingException
542 {
543 return null;
544 }
545
546
547 public Iterator<AttributeType> descendants( String ancestorId ) throws NamingException
548 {
549 return null;
550 }
551
552
553 public boolean hasDescendants( String ancestorId ) throws NamingException
554 {
555 return false;
556 }
557
558
559 public Iterator<AttributeType> iterator()
560 {
561 return null;
562 }
563
564
565 public void unregister( String numericOid ) throws NamingException
566 {
567 }
568
569
570 public void register( AttributeType attributeType ) throws NamingException
571 {
572 }
573
574
575 public Set<String> getBinaryAttributes() throws NamingException
576 {
577 return null;
578 }
579 }