1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.apache.directory.api.ldap.aci;
25
26
27 import java.util.List;
28 import java.util.ArrayList;
29 import java.util.HashSet;
30 import java.util.Map;
31 import java.util.Set;
32 import java.util.Enumeration;
33
34 import org.apache.directory.api.ldap.model.filter.BranchNode;
35 import org.apache.directory.api.ldap.model.filter.AndNode;
36 import org.apache.directory.api.ldap.model.filter.OrNode;
37 import org.apache.directory.api.ldap.model.filter.NotNode;
38 import org.apache.directory.api.ldap.model.filter.ExprNode;
39 import org.apache.directory.api.ldap.model.filter.LeafNode;
40 import org.apache.directory.api.ldap.model.filter.EqualityNode;
41 import org.apache.directory.api.ldap.model.filter.FilterParser;
42 import org.apache.directory.api.ldap.model.schema.normalizers.NameComponentNormalizer;
43 import org.apache.directory.api.ldap.model.subtree.SubtreeSpecification;
44 import org.apache.directory.api.ldap.model.subtree.SubtreeSpecificationModifier;
45 import org.apache.directory.api.util.ComponentsMonitor;
46 import org.apache.directory.api.util.MandatoryAndOptionalComponentsMonitor;
47 import org.apache.directory.api.util.MandatoryComponentsMonitor;
48 import org.apache.directory.api.ldap.model.name.DnUtils;
49 import org.apache.directory.api.util.NoDuplicateKeysMap;
50 import org.apache.directory.api.util.OptionalComponentsMonitor;
51 import org.apache.directory.api.ldap.model.name.Dn;
52 import org.apache.directory.api.ldap.model.name.Rdn;
53 import org.apache.directory.api.ldap.model.schema.AttributeType;
54 import org.apache.directory.api.ldap.model.schema.SchemaManager;
55 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
56 import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
57 import org.apache.directory.api.ldap.model.entry.StringValue;
58 import org.apache.directory.api.ldap.model.entry.Attribute;
59 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
60 import org.apache.directory.api.ldap.model.exception.LdapException;
61 import org.apache.directory.api.ldap.aci.protectedItem.AllAttributeValuesItem;
62 import org.apache.directory.api.ldap.aci.protectedItem.AttributeTypeItem;
63 import org.apache.directory.api.ldap.aci.protectedItem.AttributeValueItem;
64 import org.apache.directory.api.ldap.aci.protectedItem.SelfValueItem;
65 import org.apache.directory.api.ldap.aci.protectedItem.ClassesItem;
66 import org.apache.directory.api.ldap.aci.protectedItem.EntryItem;
67 import org.apache.directory.api.ldap.aci.protectedItem.RangeOfValuesItem;
68 import org.apache.directory.api.ldap.aci.protectedItem.MaxImmSubItem;
69 import org.apache.directory.api.ldap.aci.protectedItem.MaxValueCountElem;
70 import org.apache.directory.api.ldap.aci.protectedItem.MaxValueCountItem;
71 import org.apache.directory.api.ldap.aci.protectedItem.RestrictedByElem;
72 import org.apache.directory.api.ldap.aci.protectedItem.RestrictedByItem;
73 import org.slf4j.Logger;
74 import org.slf4j.LoggerFactory;
75
76
77 import antlr.TokenBuffer;
78 import antlr.TokenStreamException;
79 import antlr.TokenStreamIOException;
80 import antlr.ANTLRException;
81 import antlr.LLkParser;
82 import antlr.Token;
83 import antlr.TokenStream;
84 import antlr.RecognitionException;
85 import antlr.NoViableAltException;
86 import antlr.MismatchedTokenException;
87 import antlr.SemanticException;
88 import antlr.ParserSharedInputState;
89 import antlr.collections.impl.BitSet;
90
91
92
93
94
95
96 public class AntlrACIItemParser extends antlr.LLkParser implements AntlrACIItemParserTokenTypes
97 {
98
99 private static final Logger log = LoggerFactory.getLogger( AntlrACIItemParser.class );
100
101 NameComponentNormalizer normalizer;
102
103
104
105 private String identificationTag;
106 private AuthenticationLevel authenticationLevel;
107 private Integer aciPrecedence = null;
108
109 private boolean isItemFirstACIItem;
110
111
112 private Set<ProtectedItem> protectedItems;
113 private Map<String, ProtectedItem> protectedItemsMap;
114 private Set<UserClass> userClasses;
115 private Map<String, UserClass> userClassesMap;
116 private Set<ItemPermission> itemPermissions;
117 private Integer precedence = null;
118 private Set<GrantAndDenial> grantsAndDenials;
119 private Set<UserPermission> userPermissions;
120
121
122 private SchemaManager schemaManager;
123
124 private Set<Dn> chopBeforeExclusions;
125 private Set<Dn> chopAfterExclusions;
126 private SubtreeSpecificationModifier ssModifier = null;
127
128 private ComponentsMonitor mainACIItemComponentsMonitor;
129 private ComponentsMonitor itemPermissionComponentsMonitor;
130 private ComponentsMonitor userPermissionComponentsMonitor;
131 private ComponentsMonitor subtreeSpecificationComponentsMonitor;
132
133
134
135
136
137
138
139
140
141 public void init( SchemaManager schemaManager )
142 {
143 this.schemaManager = schemaManager;
144 }
145
146
147
148
149 public void setNormalizer(NameComponentNormalizer normalizer)
150 {
151 this.normalizer = normalizer;
152 }
153
154 private int token2Integer( Token token ) throws RecognitionException
155 {
156 int i = 0;
157
158 try
159 {
160 i = Integer.parseInt( token.getText());
161 }
162 catch ( NumberFormatException e )
163 {
164 throw new RecognitionException( "Value of INTEGER token " +
165 token.getText() +
166 " cannot be converted to an Integer" );
167 }
168
169 return i;
170 }
171
172 protected AntlrACIItemParser(TokenBuffer tokenBuf, int k) {
173 super(tokenBuf,k);
174 tokenNames = _tokenNames;
175 }
176
177 public AntlrACIItemParser(TokenBuffer tokenBuf) {
178 this(tokenBuf,1);
179 }
180
181 protected AntlrACIItemParser(TokenStream lexer, int k) {
182 super(lexer,k);
183 tokenNames = _tokenNames;
184 }
185
186 public AntlrACIItemParser(TokenStream lexer) {
187 this(lexer,1);
188 }
189
190 public AntlrACIItemParser(ParserSharedInputState state) {
191 super(state,1);
192 tokenNames = _tokenNames;
193 }
194
195 public final ACIItem wrapperEntryPoint() throws RecognitionException, TokenStreamException {
196 ACIItem aciItem ;
197
198
199 log.debug( "entered wrapperEntryPoint()" );
200 aciItem = null;
201
202
203 {
204 _loop3:
205 do {
206 if ((LA(1)==SP)) {
207 match(SP);
208 }
209 else {
210 break _loop3;
211 }
212
213 } while (true);
214 }
215 aciItem=theACIItem();
216 {
217 _loop5:
218 do {
219 if ((LA(1)==SP)) {
220 match(SP);
221 }
222 else {
223 break _loop5;
224 }
225
226 } while (true);
227 }
228 match(Token.EOF_TYPE);
229 return aciItem ;
230 }
231
232 public final ACIItem theACIItem() throws RecognitionException, TokenStreamException {
233 ACIItem aciItem ;
234
235
236 log.debug( "entered theACIItem()" );
237 aciItem = null;
238 mainACIItemComponentsMonitor = new MandatoryComponentsMonitor(
239 new String [] { "identificationTag", "precedence", "authenticationLevel", "itemOrUserFirst" } );
240
241
242 match(OPEN_CURLY);
243 {
244 _loop8:
245 do {
246 if ((LA(1)==SP)) {
247 match(SP);
248 }
249 else {
250 break _loop8;
251 }
252
253 } while (true);
254 }
255 mainACIItemComponent();
256 {
257 _loop10:
258 do {
259 if ((LA(1)==SP)) {
260 match(SP);
261 }
262 else {
263 break _loop10;
264 }
265
266 } while (true);
267 }
268 {
269 _loop16:
270 do {
271 if ((LA(1)==SEP)) {
272 match(SEP);
273 {
274 _loop13:
275 do {
276 if ((LA(1)==SP)) {
277 match(SP);
278 }
279 else {
280 break _loop13;
281 }
282
283 } while (true);
284 }
285 mainACIItemComponent();
286 {
287 _loop15:
288 do {
289 if ((LA(1)==SP)) {
290 match(SP);
291 }
292 else {
293 break _loop15;
294 }
295
296 } while (true);
297 }
298 }
299 else {
300 break _loop16;
301 }
302
303 } while (true);
304 }
305 match(CLOSE_CURLY);
306
307 if ( !mainACIItemComponentsMonitor.finalStateValid() )
308 {
309 throw new RecognitionException( "Missing mandatory ACIItem components: "
310 + mainACIItemComponentsMonitor.getRemainingComponents() );
311 }
312
313 if ( isItemFirstACIItem )
314 {
315 aciItem = new ItemFirstACIItem(
316 identificationTag,
317 aciPrecedence,
318 authenticationLevel,
319 protectedItems,
320 itemPermissions );
321 }
322 else
323 {
324 aciItem = new UserFirstACIItem(
325 identificationTag,
326 aciPrecedence,
327 authenticationLevel,
328 userClasses,
329 userPermissions );
330 }
331
332 return aciItem ;
333 }
334
335 public final void mainACIItemComponent() throws RecognitionException, TokenStreamException {
336
337
338 log.debug( "entered mainACIItemComponent()" );
339
340
341 try {
342 switch ( LA(1)) {
343 case ID_identificationTag:
344 {
345 aci_identificationTag();
346
347 mainACIItemComponentsMonitor.useComponent( "identificationTag" );
348
349 break;
350 }
351 case ID_precedence:
352 {
353 aci_precedence();
354
355 mainACIItemComponentsMonitor.useComponent( "precedence" );
356
357 break;
358 }
359 case ID_authenticationLevel:
360 {
361 aci_authenticationLevel();
362
363 mainACIItemComponentsMonitor.useComponent( "authenticationLevel" );
364
365 break;
366 }
367 case ID_itemOrUserFirst:
368 {
369 aci_itemOrUserFirst();
370
371 mainACIItemComponentsMonitor.useComponent( "itemOrUserFirst" );
372
373 break;
374 }
375 default:
376 {
377 throw new NoViableAltException(LT(1), getFilename());
378 }
379 }
380 }
381 catch (IllegalArgumentException e) {
382
383 throw new RecognitionException( e.getMessage() );
384
385 }
386 }
387
388 public final void aci_identificationTag() throws RecognitionException, TokenStreamException {
389
390 Token token = null;
391
392 log.debug( "entered aci_identificationTag()" );
393
394
395 match(ID_identificationTag);
396 {
397 int _cnt20=0;
398 _loop20:
399 do {
400 if ((LA(1)==SP)) {
401 match(SP);
402 }
403 else {
404 if ( _cnt20>=1 ) { break _loop20; } else {throw new NoViableAltException(LT(1), getFilename());}
405 }
406
407 _cnt20++;
408 } while (true);
409 }
410 token = LT(1);
411 match(SAFEUTF8STRING);
412
413 identificationTag = token.getText();
414
415 }
416
417 public final void aci_precedence() throws RecognitionException, TokenStreamException {
418
419
420 log.debug( "entered aci_precedence()" );
421
422
423 precedence();
424
425 aciPrecedence = Integer.valueOf( precedence );
426 precedence = null;
427
428 }
429
430 public final void aci_authenticationLevel() throws RecognitionException, TokenStreamException {
431
432
433 log.debug( "entered aci_authenticationLevel()" );
434
435
436 match(ID_authenticationLevel);
437 {
438 int _cnt27=0;
439 _loop27:
440 do {
441 if ((LA(1)==SP)) {
442 match(SP);
443 }
444 else {
445 if ( _cnt27>=1 ) { break _loop27; } else {throw new NoViableAltException(LT(1), getFilename());}
446 }
447
448 _cnt27++;
449 } while (true);
450 }
451 authenticationLevel();
452 }
453
454 public final void aci_itemOrUserFirst() throws RecognitionException, TokenStreamException {
455
456
457 log.debug( "entered aci_itemOrUserFirst()" );
458
459
460 match(ID_itemOrUserFirst);
461 {
462 int _cnt31=0;
463 _loop31:
464 do {
465 if ((LA(1)==SP)) {
466 match(SP);
467 }
468 else {
469 if ( _cnt31>=1 ) { break _loop31; } else {throw new NoViableAltException(LT(1), getFilename());}
470 }
471
472 _cnt31++;
473 } while (true);
474 }
475 itemOrUserFirst();
476 }
477
478 public final void precedence() throws RecognitionException, TokenStreamException {
479
480 Token token = null;
481
482 log.debug( "entered precedence()" );
483
484
485 match(ID_precedence);
486 {
487 int _cnt24=0;
488 _loop24:
489 do {
490 if ((LA(1)==SP)) {
491 match(SP);
492 }
493 else {
494 if ( _cnt24>=1 ) { break _loop24; } else {throw new NoViableAltException(LT(1), getFilename());}
495 }
496
497 _cnt24++;
498 } while (true);
499 }
500 token = LT(1);
501 match(INTEGER);
502
503 precedence = Integer.valueOf( token2Integer( token ) );
504
505 if ( ( precedence < 0 ) || ( precedence > 255 ) )
506 {
507 throw new RecognitionException( "Expecting INTEGER token having an Integer value between 0 and 255, found " + precedence );
508 }
509
510 }
511
512 public final void authenticationLevel() throws RecognitionException, TokenStreamException {
513
514
515 log.debug( "entered authenticationLevel()" );
516
517
518 switch ( LA(1)) {
519 case ID_none:
520 {
521 match(ID_none);
522
523 authenticationLevel = AuthenticationLevel.NONE;
524
525 break;
526 }
527 case ID_simple:
528 {
529 match(ID_simple);
530
531 authenticationLevel = AuthenticationLevel.SIMPLE;
532
533 break;
534 }
535 case ID_strong:
536 {
537 match(ID_strong);
538
539 authenticationLevel = AuthenticationLevel.STRONG;
540
541 break;
542 }
543 default:
544 {
545 throw new NoViableAltException(LT(1), getFilename());
546 }
547 }
548 }
549
550 public final void itemOrUserFirst() throws RecognitionException, TokenStreamException {
551
552
553 log.debug( "entered itemOrUserFirst()" );
554
555
556 switch ( LA(1)) {
557 case ID_itemFirst:
558 {
559 itemFirst();
560 break;
561 }
562 case ID_userFirst:
563 {
564 userFirst();
565 break;
566 }
567 default:
568 {
569 throw new NoViableAltException(LT(1), getFilename());
570 }
571 }
572 }
573
574 public final void itemFirst() throws RecognitionException, TokenStreamException {
575
576
577 log.debug( "entered itemFirst()" );
578
579
580 match(ID_itemFirst);
581 {
582 _loop35:
583 do {
584 if ((LA(1)==SP)) {
585 match(SP);
586 }
587 else {
588 break _loop35;
589 }
590
591 } while (true);
592 }
593 match(COLON);
594 {
595 _loop37:
596 do {
597 if ((LA(1)==SP)) {
598 match(SP);
599 }
600 else {
601 break _loop37;
602 }
603
604 } while (true);
605 }
606 match(OPEN_CURLY);
607 {
608 _loop39:
609 do {
610 if ((LA(1)==SP)) {
611 match(SP);
612 }
613 else {
614 break _loop39;
615 }
616
617 } while (true);
618 }
619 protectedItems();
620 {
621 _loop41:
622 do {
623 if ((LA(1)==SP)) {
624 match(SP);
625 }
626 else {
627 break _loop41;
628 }
629
630 } while (true);
631 }
632 match(SEP);
633 {
634 _loop43:
635 do {
636 if ((LA(1)==SP)) {
637 match(SP);
638 }
639 else {
640 break _loop43;
641 }
642
643 } while (true);
644 }
645 itemPermissions();
646 {
647 _loop45:
648 do {
649 if ((LA(1)==SP)) {
650 match(SP);
651 }
652 else {
653 break _loop45;
654 }
655
656 } while (true);
657 }
658 match(CLOSE_CURLY);
659
660 isItemFirstACIItem = true;
661
662 }
663
664 public final void userFirst() throws RecognitionException, TokenStreamException {
665
666
667 log.debug( "entered userFirst()" );
668
669
670 match(ID_userFirst);
671 {
672 _loop48:
673 do {
674 if ((LA(1)==SP)) {
675 match(SP);
676 }
677 else {
678 break _loop48;
679 }
680
681 } while (true);
682 }
683 match(COLON);
684 {
685 _loop50:
686 do {
687 if ((LA(1)==SP)) {
688 match(SP);
689 }
690 else {
691 break _loop50;
692 }
693
694 } while (true);
695 }
696 match(OPEN_CURLY);
697 {
698 _loop52:
699 do {
700 if ((LA(1)==SP)) {
701 match(SP);
702 }
703 else {
704 break _loop52;
705 }
706
707 } while (true);
708 }
709 userClasses();
710 {
711 _loop54:
712 do {
713 if ((LA(1)==SP)) {
714 match(SP);
715 }
716 else {
717 break _loop54;
718 }
719
720 } while (true);
721 }
722 match(SEP);
723 {
724 _loop56:
725 do {
726 if ((LA(1)==SP)) {
727 match(SP);
728 }
729 else {
730 break _loop56;
731 }
732
733 } while (true);
734 }
735 userPermissions();
736 {
737 _loop58:
738 do {
739 if ((LA(1)==SP)) {
740 match(SP);
741 }
742 else {
743 break _loop58;
744 }
745
746 } while (true);
747 }
748 match(CLOSE_CURLY);
749
750 isItemFirstACIItem = false;
751
752 }
753
754 public final void protectedItems() throws RecognitionException, TokenStreamException {
755
756
757 log.debug( "entered protectedItems()" );
758 protectedItemsMap = new NoDuplicateKeysMap();
759
760
761 try {
762 match(ID_protectedItems);
763 {
764 _loop61:
765 do {
766 if ((LA(1)==SP)) {
767 match(SP);
768 }
769 else {
770 break _loop61;
771 }
772
773 } while (true);
774 }
775 match(OPEN_CURLY);
776 {
777 _loop63:
778 do {
779 if ((LA(1)==SP)) {
780 match(SP);
781 }
782 else {
783 break _loop63;
784 }
785
786 } while (true);
787 }
788 {
789 switch ( LA(1)) {
790 case ATTRIBUTE_VALUE_CANDIDATE:
791 case RANGE_OF_VALUES_CANDIDATE:
792 case ID_entry:
793 case ID_allUserAttributeTypes:
794 case ID_attributeType:
795 case ID_allAttributeValues:
796 case ID_allUserAttributeTypesAndValues:
797 case ID_selfValue:
798 case ID_maxValueCount:
799 case ID_maxImmSub:
800 case ID_restrictedBy:
801 case ID_classes:
802 {
803 protectedItem();
804 {
805 _loop66:
806 do {
807 if ((LA(1)==SP)) {
808 match(SP);
809 }
810 else {
811 break _loop66;
812 }
813
814 } while (true);
815 }
816 {
817 _loop72:
818 do {
819 if ((LA(1)==SEP)) {
820 match(SEP);
821 {
822 _loop69:
823 do {
824 if ((LA(1)==SP)) {
825 match(SP);
826 }
827 else {
828 break _loop69;
829 }
830
831 } while (true);
832 }
833 protectedItem();
834 {
835 _loop71:
836 do {
837 if ((LA(1)==SP)) {
838 match(SP);
839 }
840 else {
841 break _loop71;
842 }
843
844 } while (true);
845 }
846 }
847 else {
848 break _loop72;
849 }
850
851 } while (true);
852 }
853 break;
854 }
855 case CLOSE_CURLY:
856 {
857 break;
858 }
859 default:
860 {
861 throw new NoViableAltException(LT(1), getFilename());
862 }
863 }
864 }
865 match(CLOSE_CURLY);
866
867 protectedItems = new HashSet<ProtectedItem>( protectedItemsMap.values() );
868
869 }
870 catch (IllegalArgumentException e) {
871
872 throw new RecognitionException( "Protected Items cannot be duplicated. " + e.getMessage() );
873
874 }
875 }
876
877 public final void itemPermissions() throws RecognitionException, TokenStreamException {
878
879
880 log.debug( "entered itemPermissions()" );
881 itemPermissions = new HashSet<ItemPermission>();
882 ItemPermission itemPermission = null;
883
884
885 match(ID_itemPermissions);
886 {
887 int _cnt177=0;
888 _loop177:
889 do {
890 if ((LA(1)==SP)) {
891 match(SP);
892 }
893 else {
894 if ( _cnt177>=1 ) { break _loop177; } else {throw new NoViableAltException(LT(1), getFilename());}
895 }
896
897 _cnt177++;
898 } while (true);
899 }
900 match(OPEN_CURLY);
901 {
902 _loop179:
903 do {
904 if ((LA(1)==SP)) {
905 match(SP);
906 }
907 else {
908 break _loop179;
909 }
910
911 } while (true);
912 }
913 {
914 switch ( LA(1)) {
915 case OPEN_CURLY:
916 {
917 itemPermission=itemPermission();
918 {
919 _loop182:
920 do {
921 if ((LA(1)==SP)) {
922 match(SP);
923 }
924 else {
925 break _loop182;
926 }
927
928 } while (true);
929 }
930
931 itemPermissions.add( itemPermission );
932
933 {
934 _loop188:
935 do {
936 if ((LA(1)==SEP)) {
937 match(SEP);
938 {
939 _loop185:
940 do {
941 if ((LA(1)==SP)) {
942 match(SP);
943 }
944 else {
945 break _loop185;
946 }
947
948 } while (true);
949 }
950 itemPermission=itemPermission();
951 {
952 _loop187:
953 do {
954 if ((LA(1)==SP)) {
955 match(SP);
956 }
957 else {
958 break _loop187;
959 }
960
961 } while (true);
962 }
963
964 itemPermissions.add( itemPermission );
965
966 }
967 else {
968 break _loop188;
969 }
970
971 } while (true);
972 }
973 break;
974 }
975 case CLOSE_CURLY:
976 {
977 break;
978 }
979 default:
980 {
981 throw new NoViableAltException(LT(1), getFilename());
982 }
983 }
984 }
985 match(CLOSE_CURLY);
986 }
987
988 public final void userClasses() throws RecognitionException, TokenStreamException {
989
990
991 log.debug( "entered userClasses()" );
992 userClassesMap = new NoDuplicateKeysMap();
993
994
995 try {
996 match(ID_userClasses);
997 {
998 int _cnt218=0;
999 _loop218:
1000 do {
1001 if ((LA(1)==SP)) {
1002 match(SP);
1003 }
1004 else {
1005 if ( _cnt218>=1 ) { break _loop218; } else {throw new NoViableAltException(LT(1), getFilename());}
1006 }
1007
1008 _cnt218++;
1009 } while (true);
1010 }
1011 match(OPEN_CURLY);
1012 {
1013 _loop220:
1014 do {
1015 if ((LA(1)==SP)) {
1016 match(SP);
1017 }
1018 else {
1019 break _loop220;
1020 }
1021
1022 } while (true);
1023 }
1024 {
1025 switch ( LA(1)) {
1026 case ID_allUsers:
1027 case ID_thisEntry:
1028 case ID_parentOfEntry:
1029 case ID_name:
1030 case ID_userGroup:
1031 case ID_subtree:
1032 {
1033 userClass();
1034 {
1035 _loop223:
1036 do {
1037 if ((LA(1)==SP)) {
1038 match(SP);
1039 }
1040 else {
1041 break _loop223;
1042 }
1043
1044 } while (true);
1045 }
1046 {
1047 _loop229:
1048 do {
1049 if ((LA(1)==SEP)) {
1050 match(SEP);
1051 {
1052 _loop226:
1053 do {
1054 if ((LA(1)==SP)) {
1055 match(SP);
1056 }
1057 else {
1058 break _loop226;
1059 }
1060
1061 } while (true);
1062 }
1063 userClass();
1064 {
1065 _loop228:
1066 do {
1067 if ((LA(1)==SP)) {
1068 match(SP);
1069 }
1070 else {
1071 break _loop228;
1072 }
1073
1074 } while (true);
1075 }
1076 }
1077 else {
1078 break _loop229;
1079 }
1080
1081 } while (true);
1082 }
1083 break;
1084 }
1085 case CLOSE_CURLY:
1086 {
1087 break;
1088 }
1089 default:
1090 {
1091 throw new NoViableAltException(LT(1), getFilename());
1092 }
1093 }
1094 }
1095 match(CLOSE_CURLY);
1096
1097 userClasses = new HashSet<UserClass>( userClassesMap.values() );
1098
1099 }
1100 catch (IllegalArgumentException e) {
1101
1102 throw new RecognitionException( "User Classes cannot be duplicated. " + e.getMessage() );
1103
1104 }
1105 }
1106
1107 public final void userPermissions() throws RecognitionException, TokenStreamException {
1108
1109
1110 log.debug( "entered userPermissions()" );
1111 userPermissions = new HashSet<UserPermission>();
1112 UserPermission userPermission = null;
1113
1114
1115 match(ID_userPermissions);
1116 {
1117 int _cnt275=0;
1118 _loop275:
1119 do {
1120 if ((LA(1)==SP)) {
1121 match(SP);
1122 }
1123 else {
1124 if ( _cnt275>=1 ) { break _loop275; } else {throw new NoViableAltException(LT(1), getFilename());}
1125 }
1126
1127 _cnt275++;
1128 } while (true);
1129 }
1130 match(OPEN_CURLY);
1131 {
1132 _loop277:
1133 do {
1134 if ((LA(1)==SP)) {
1135 match(SP);
1136 }
1137 else {
1138 break _loop277;
1139 }
1140
1141 } while (true);
1142 }
1143 {
1144 switch ( LA(1)) {
1145 case OPEN_CURLY:
1146 {
1147 userPermission=userPermission();
1148 {
1149 _loop280:
1150 do {
1151 if ((LA(1)==SP)) {
1152 match(SP);
1153 }
1154 else {
1155 break _loop280;
1156 }
1157
1158 } while (true);
1159 }
1160
1161 userPermissions.add( userPermission );
1162
1163 {
1164 _loop286:
1165 do {
1166 if ((LA(1)==SEP)) {
1167 match(SEP);
1168 {
1169 _loop283:
1170 do {
1171 if ((LA(1)==SP)) {
1172 match(SP);
1173 }
1174 else {
1175 break _loop283;
1176 }
1177
1178 } while (true);
1179 }
1180 userPermission=userPermission();
1181 {
1182 _loop285:
1183 do {
1184 if ((LA(1)==SP)) {
1185 match(SP);
1186 }
1187 else {
1188 break _loop285;
1189 }
1190
1191 } while (true);
1192 }
1193
1194 userPermissions.add( userPermission );
1195
1196 }
1197 else {
1198 break _loop286;
1199 }
1200
1201 } while (true);
1202 }
1203 break;
1204 }
1205 case CLOSE_CURLY:
1206 {
1207 break;
1208 }
1209 default:
1210 {
1211 throw new NoViableAltException(LT(1), getFilename());
1212 }
1213 }
1214 }
1215 match(CLOSE_CURLY);
1216 }
1217
1218 public final void protectedItem() throws RecognitionException, TokenStreamException {
1219
1220
1221 log.debug( "entered protectedItem()" );
1222
1223
1224 switch ( LA(1)) {
1225 case ID_entry:
1226 {
1227 entry();
1228 break;
1229 }
1230 case ID_allUserAttributeTypes:
1231 {
1232 allUserAttributeTypes();
1233 break;
1234 }
1235 case ID_attributeType:
1236 {
1237 attributeType();
1238 break;
1239 }
1240 case ID_allAttributeValues:
1241 {
1242 allAttributeValues();
1243 break;
1244 }
1245 case ID_allUserAttributeTypesAndValues:
1246 {
1247 allUserAttributeTypesAndValues();
1248 break;
1249 }
1250 case ATTRIBUTE_VALUE_CANDIDATE:
1251 {
1252 attributeValue();
1253 break;
1254 }
1255 case ID_selfValue:
1256 {
1257 selfValue();
1258 break;
1259 }
1260 case RANGE_OF_VALUES_CANDIDATE:
1261 {
1262 rangeOfValues();
1263 break;
1264 }
1265 case ID_maxValueCount:
1266 {
1267 maxValueCount();
1268 break;
1269 }
1270 case ID_maxImmSub:
1271 {
1272 maxImmSub();
1273 break;
1274 }
1275 case ID_restrictedBy:
1276 {
1277 restrictedBy();
1278 break;
1279 }
1280 case ID_classes:
1281 {
1282 classes();
1283 break;
1284 }
1285 default:
1286 {
1287 throw new NoViableAltException(LT(1), getFilename());
1288 }
1289 }
1290 }
1291
1292 public final void entry() throws RecognitionException, TokenStreamException {
1293
1294
1295 log.debug( "entered entry()" );
1296
1297
1298 match(ID_entry);
1299
1300 protectedItemsMap.put( "entry", ProtectedItem.ENTRY );
1301
1302 }
1303
1304 public final void allUserAttributeTypes() throws RecognitionException, TokenStreamException {
1305
1306
1307 log.debug( "entered allUserAttributeTypes()" );
1308
1309
1310 match(ID_allUserAttributeTypes);
1311
1312 protectedItemsMap.put( "allUserAttributeTypes", ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
1313
1314 }
1315
1316 public final void attributeType() throws RecognitionException, TokenStreamException {
1317
1318
1319 log.debug( "entered attributeType()" );
1320 Set<AttributeType> attributeTypeSet = null;
1321
1322
1323 match(ID_attributeType);
1324 {
1325 int _cnt78=0;
1326 _loop78:
1327 do {
1328 if ((LA(1)==SP)) {
1329 match(SP);
1330 }
1331 else {
1332 if ( _cnt78>=1 ) { break _loop78; } else {throw new NoViableAltException(LT(1), getFilename());}
1333 }
1334
1335 _cnt78++;
1336 } while (true);
1337 }
1338 attributeTypeSet=attributeTypeSet();
1339
1340 protectedItemsMap.put( "attributeType", new AttributeTypeItem(attributeTypeSet ) );
1341
1342 }
1343
1344 public final void allAttributeValues() throws RecognitionException, TokenStreamException {
1345
1346
1347 log.debug( "entered allAttributeValues()" );
1348 Set<AttributeType> attributeTypeSet = null;
1349
1350
1351 match(ID_allAttributeValues);
1352 {
1353 int _cnt81=0;
1354 _loop81:
1355 do {
1356 if ((LA(1)==SP)) {
1357 match(SP);
1358 }
1359 else {
1360 if ( _cnt81>=1 ) { break _loop81; } else {throw new NoViableAltException(LT(1), getFilename());}
1361 }
1362
1363 _cnt81++;
1364 } while (true);
1365 }
1366 attributeTypeSet=attributeTypeSet();
1367
1368 protectedItemsMap.put( "allAttributeValues", new AllAttributeValuesItem( attributeTypeSet ) );
1369
1370 }
1371
1372 public final void allUserAttributeTypesAndValues() throws RecognitionException, TokenStreamException {
1373
1374
1375 log.debug( "entered allUserAttributeTypesAndValues()" );
1376
1377
1378 match(ID_allUserAttributeTypesAndValues);
1379
1380 protectedItemsMap.put( "allUserAttributeTypesAndValues", ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
1381
1382 }
1383
1384 public final void attributeValue() throws RecognitionException, TokenStreamException {
1385
1386 Token token = null;
1387
1388 log.debug( "entered attributeValue()" );
1389 String attributeTypeAndValue = null;
1390 String attributeType = null;
1391 String attributeValue = null;
1392 Set<Attribute> attributeSet = new HashSet<Attribute>();
1393
1394
1395 try {
1396 token = LT(1);
1397 match(ATTRIBUTE_VALUE_CANDIDATE);
1398
1399
1400
1401 Dn attributeTypeAndValueSetAsDn = new Dn( token.getText() );
1402
1403 if ( schemaManager != null )
1404 {
1405 attributeTypeAndValueSetAsDn.apply( schemaManager );
1406 }
1407
1408 for ( Rdn rdn : attributeTypeAndValueSetAsDn )
1409 {
1410 attributeTypeAndValue = rdn.getNormName();
1411 attributeType = DnUtils.getRdnAttributeType( attributeTypeAndValue );
1412 attributeValue = DnUtils.getRdnValue( attributeTypeAndValue );
1413
1414 attributeSet.add( new DefaultAttribute( attributeType, attributeValue ) );
1415 log.debug( "An attributeTypeAndValue from the set: " + attributeType + "=" + attributeValue);
1416 }
1417
1418 protectedItemsMap.put( "attributeValue", new AttributeValueItem( attributeSet ) );
1419
1420 }
1421 catch (Exception e) {
1422
1423 throw new RecognitionException( "dnParser failed for " + token.getText() + " , " + e.getMessage() );
1424
1425 }
1426 }
1427
1428 public final void selfValue() throws RecognitionException, TokenStreamException {
1429
1430
1431 log.debug( "entered selfValue()" );
1432 Set<AttributeType> attributeTypeSet = null;
1433
1434
1435 match(ID_selfValue);
1436 {
1437 int _cnt86=0;
1438 _loop86:
1439 do {
1440 if ((LA(1)==SP)) {
1441 match(SP);
1442 }
1443 else {
1444 if ( _cnt86>=1 ) { break _loop86; } else {throw new NoViableAltException(LT(1), getFilename());}
1445 }
1446
1447 _cnt86++;
1448 } while (true);
1449 }
1450 attributeTypeSet=attributeTypeSet();
1451
1452 protectedItemsMap.put( "sefValue", new SelfValueItem( attributeTypeSet ) );
1453
1454 }
1455
1456 public final void rangeOfValues() throws RecognitionException, TokenStreamException {
1457
1458 Token token = null;
1459
1460 log.debug( "entered rangeOfValues()" );
1461
1462
1463 try {
1464 token = LT(1);
1465 match(RANGE_OF_VALUES_CANDIDATE);
1466
1467 protectedItemsMap.put( "rangeOfValues",
1468 new RangeOfValuesItem(
1469 FilterParser.parse( token.getText() ) ) );
1470 log.debug( "filterParser parsed " + token.getText() );
1471
1472 }
1473 catch (Exception e) {
1474
1475 throw new RecognitionException( "filterParser failed. " + e.getMessage() );
1476
1477 }
1478 }
1479
1480 public final void maxValueCount() throws RecognitionException, TokenStreamException {
1481
1482
1483 log.debug( "entered maxValueCount()" );
1484 MaxValueCountElem maxValueCount = null;
1485 Set<MaxValueCountElem> maxValueCountSet = new HashSet<MaxValueCountElem>();
1486
1487
1488 match(ID_maxValueCount);
1489 {
1490 int _cnt90=0;
1491 _loop90:
1492 do {
1493 if ((LA(1)==SP)) {
1494 match(SP);
1495 }
1496 else {
1497 if ( _cnt90>=1 ) { break _loop90; } else {throw new NoViableAltException(LT(1), getFilename());}
1498 }
1499
1500 _cnt90++;
1501 } while (true);
1502 }
1503 match(OPEN_CURLY);
1504 {
1505 _loop92:
1506 do {
1507 if ((LA(1)==SP)) {
1508 match(SP);
1509 }
1510 else {
1511 break _loop92;
1512 }
1513
1514 } while (true);
1515 }
1516 maxValueCount=aMaxValueCount();
1517 {
1518 _loop94:
1519 do {
1520 if ((LA(1)==SP)) {
1521 match(SP);
1522 }
1523 else {
1524 break _loop94;
1525 }
1526
1527 } while (true);
1528 }
1529
1530 maxValueCountSet.add( maxValueCount );
1531
1532 {
1533 _loop100:
1534 do {
1535 if ((LA(1)==SEP)) {
1536 match(SEP);
1537 {
1538 _loop97:
1539 do {
1540 if ((LA(1)==SP)) {
1541 match(SP);
1542 }
1543 else {
1544 break _loop97;
1545 }
1546
1547 } while (true);
1548 }
1549 maxValueCount=aMaxValueCount();
1550 {
1551 _loop99:
1552 do {
1553 if ((LA(1)==SP)) {
1554 match(SP);
1555 }
1556 else {
1557 break _loop99;
1558 }
1559
1560 } while (true);
1561 }
1562
1563 maxValueCountSet.add( maxValueCount );
1564
1565 }
1566 else {
1567 break _loop100;
1568 }
1569
1570 } while (true);
1571 }
1572 match(CLOSE_CURLY);
1573
1574 protectedItemsMap.put( "maxValueCount", new MaxValueCountItem( maxValueCountSet ) );
1575
1576 }
1577
1578 public final void maxImmSub() throws RecognitionException, TokenStreamException {
1579
1580 Token token = null;
1581
1582 log.debug( "entered maxImmSub()" );
1583
1584
1585 match(ID_maxImmSub);
1586 {
1587 int _cnt125=0;
1588 _loop125:
1589 do {
1590 if ((LA(1)==SP)) {
1591 match(SP);
1592 }
1593 else {
1594 if ( _cnt125>=1 ) { break _loop125; } else {throw new NoViableAltException(LT(1), getFilename());}
1595 }
1596
1597 _cnt125++;
1598 } while (true);
1599 }
1600 token = LT(1);
1601 match(INTEGER);
1602
1603
1604 protectedItemsMap.put( "maxImmSub",
1605 new MaxImmSubItem(
1606 token2Integer( token ) ) );
1607
1608 }
1609
1610 public final void restrictedBy() throws RecognitionException, TokenStreamException {
1611
1612
1613 log.debug( "entered restrictedBy()" );
1614 RestrictedByElem restrictedValue = null;
1615 Set<RestrictedByElem> restrictedBy = new HashSet<RestrictedByElem>();
1616
1617
1618 match(ID_restrictedBy);
1619 {
1620 int _cnt128=0;
1621 _loop128:
1622 do {
1623 if ((LA(1)==SP)) {
1624 match(SP);
1625 }
1626 else {
1627 if ( _cnt128>=1 ) { break _loop128; } else {throw new NoViableAltException(LT(1), getFilename());}
1628 }
1629
1630 _cnt128++;
1631 } while (true);
1632 }
1633 match(OPEN_CURLY);
1634 {
1635 _loop130:
1636 do {
1637 if ((LA(1)==SP)) {
1638 match(SP);
1639 }
1640 else {
1641 break _loop130;
1642 }
1643
1644 } while (true);
1645 }
1646 restrictedValue=restrictedValue();
1647 {
1648 _loop132:
1649 do {
1650 if ((LA(1)==SP)) {
1651 match(SP);
1652 }
1653 else {
1654 break _loop132;
1655 }
1656
1657 } while (true);
1658 }
1659
1660 restrictedBy.add( restrictedValue );
1661
1662 {
1663 _loop138:
1664 do {
1665 if ((LA(1)==SEP)) {
1666 match(SEP);
1667 {
1668 _loop135:
1669 do {
1670 if ((LA(1)==SP)) {
1671 match(SP);
1672 }
1673 else {
1674 break _loop135;
1675 }
1676
1677 } while (true);
1678 }
1679 restrictedValue=restrictedValue();
1680 {
1681 _loop137:
1682 do {
1683 if ((LA(1)==SP)) {
1684 match(SP);
1685 }
1686 else {
1687 break _loop137;
1688 }
1689
1690 } while (true);
1691 }
1692
1693 restrictedBy.add( restrictedValue );
1694
1695 }
1696 else {
1697 break _loop138;
1698 }
1699
1700 } while (true);
1701 }
1702 match(CLOSE_CURLY);
1703
1704 protectedItemsMap.put( "restrictedBy", new RestrictedByItem( restrictedBy ) );
1705
1706 }
1707
1708 public final void classes() throws RecognitionException, TokenStreamException {
1709
1710
1711 log.debug( "entered classes()" );
1712 ExprNode classes = null;
1713
1714
1715 match(ID_classes);
1716 {
1717 int _cnt174=0;
1718 _loop174:
1719 do {
1720 if ((LA(1)==SP)) {
1721 match(SP);
1722 }
1723 else {
1724 if ( _cnt174>=1 ) { break _loop174; } else {throw new NoViableAltException(LT(1), getFilename());}
1725 }
1726
1727 _cnt174++;
1728 } while (true);
1729 }
1730 classes=refinement();
1731
1732 protectedItemsMap.put( "classes", new ClassesItem( classes ) );
1733
1734 }
1735
1736 public final Set<AttributeType> attributeTypeSet() throws RecognitionException, TokenStreamException {
1737 Set<AttributeType> attributeTypeSet ;
1738
1739
1740 log.debug( "entered attributeTypeSet()" );
1741 String oid = null;
1742 attributeTypeSet = new HashSet<AttributeType>();
1743 AttributeType attributeType = null;
1744
1745
1746 match(OPEN_CURLY);
1747 {
1748 _loop163:
1749 do {
1750 if ((LA(1)==SP)) {
1751 match(SP);
1752 }
1753 else {
1754 break _loop163;
1755 }
1756
1757 } while (true);
1758 }
1759 oid=oid();
1760 {
1761 _loop165:
1762 do {
1763 if ((LA(1)==SP)) {
1764 match(SP);
1765 }
1766 else {
1767 break _loop165;
1768 }
1769
1770 } while (true);
1771 }
1772
1773 try
1774 {
1775 if ( schemaManager != null )
1776 {
1777 attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
1778 }
1779 else
1780 {
1781 attributeType = new AttributeType( oid );
1782 }
1783
1784 attributeTypeSet.add( attributeType );
1785 }
1786 catch ( LdapException le )
1787 {
1788
1789
1790 }
1791
1792 {
1793 _loop171:
1794 do {
1795 if ((LA(1)==SEP)) {
1796 match(SEP);
1797 {
1798 _loop168:
1799 do {
1800 if ((LA(1)==SP)) {
1801 match(SP);
1802 }
1803 else {
1804 break _loop168;
1805 }
1806
1807 } while (true);
1808 }
1809 oid=oid();
1810 {
1811 _loop170:
1812 do {
1813 if ((LA(1)==SP)) {
1814 match(SP);
1815 }
1816 else {
1817 break _loop170;
1818 }
1819
1820 } while (true);
1821 }
1822
1823 try
1824 {
1825 if ( schemaManager != null )
1826 {
1827 attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
1828 }
1829 else
1830 {
1831 attributeType = new AttributeType( oid );
1832 }
1833
1834 attributeTypeSet.add( attributeType );
1835 }
1836 catch ( LdapException le )
1837 {
1838
1839
1840 }
1841
1842 }
1843 else {
1844 break _loop171;
1845 }
1846
1847 } while (true);
1848 }
1849 match(CLOSE_CURLY);
1850 return attributeTypeSet ;
1851 }
1852
1853 public final MaxValueCountElem aMaxValueCount() throws RecognitionException, TokenStreamException {
1854 MaxValueCountElem maxValueCount ;
1855
1856 Token token1 = null;
1857 Token token2 = null;
1858
1859 log.debug( "entered aMaxValueCount()" );
1860 maxValueCount = null;
1861 String oid = null;
1862 Token token = null;
1863 AttributeType attributeType = null;
1864
1865
1866 match(OPEN_CURLY);
1867 {
1868 _loop103:
1869 do {
1870 if ((LA(1)==SP)) {
1871 match(SP);
1872 }
1873 else {
1874 break _loop103;
1875 }
1876
1877 } while (true);
1878 }
1879 {
1880 switch ( LA(1)) {
1881 case ID_type:
1882 {
1883 match(ID_type);
1884 {
1885 int _cnt106=0;
1886 _loop106:
1887 do {
1888 if ((LA(1)==SP)) {
1889 match(SP);
1890 }
1891 else {
1892 if ( _cnt106>=1 ) { break _loop106; } else {throw new NoViableAltException(LT(1), getFilename());}
1893 }
1894
1895 _cnt106++;
1896 } while (true);
1897 }
1898 oid=oid();
1899 {
1900 _loop108:
1901 do {
1902 if ((LA(1)==SP)) {
1903 match(SP);
1904 }
1905 else {
1906 break _loop108;
1907 }
1908
1909 } while (true);
1910 }
1911 match(SEP);
1912 {
1913 _loop110:
1914 do {
1915 if ((LA(1)==SP)) {
1916 match(SP);
1917 }
1918 else {
1919 break _loop110;
1920 }
1921
1922 } while (true);
1923 }
1924 match(ID_maxCount);
1925 {
1926 int _cnt112=0;
1927 _loop112:
1928 do {
1929 if ((LA(1)==SP)) {
1930 match(SP);
1931 }
1932 else {
1933 if ( _cnt112>=1 ) { break _loop112; } else {throw new NoViableAltException(LT(1), getFilename());}
1934 }
1935
1936 _cnt112++;
1937 } while (true);
1938 }
1939 token1 = LT(1);
1940 match(INTEGER);
1941 token = token1;
1942 break;
1943 }
1944 case ID_maxCount:
1945 {
1946 match(ID_maxCount);
1947 {
1948 int _cnt114=0;
1949 _loop114:
1950 do {
1951 if ((LA(1)==SP)) {
1952 match(SP);
1953 }
1954 else {
1955 if ( _cnt114>=1 ) { break _loop114; } else {throw new NoViableAltException(LT(1), getFilename());}
1956 }
1957
1958 _cnt114++;
1959 } while (true);
1960 }
1961 token2 = LT(1);
1962 match(INTEGER);
1963 {
1964 _loop116:
1965 do {
1966 if ((LA(1)==SP)) {
1967 match(SP);
1968 }
1969 else {
1970 break _loop116;
1971 }
1972
1973 } while (true);
1974 }
1975 match(SEP);
1976 {
1977 _loop118:
1978 do {
1979 if ((LA(1)==SP)) {
1980 match(SP);
1981 }
1982 else {
1983 break _loop118;
1984 }
1985
1986 } while (true);
1987 }
1988 match(ID_type);
1989 {
1990 int _cnt120=0;
1991 _loop120:
1992 do {
1993 if ((LA(1)==SP)) {
1994 match(SP);
1995 }
1996 else {
1997 if ( _cnt120>=1 ) { break _loop120; } else {throw new NoViableAltException(LT(1), getFilename());}
1998 }
1999
2000 _cnt120++;
2001 } while (true);
2002 }
2003 oid=oid();
2004 token = token2;
2005 break;
2006 }
2007 default:
2008 {
2009 throw new NoViableAltException(LT(1), getFilename());
2010 }
2011 }
2012 }
2013 {
2014 _loop122:
2015 do {
2016 if ((LA(1)==SP)) {
2017 match(SP);
2018 }
2019 else {
2020 break _loop122;
2021 }
2022
2023 } while (true);
2024 }
2025 match(CLOSE_CURLY);
2026
2027 try
2028 {
2029 if ( schemaManager != null )
2030 {
2031 attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
2032 }
2033 else
2034 {
2035 attributeType = new AttributeType( oid );
2036 }
2037
2038 maxValueCount = new MaxValueCountElem( attributeType, token2Integer( token ) );
2039 }
2040 catch ( LdapException le )
2041 {
2042
2043
2044 }
2045
2046 return maxValueCount ;
2047 }
2048
2049 public final String oid() throws RecognitionException, TokenStreamException {
2050 String result ;
2051
2052
2053 log.debug( "entered oid()" );
2054 result = null;
2055 Token token = null;
2056
2057
2058 token = LT( 1 );
2059 {
2060 switch ( LA(1)) {
2061 case DESCR:
2062 {
2063 match(DESCR);
2064 break;
2065 }
2066 case NUMERICOID:
2067 {
2068 match(NUMERICOID);
2069 break;
2070 }
2071 default:
2072 {
2073 throw new NoViableAltException(LT(1), getFilename());
2074 }
2075 }
2076 }
2077
2078 result = token.getText();
2079 log.debug( "recognized an oid: " + result );
2080
2081 return result ;
2082 }
2083
2084 public final RestrictedByElem restrictedValue() throws RecognitionException, TokenStreamException {
2085 RestrictedByElem restrictedValue ;
2086
2087
2088 log.debug( "entered restrictedValue()" );
2089 String typeOid = null;
2090 String valuesInOid = null;
2091 restrictedValue = null;
2092 AttributeType attributeType = null;
2093 AttributeType valueInAttributeType = null;
2094
2095
2096 match(OPEN_CURLY);
2097 {
2098 _loop141:
2099 do {
2100 if ((LA(1)==SP)) {
2101 match(SP);
2102 }
2103 else {
2104 break _loop141;
2105 }
2106
2107 } while (true);
2108 }
2109 {
2110 switch ( LA(1)) {
2111 case ID_type:
2112 {
2113 match(ID_type);
2114 {
2115 int _cnt144=0;
2116 _loop144:
2117 do {
2118 if ((LA(1)==SP)) {
2119 match(SP);
2120 }
2121 else {
2122 if ( _cnt144>=1 ) { break _loop144; } else {throw new NoViableAltException(LT(1), getFilename());}
2123 }
2124
2125 _cnt144++;
2126 } while (true);
2127 }
2128 typeOid=oid();
2129 {
2130 _loop146:
2131 do {
2132 if ((LA(1)==SP)) {
2133 match(SP);
2134 }
2135 else {
2136 break _loop146;
2137 }
2138
2139 } while (true);
2140 }
2141 match(SEP);
2142 {
2143 _loop148:
2144 do {
2145 if ((LA(1)==SP)) {
2146 match(SP);
2147 }
2148 else {
2149 break _loop148;
2150 }
2151
2152 } while (true);
2153 }
2154 match(ID_valuesIn);
2155 {
2156 int _cnt150=0;
2157 _loop150:
2158 do {
2159 if ((LA(1)==SP)) {
2160 match(SP);
2161 }
2162 else {
2163 if ( _cnt150>=1 ) { break _loop150; } else {throw new NoViableAltException(LT(1), getFilename());}
2164 }
2165
2166 _cnt150++;
2167 } while (true);
2168 }
2169 valuesInOid=oid();
2170 break;
2171 }
2172 case ID_valuesIn:
2173 {
2174 match(ID_valuesIn);
2175 {
2176 int _cnt152=0;
2177 _loop152:
2178 do {
2179 if ((LA(1)==SP)) {
2180 match(SP);
2181 }
2182 else {
2183 if ( _cnt152>=1 ) { break _loop152; } else {throw new NoViableAltException(LT(1), getFilename());}
2184 }
2185
2186 _cnt152++;
2187 } while (true);
2188 }
2189 valuesInOid=oid();
2190 {
2191 _loop154:
2192 do {
2193 if ((LA(1)==SP)) {
2194 match(SP);
2195 }
2196 else {
2197 break _loop154;
2198 }
2199
2200 } while (true);
2201 }
2202 match(SEP);
2203 {
2204 _loop156:
2205 do {
2206 if ((LA(1)==SP)) {
2207 match(SP);
2208 }
2209 else {
2210 break _loop156;
2211 }
2212
2213 } while (true);
2214 }
2215 match(ID_type);
2216 {
2217 int _cnt158=0;
2218 _loop158:
2219 do {
2220 if ((LA(1)==SP)) {
2221 match(SP);
2222 }
2223 else {
2224 if ( _cnt158>=1 ) { break _loop158; } else {throw new NoViableAltException(LT(1), getFilename());}
2225 }
2226
2227 _cnt158++;
2228 } while (true);
2229 }
2230 typeOid=oid();
2231 break;
2232 }
2233 default:
2234 {
2235 throw new NoViableAltException(LT(1), getFilename());
2236 }
2237 }
2238 }
2239 {
2240 _loop160:
2241 do {
2242 if ((LA(1)==SP)) {
2243 match(SP);
2244 }
2245 else {
2246 break _loop160;
2247 }
2248
2249 } while (true);
2250 }
2251 match(CLOSE_CURLY);
2252
2253 try
2254 {
2255 if ( schemaManager != null )
2256 {
2257 attributeType = schemaManager.lookupAttributeTypeRegistry( typeOid );
2258 valueInAttributeType = schemaManager.lookupAttributeTypeRegistry( valuesInOid );
2259 }
2260 else
2261 {
2262 attributeType = new AttributeType( typeOid );
2263 valueInAttributeType = new AttributeType( valuesInOid );
2264 }
2265
2266 restrictedValue = new RestrictedByElem( attributeType, valueInAttributeType );
2267 }
2268 catch ( LdapException le )
2269 {
2270
2271
2272 }
2273
2274 return restrictedValue ;
2275 }
2276
2277 public final ExprNode refinement() throws RecognitionException, TokenStreamException {
2278 ExprNode node ;
2279
2280
2281 log.debug( "entered refinement()" );
2282 node = null;
2283
2284
2285 switch ( LA(1)) {
2286 case ID_item:
2287 {
2288 node=item();
2289 break;
2290 }
2291 case ID_and:
2292 {
2293 node=and();
2294 break;
2295 }
2296 case ID_or:
2297 {
2298 node=or();
2299 break;
2300 }
2301 case ID_not:
2302 {
2303 node=not();
2304 break;
2305 }
2306 default:
2307 {
2308 throw new NoViableAltException(LT(1), getFilename());
2309 }
2310 }
2311 return node ;
2312 }
2313
2314 public final ItemPermission itemPermission() throws RecognitionException, TokenStreamException {
2315 ItemPermission itemPermission ;
2316
2317
2318 log.debug( "entered itemPermission()" );
2319 itemPermission = null;
2320 itemPermissionComponentsMonitor = new MandatoryAndOptionalComponentsMonitor(
2321 new String [] { "userClasses", "grantsAndDenials" }, new String [] { "precedence" } );
2322
2323
2324 match(OPEN_CURLY);
2325 {
2326 _loop191:
2327 do {
2328 if ((LA(1)==SP)) {
2329 match(SP);
2330 }
2331 else {
2332 break _loop191;
2333 }
2334
2335 } while (true);
2336 }
2337 anyItemPermission();
2338 {
2339 _loop193:
2340 do {
2341 if ((LA(1)==SP)) {
2342 match(SP);
2343 }
2344 else {
2345 break _loop193;
2346 }
2347
2348 } while (true);
2349 }
2350 {
2351 _loop199:
2352 do {
2353 if ((LA(1)==SEP)) {
2354 match(SEP);
2355 {
2356 _loop196:
2357 do {
2358 if ((LA(1)==SP)) {
2359 match(SP);
2360 }
2361 else {
2362 break _loop196;
2363 }
2364
2365 } while (true);
2366 }
2367 anyItemPermission();
2368 {
2369 _loop198:
2370 do {
2371 if ((LA(1)==SP)) {
2372 match(SP);
2373 }
2374 else {
2375 break _loop198;
2376 }
2377
2378 } while (true);
2379 }
2380 }
2381 else {
2382 break _loop199;
2383 }
2384
2385 } while (true);
2386 }
2387 match(CLOSE_CURLY);
2388
2389 if ( !itemPermissionComponentsMonitor.finalStateValid() )
2390 {
2391 throw new RecognitionException( "Missing mandatory itemPermission components: "
2392 + itemPermissionComponentsMonitor.getRemainingComponents() );
2393 }
2394
2395 itemPermission = new ItemPermission( precedence, grantsAndDenials, userClasses );
2396 precedence = null;
2397
2398 return itemPermission ;
2399 }
2400
2401 public final void anyItemPermission() throws RecognitionException, TokenStreamException {
2402
2403
2404 try {
2405 switch ( LA(1)) {
2406 case ID_precedence:
2407 {
2408 precedence();
2409
2410 itemPermissionComponentsMonitor.useComponent( "precedence" );
2411
2412 break;
2413 }
2414 case ID_userClasses:
2415 {
2416 userClasses();
2417
2418 itemPermissionComponentsMonitor.useComponent( "userClasses" );
2419
2420 break;
2421 }
2422 case ID_grantsAndDenials:
2423 {
2424 grantsAndDenials();
2425
2426 itemPermissionComponentsMonitor.useComponent( "grantsAndDenials" );
2427
2428 break;
2429 }
2430 default:
2431 {
2432 throw new NoViableAltException(LT(1), getFilename());
2433 }
2434 }
2435 }
2436 catch (IllegalArgumentException e) {
2437
2438 throw new RecognitionException( e.getMessage() );
2439
2440 }
2441 }
2442
2443 public final void grantsAndDenials() throws RecognitionException, TokenStreamException {
2444
2445
2446 log.debug( "entered grantsAndDenials()" );
2447 grantsAndDenials = new HashSet<GrantAndDenial>();
2448 GrantAndDenial grantAndDenial = null;
2449
2450
2451 match(ID_grantsAndDenials);
2452 {
2453 int _cnt203=0;
2454 _loop203:
2455 do {
2456 if ((LA(1)==SP)) {
2457 match(SP);
2458 }
2459 else {
2460 if ( _cnt203>=1 ) { break _loop203; } else {throw new NoViableAltException(LT(1), getFilename());}
2461 }
2462
2463 _cnt203++;
2464 } while (true);
2465 }
2466 match(OPEN_CURLY);
2467 {
2468 _loop205:
2469 do {
2470 if ((LA(1)==SP)) {
2471 match(SP);
2472 }
2473 else {
2474 break _loop205;
2475 }
2476
2477 } while (true);
2478 }
2479 {
2480 switch ( LA(1)) {
2481 case ID_grantAdd:
2482 case ID_denyAdd:
2483 case ID_grantDiscloseOnError:
2484 case ID_denyDiscloseOnError:
2485 case ID_grantRead:
2486 case ID_denyRead:
2487 case ID_grantRemove:
2488 case ID_denyRemove:
2489 case ID_grantBrowse:
2490 case ID_denyBrowse:
2491 case ID_grantExport:
2492 case ID_denyExport:
2493 case ID_grantImport:
2494 case ID_denyImport:
2495 case ID_grantModify:
2496 case ID_denyModify:
2497 case ID_grantRename:
2498 case ID_denyRename:
2499 case ID_grantReturnDN:
2500 case ID_denyReturnDN:
2501 case ID_grantCompare:
2502 case ID_denyCompare:
2503 case ID_grantFilterMatch:
2504 case ID_denyFilterMatch:
2505 case ID_grantInvoke:
2506 case ID_denyInvoke:
2507 {
2508 grantAndDenial=grantAndDenial();
2509 {
2510 _loop208:
2511 do {
2512 if ((LA(1)==SP)) {
2513 match(SP);
2514 }
2515 else {
2516 break _loop208;
2517 }
2518
2519 } while (true);
2520 }
2521
2522 if ( !grantsAndDenials.add( grantAndDenial ))
2523 {
2524 throw new RecognitionException( "Duplicated GrantAndDenial bit: " + grantAndDenial );
2525 }
2526
2527 {
2528 _loop214:
2529 do {
2530 if ((LA(1)==SEP)) {
2531 match(SEP);
2532 {
2533 _loop211:
2534 do {
2535 if ((LA(1)==SP)) {
2536 match(SP);
2537 }
2538 else {
2539 break _loop211;
2540 }
2541
2542 } while (true);
2543 }
2544 grantAndDenial=grantAndDenial();
2545 {
2546 _loop213:
2547 do {
2548 if ((LA(1)==SP)) {
2549 match(SP);
2550 }
2551 else {
2552 break _loop213;
2553 }
2554
2555 } while (true);
2556 }
2557
2558 if ( !grantsAndDenials.add( grantAndDenial ))
2559 {
2560 throw new RecognitionException( "Duplicated GrantAndDenial bit: " + grantAndDenial );
2561 }
2562
2563 }
2564 else {
2565 break _loop214;
2566 }
2567
2568 } while (true);
2569 }
2570 break;
2571 }
2572 case CLOSE_CURLY:
2573 {
2574 break;
2575 }
2576 default:
2577 {
2578 throw new NoViableAltException(LT(1), getFilename());
2579 }
2580 }
2581 }
2582 match(CLOSE_CURLY);
2583 }
2584
2585 public final GrantAndDenial grantAndDenial() throws RecognitionException, TokenStreamException {
2586 GrantAndDenial l_grantAndDenial ;
2587
2588
2589 log.debug( "entered grantAndDenialsBit()" );
2590 l_grantAndDenial = null;
2591
2592
2593 switch ( LA(1)) {
2594 case ID_grantAdd:
2595 {
2596 match(ID_grantAdd);
2597 l_grantAndDenial = GrantAndDenial.GRANT_ADD;
2598 break;
2599 }
2600 case ID_denyAdd:
2601 {
2602 match(ID_denyAdd);
2603 l_grantAndDenial = GrantAndDenial.DENY_ADD;
2604 break;
2605 }
2606 case ID_grantDiscloseOnError:
2607 {
2608 match(ID_grantDiscloseOnError);
2609 l_grantAndDenial = GrantAndDenial.GRANT_DISCLOSE_ON_ERROR;
2610 break;
2611 }
2612 case ID_denyDiscloseOnError:
2613 {
2614 match(ID_denyDiscloseOnError);
2615 l_grantAndDenial = GrantAndDenial.DENY_DISCLOSE_ON_ERROR;
2616 break;
2617 }
2618 case ID_grantRead:
2619 {
2620 match(ID_grantRead);
2621 l_grantAndDenial = GrantAndDenial.GRANT_READ;
2622 break;
2623 }
2624 case ID_denyRead:
2625 {
2626 match(ID_denyRead);
2627 l_grantAndDenial = GrantAndDenial.DENY_READ;
2628 break;
2629 }
2630 case ID_grantRemove:
2631 {
2632 match(ID_grantRemove);
2633 l_grantAndDenial = GrantAndDenial.GRANT_REMOVE;
2634 break;
2635 }
2636 case ID_denyRemove:
2637 {
2638 match(ID_denyRemove);
2639 l_grantAndDenial = GrantAndDenial.DENY_REMOVE;
2640 break;
2641 }
2642 case ID_grantBrowse:
2643 {
2644 match(ID_grantBrowse);
2645 l_grantAndDenial = GrantAndDenial.GRANT_BROWSE;
2646 break;
2647 }
2648 case ID_denyBrowse:
2649 {
2650 match(ID_denyBrowse);
2651 l_grantAndDenial = GrantAndDenial.DENY_BROWSE;
2652 break;
2653 }
2654 case ID_grantExport:
2655 {
2656 match(ID_grantExport);
2657 l_grantAndDenial = GrantAndDenial.GRANT_EXPORT;
2658 break;
2659 }
2660 case ID_denyExport:
2661 {
2662 match(ID_denyExport);
2663 l_grantAndDenial = GrantAndDenial.DENY_EXPORT;
2664 break;
2665 }
2666 case ID_grantImport:
2667 {
2668 match(ID_grantImport);
2669 l_grantAndDenial = GrantAndDenial.GRANT_IMPORT;
2670 break;
2671 }
2672 case ID_denyImport:
2673 {
2674 match(ID_denyImport);
2675 l_grantAndDenial = GrantAndDenial.DENY_IMPORT;
2676 break;
2677 }
2678 case ID_grantModify:
2679 {
2680 match(ID_grantModify);
2681 l_grantAndDenial = GrantAndDenial.GRANT_MODIFY;
2682 break;
2683 }
2684 case ID_denyModify:
2685 {
2686 match(ID_denyModify);
2687 l_grantAndDenial = GrantAndDenial.DENY_MODIFY;
2688 break;
2689 }
2690 case ID_grantRename:
2691 {
2692 match(ID_grantRename);
2693 l_grantAndDenial = GrantAndDenial.GRANT_RENAME;
2694 break;
2695 }
2696 case ID_denyRename:
2697 {
2698 match(ID_denyRename);
2699 l_grantAndDenial = GrantAndDenial.DENY_RENAME;
2700 break;
2701 }
2702 case ID_grantReturnDN:
2703 {
2704 match(ID_grantReturnDN);
2705 l_grantAndDenial = GrantAndDenial.GRANT_RETURN_DN;
2706 break;
2707 }
2708 case ID_denyReturnDN:
2709 {
2710 match(ID_denyReturnDN);
2711 l_grantAndDenial = GrantAndDenial.DENY_RETURN_DN;
2712 break;
2713 }
2714 case ID_grantCompare:
2715 {
2716 match(ID_grantCompare);
2717 l_grantAndDenial = GrantAndDenial.GRANT_COMPARE;
2718 break;
2719 }
2720 case ID_denyCompare:
2721 {
2722 match(ID_denyCompare);
2723 l_grantAndDenial = GrantAndDenial.DENY_COMPARE;
2724 break;
2725 }
2726 case ID_grantFilterMatch:
2727 {
2728 match(ID_grantFilterMatch);
2729 l_grantAndDenial = GrantAndDenial.GRANT_FILTER_MATCH;
2730 break;
2731 }
2732 case ID_denyFilterMatch:
2733 {
2734 match(ID_denyFilterMatch);
2735 l_grantAndDenial = GrantAndDenial.DENY_FILTER_MATCH;
2736 break;
2737 }
2738 case ID_grantInvoke:
2739 {
2740 match(ID_grantInvoke);
2741 l_grantAndDenial = GrantAndDenial.GRANT_INVOKE;
2742 break;
2743 }
2744 case ID_denyInvoke:
2745 {
2746 match(ID_denyInvoke);
2747 l_grantAndDenial = GrantAndDenial.DENY_INVOKE;
2748 break;
2749 }
2750 default:
2751 {
2752 throw new NoViableAltException(LT(1), getFilename());
2753 }
2754 }
2755 return l_grantAndDenial ;
2756 }
2757
2758 public final void userClass() throws RecognitionException, TokenStreamException {
2759
2760
2761 log.debug( "entered userClasses()" );
2762
2763
2764 switch ( LA(1)) {
2765 case ID_allUsers:
2766 {
2767 allUsers();
2768 break;
2769 }
2770 case ID_thisEntry:
2771 {
2772 thisEntry();
2773 break;
2774 }
2775 case ID_parentOfEntry:
2776 {
2777 parentOfEntry();
2778 break;
2779 }
2780 case ID_name:
2781 {
2782 name();
2783 break;
2784 }
2785 case ID_userGroup:
2786 {
2787 userGroup();
2788 break;
2789 }
2790 case ID_subtree:
2791 {
2792 subtree();
2793 break;
2794 }
2795 default:
2796 {
2797 throw new NoViableAltException(LT(1), getFilename());
2798 }
2799 }
2800 }
2801
2802 public final void allUsers() throws RecognitionException, TokenStreamException {
2803
2804
2805 log.debug( "entered allUsers()" );
2806
2807
2808 match(ID_allUsers);
2809
2810 userClassesMap.put( "allUsers", UserClass.ALL_USERS );
2811
2812 }
2813
2814 public final void thisEntry() throws RecognitionException, TokenStreamException {
2815
2816
2817 log.debug( "entered thisEntry()" );
2818
2819
2820 match(ID_thisEntry);
2821
2822 userClassesMap.put( "thisEntry", UserClass.THIS_ENTRY );
2823
2824 }
2825
2826 public final void parentOfEntry() throws RecognitionException, TokenStreamException {
2827
2828
2829 log.debug( "entered parentOfEntry()" );
2830
2831
2832 match(ID_parentOfEntry);
2833
2834 userClassesMap.put( "parentOfEntry", UserClass.PARENT_OF_ENTRY );
2835
2836 }
2837
2838 public final void name() throws RecognitionException, TokenStreamException {
2839
2840
2841 log.debug( "entered name()" );
2842 Set<Dn> names = new HashSet<Dn>();
2843 Dn distinguishedName = null;
2844
2845
2846 match(ID_name);
2847 {
2848 int _cnt236=0;
2849 _loop236:
2850 do {
2851 if ((LA(1)==SP)) {
2852 match(SP);
2853 }
2854 else {
2855 if ( _cnt236>=1 ) { break _loop236; } else {throw new NoViableAltException(LT(1), getFilename());}
2856 }
2857
2858 _cnt236++;
2859 } while (true);
2860 }
2861 match(OPEN_CURLY);
2862 {
2863 _loop238:
2864 do {
2865 if ((LA(1)==SP)) {
2866 match(SP);
2867 }
2868 else {
2869 break _loop238;
2870 }
2871
2872 } while (true);
2873 }
2874 distinguishedName=distinguishedName();
2875 {
2876 _loop240:
2877 do {
2878 if ((LA(1)==SP)) {
2879 match(SP);
2880 }
2881 else {
2882 break _loop240;
2883 }
2884
2885 } while (true);
2886 }
2887
2888 names.add( distinguishedName );
2889
2890 {
2891 _loop246:
2892 do {
2893 if ((LA(1)==SEP)) {
2894 match(SEP);
2895 {
2896 _loop243:
2897 do {
2898 if ((LA(1)==SP)) {
2899 match(SP);
2900 }
2901 else {
2902 break _loop243;
2903 }
2904
2905 } while (true);
2906 }
2907 distinguishedName=distinguishedName();
2908 {
2909 _loop245:
2910 do {
2911 if ((LA(1)==SP)) {
2912 match(SP);
2913 }
2914 else {
2915 break _loop245;
2916 }
2917
2918 } while (true);
2919 }
2920
2921 names.add( distinguishedName );
2922
2923 }
2924 else {
2925 break _loop246;
2926 }
2927
2928 } while (true);
2929 }
2930 match(CLOSE_CURLY);
2931
2932 userClassesMap.put( "name", new UserClass.Name( names ) );
2933
2934 }
2935
2936 public final void userGroup() throws RecognitionException, TokenStreamException {
2937
2938
2939 log.debug( "entered userGroup()" );
2940 Set<Dn> userGroup = new HashSet<Dn>();
2941 Dn distinguishedName = null;
2942
2943
2944 match(ID_userGroup);
2945 {
2946 int _cnt249=0;
2947 _loop249:
2948 do {
2949 if ((LA(1)==SP)) {
2950 match(SP);
2951 }
2952 else {
2953 if ( _cnt249>=1 ) { break _loop249; } else {throw new NoViableAltException(LT(1), getFilename());}
2954 }
2955
2956 _cnt249++;
2957 } while (true);
2958 }
2959 match(OPEN_CURLY);
2960 {
2961 _loop251:
2962 do {
2963 if ((LA(1)==SP)) {
2964 match(SP);
2965 }
2966 else {
2967 break _loop251;
2968 }
2969
2970 } while (true);
2971 }
2972 distinguishedName=distinguishedName();
2973 {
2974 _loop253:
2975 do {
2976 if ((LA(1)==SP)) {
2977 match(SP);
2978 }
2979 else {
2980 break _loop253;
2981 }
2982
2983 } while (true);
2984 }
2985
2986 userGroup.add( distinguishedName );
2987
2988 {
2989 _loop259:
2990 do {
2991 if ((LA(1)==SEP)) {
2992 match(SEP);
2993 {
2994 _loop256:
2995 do {
2996 if ((LA(1)==SP)) {
2997 match(SP);
2998 }
2999 else {
3000 break _loop256;
3001 }
3002
3003 } while (true);
3004 }
3005 distinguishedName=distinguishedName();
3006 {
3007 _loop258:
3008 do {
3009 if ((LA(1)==SP)) {
3010 match(SP);
3011 }
3012 else {
3013 break _loop258;
3014 }
3015
3016 } while (true);
3017 }
3018
3019 userGroup.add( distinguishedName );
3020
3021 }
3022 else {
3023 break _loop259;
3024 }
3025
3026 } while (true);
3027 }
3028 match(CLOSE_CURLY);
3029
3030 userClassesMap.put( "userGroup", new UserClass.UserGroup( userGroup ) );
3031
3032 }
3033
3034 public final void subtree() throws RecognitionException, TokenStreamException {
3035
3036
3037 log.debug( "entered subtree()" );
3038 Set<SubtreeSpecification> subtrees = new HashSet<SubtreeSpecification>();
3039 SubtreeSpecification subtreeSpecification = null;
3040
3041
3042 match(ID_subtree);
3043 {
3044 int _cnt262=0;
3045 _loop262:
3046 do {
3047 if ((LA(1)==SP)) {
3048 match(SP);
3049 }
3050 else {
3051 if ( _cnt262>=1 ) { break _loop262; } else {throw new NoViableAltException(LT(1), getFilename());}
3052 }
3053
3054 _cnt262++;
3055 } while (true);
3056 }
3057 match(OPEN_CURLY);
3058 {
3059 _loop264:
3060 do {
3061 if ((LA(1)==SP)) {
3062 match(SP);
3063 }
3064 else {
3065 break _loop264;
3066 }
3067
3068 } while (true);
3069 }
3070 subtreeSpecification=subtreeSpecification();
3071 {
3072 _loop266:
3073 do {
3074 if ((LA(1)==SP)) {
3075 match(SP);
3076 }
3077 else {
3078 break _loop266;
3079 }
3080
3081 } while (true);
3082 }
3083
3084 subtrees.add( subtreeSpecification );
3085
3086 {
3087 _loop272:
3088 do {
3089 if ((LA(1)==SEP)) {
3090 match(SEP);
3091 {
3092 _loop269:
3093 do {
3094 if ((LA(1)==SP)) {
3095 match(SP);
3096 }
3097 else {
3098 break _loop269;
3099 }
3100
3101 } while (true);
3102 }
3103 subtreeSpecification=subtreeSpecification();
3104 {
3105 _loop271:
3106 do {
3107 if ((LA(1)==SP)) {
3108 match(SP);
3109 }
3110 else {
3111 break _loop271;
3112 }
3113
3114 } while (true);
3115 }
3116
3117 subtrees.add( subtreeSpecification );
3118
3119 }
3120 else {
3121 break _loop272;
3122 }
3123
3124 } while (true);
3125 }
3126 match(CLOSE_CURLY);
3127
3128 userClassesMap.put( "subtree", new UserClass.Subtree( subtrees ) );
3129
3130 }
3131
3132 public final Dn distinguishedName() throws RecognitionException, TokenStreamException {
3133 Dn name ;
3134
3135 Token token = null;
3136
3137 log.debug( "entered distinguishedName()" );
3138 name = null;
3139
3140
3141 try {
3142 token = LT(1);
3143 match(SAFEUTF8STRING);
3144
3145 name = new Dn( token.getText() );
3146 if ( schemaManager != null )
3147 {
3148 name.apply( schemaManager );
3149 }
3150 log.debug( "recognized a DistinguishedName: " + token.getText() );
3151
3152 }
3153 catch (Exception e) {
3154
3155 throw new RecognitionException( "dnParser failed for " + token.getText() + " " + e.getMessage() );
3156
3157 }
3158 return name ;
3159 }
3160
3161 public final SubtreeSpecification subtreeSpecification() throws RecognitionException, TokenStreamException {
3162 SubtreeSpecification ss;
3163
3164
3165 log.debug( "entered subtreeSpecification()" );
3166
3167
3168 ss = null;
3169 ssModifier = new SubtreeSpecificationModifier();
3170 chopBeforeExclusions = new HashSet<Dn>();
3171 chopAfterExclusions = new HashSet<Dn>();
3172 subtreeSpecificationComponentsMonitor = new OptionalComponentsMonitor(
3173 new String [] { "base", "specificExclusions", "minimum", "maximum" } );
3174
3175
3176 match(OPEN_CURLY);
3177 {
3178 _loop301:
3179 do {
3180 if ((LA(1)==SP)) {
3181 match(SP);
3182 }
3183 else {
3184 break _loop301;
3185 }
3186
3187 } while (true);
3188 }
3189 {
3190 switch ( LA(1)) {
3191 case ID_base:
3192 case ID_specificExclusions:
3193 case ID_minimum:
3194 case ID_maximum:
3195 {
3196 subtreeSpecificationComponent();
3197 {
3198 _loop304:
3199 do {
3200 if ((LA(1)==SP)) {
3201 match(SP);
3202 }
3203 else {
3204 break _loop304;
3205 }
3206
3207 } while (true);
3208 }
3209 {
3210 _loop310:
3211 do {
3212 if ((LA(1)==SEP)) {
3213 match(SEP);
3214 {
3215 _loop307:
3216 do {
3217 if ((LA(1)==SP)) {
3218 match(SP);
3219 }
3220 else {
3221 break _loop307;
3222 }
3223
3224 } while (true);
3225 }
3226 subtreeSpecificationComponent();
3227 {
3228 _loop309:
3229 do {
3230 if ((LA(1)==SP)) {
3231 match(SP);
3232 }
3233 else {
3234 break _loop309;
3235 }
3236
3237 } while (true);
3238 }
3239 }
3240 else {
3241 break _loop310;
3242 }
3243
3244 } while (true);
3245 }
3246 break;
3247 }
3248 case CLOSE_CURLY:
3249 {
3250 break;
3251 }
3252 default:
3253 {
3254 throw new NoViableAltException(LT(1), getFilename());
3255 }
3256 }
3257 }
3258 match(CLOSE_CURLY);
3259
3260 ss = ssModifier.getSubtreeSpecification();
3261
3262 return ss;
3263 }
3264
3265 public final UserPermission userPermission() throws RecognitionException, TokenStreamException {
3266 UserPermission userPermission ;
3267
3268
3269 log.debug( "entered userPermission()" );
3270 userPermission = null;
3271 userPermissionComponentsMonitor = new MandatoryAndOptionalComponentsMonitor(
3272 new String [] { "protectedItems", "grantsAndDenials" }, new String [] { "precedence" } );
3273
3274
3275 match(OPEN_CURLY);
3276 {
3277 _loop289:
3278 do {
3279 if ((LA(1)==SP)) {
3280 match(SP);
3281 }
3282 else {
3283 break _loop289;
3284 }
3285
3286 } while (true);
3287 }
3288 anyUserPermission();
3289 {
3290 _loop291:
3291 do {
3292 if ((LA(1)==SP)) {
3293 match(SP);
3294 }
3295 else {
3296 break _loop291;
3297 }
3298
3299 } while (true);
3300 }
3301 {
3302 _loop297:
3303 do {
3304 if ((LA(1)==SEP)) {
3305 match(SEP);
3306 {
3307 _loop294:
3308 do {
3309 if ((LA(1)==SP)) {
3310 match(SP);
3311 }
3312 else {
3313 break _loop294;
3314 }
3315
3316 } while (true);
3317 }
3318 anyUserPermission();
3319 {
3320 _loop296:
3321 do {
3322 if ((LA(1)==SP)) {
3323 match(SP);
3324 }
3325 else {
3326 break _loop296;
3327 }
3328
3329 } while (true);
3330 }
3331 }
3332 else {
3333 break _loop297;
3334 }
3335
3336 } while (true);
3337 }
3338 match(CLOSE_CURLY);
3339
3340 if ( !userPermissionComponentsMonitor.finalStateValid() )
3341 {
3342 throw new RecognitionException( "Missing mandatory userPermission components: "
3343 + userPermissionComponentsMonitor.getRemainingComponents() );
3344 }
3345
3346 userPermission = new UserPermission( precedence, grantsAndDenials, protectedItems );
3347 precedence = null;
3348
3349 return userPermission ;
3350 }
3351
3352 public final void anyUserPermission() throws RecognitionException, TokenStreamException {
3353
3354
3355 try {
3356 switch ( LA(1)) {
3357 case ID_precedence:
3358 {
3359 precedence();
3360
3361 userPermissionComponentsMonitor.useComponent( "precedence" );
3362
3363 break;
3364 }
3365 case ID_protectedItems:
3366 {
3367 protectedItems();
3368
3369 userPermissionComponentsMonitor.useComponent( "protectedItems" );
3370
3371 break;
3372 }
3373 case ID_grantsAndDenials:
3374 {
3375 grantsAndDenials();
3376
3377 userPermissionComponentsMonitor.useComponent( "grantsAndDenials" );
3378
3379 break;
3380 }
3381 default:
3382 {
3383 throw new NoViableAltException(LT(1), getFilename());
3384 }
3385 }
3386 }
3387 catch (IllegalArgumentException e) {
3388
3389 throw new RecognitionException( e.getMessage() );
3390
3391 }
3392 }
3393
3394 public final void subtreeSpecificationComponent() throws RecognitionException, TokenStreamException {
3395
3396
3397 log.debug( "entered subtreeSpecification()" );
3398
3399
3400 try {
3401 switch ( LA(1)) {
3402 case ID_base:
3403 {
3404 ss_base();
3405
3406 subtreeSpecificationComponentsMonitor.useComponent( "base" );
3407
3408 break;
3409 }
3410 case ID_specificExclusions:
3411 {
3412 ss_specificExclusions();
3413
3414 subtreeSpecificationComponentsMonitor.useComponent( "specificExclusions" );
3415
3416 break;
3417 }
3418 case ID_minimum:
3419 {
3420 ss_minimum();
3421
3422 subtreeSpecificationComponentsMonitor.useComponent( "minimum" );
3423
3424 break;
3425 }
3426 case ID_maximum:
3427 {
3428 ss_maximum();
3429
3430 subtreeSpecificationComponentsMonitor.useComponent( "maximum" );
3431
3432 break;
3433 }
3434 default:
3435 {
3436 throw new NoViableAltException(LT(1), getFilename());
3437 }
3438 }
3439 }
3440 catch (IllegalArgumentException e) {
3441
3442 throw new RecognitionException( e.getMessage() );
3443
3444 }
3445 }
3446
3447 public final void ss_base() throws RecognitionException, TokenStreamException {
3448
3449
3450 log.debug( "entered ss_base()" );
3451 Dn base = null;
3452
3453
3454 match(ID_base);
3455 {
3456 int _cnt314=0;
3457 _loop314:
3458 do {
3459 if ((LA(1)==SP)) {
3460 match(SP);
3461 }
3462 else {
3463 if ( _cnt314>=1 ) { break _loop314; } else {throw new NoViableAltException(LT(1), getFilename());}
3464 }
3465
3466 _cnt314++;
3467 } while (true);
3468 }
3469 base=distinguishedName();
3470
3471 ssModifier.setBase( base );
3472
3473 }
3474
3475 public final void ss_specificExclusions() throws RecognitionException, TokenStreamException {
3476
3477
3478 log.debug( "entered ss_specificExclusions()" );
3479
3480
3481 match(ID_specificExclusions);
3482 {
3483 int _cnt317=0;
3484 _loop317:
3485 do {
3486 if ((LA(1)==SP)) {
3487 match(SP);
3488 }
3489 else {
3490 if ( _cnt317>=1 ) { break _loop317; } else {throw new NoViableAltException(LT(1), getFilename());}
3491 }
3492
3493 _cnt317++;
3494 } while (true);
3495 }
3496 specificExclusions();
3497
3498 ssModifier.setChopBeforeExclusions( chopBeforeExclusions );
3499 ssModifier.setChopAfterExclusions( chopAfterExclusions );
3500
3501 }
3502
3503 public final void ss_minimum() throws RecognitionException, TokenStreamException {
3504
3505
3506 log.debug( "entered ss_minimum()" );
3507 int minimum = 0;
3508
3509
3510 match(ID_minimum);
3511 {
3512 int _cnt343=0;
3513 _loop343:
3514 do {
3515 if ((LA(1)==SP)) {
3516 match(SP);
3517 }
3518 else {
3519 if ( _cnt343>=1 ) { break _loop343; } else {throw new NoViableAltException(LT(1), getFilename());}
3520 }
3521
3522 _cnt343++;
3523 } while (true);
3524 }
3525 minimum=baseDistance();
3526
3527 ssModifier.setMinBaseDistance( minimum );
3528
3529 }
3530
3531 public final void ss_maximum() throws RecognitionException, TokenStreamException {
3532
3533
3534 log.debug( "entered ss_maximum()" );
3535 int maximum = 0;
3536
3537
3538 match(ID_maximum);
3539 {
3540 int _cnt346=0;
3541 _loop346:
3542 do {
3543 if ((LA(1)==SP)) {
3544 match(SP);
3545 }
3546 else {
3547 if ( _cnt346>=1 ) { break _loop346; } else {throw new NoViableAltException(LT(1), getFilename());}
3548 }
3549
3550 _cnt346++;
3551 } while (true);
3552 }
3553 maximum=baseDistance();
3554
3555 ssModifier.setMaxBaseDistance( maximum );
3556
3557 }
3558
3559 public final void specificExclusions() throws RecognitionException, TokenStreamException {
3560
3561
3562 log.debug( "entered specificExclusions()" );
3563
3564
3565 match(OPEN_CURLY);
3566 {
3567 _loop320:
3568 do {
3569 if ((LA(1)==SP)) {
3570 match(SP);
3571 }
3572 else {
3573 break _loop320;
3574 }
3575
3576 } while (true);
3577 }
3578 {
3579 switch ( LA(1)) {
3580 case ID_chopBefore:
3581 case ID_chopAfter:
3582 {
3583 specificExclusion();
3584 {
3585 _loop323:
3586 do {
3587 if ((LA(1)==SP)) {
3588 match(SP);
3589 }
3590 else {
3591 break _loop323;
3592 }
3593
3594 } while (true);
3595 }
3596 {
3597 _loop329:
3598 do {
3599 if ((LA(1)==SEP)) {
3600 match(SEP);
3601 {
3602 _loop326:
3603 do {
3604 if ((LA(1)==SP)) {
3605 match(SP);
3606 }
3607 else {
3608 break _loop326;
3609 }
3610
3611 } while (true);
3612 }
3613 specificExclusion();
3614 {
3615 _loop328:
3616 do {
3617 if ((LA(1)==SP)) {
3618 match(SP);
3619 }
3620 else {
3621 break _loop328;
3622 }
3623
3624 } while (true);
3625 }
3626 }
3627 else {
3628 break _loop329;
3629 }
3630
3631 } while (true);
3632 }
3633 break;
3634 }
3635 case CLOSE_CURLY:
3636 {
3637 break;
3638 }
3639 default:
3640 {
3641 throw new NoViableAltException(LT(1), getFilename());
3642 }
3643 }
3644 }
3645 match(CLOSE_CURLY);
3646 }
3647
3648 public final void specificExclusion() throws RecognitionException, TokenStreamException {
3649
3650
3651 log.debug( "entered specificExclusion()" );
3652
3653
3654 switch ( LA(1)) {
3655 case ID_chopBefore:
3656 {
3657 chopBefore();
3658 break;
3659 }
3660 case ID_chopAfter:
3661 {
3662 chopAfter();
3663 break;
3664 }
3665 default:
3666 {
3667 throw new NoViableAltException(LT(1), getFilename());
3668 }
3669 }
3670 }
3671
3672 public final void chopBefore() throws RecognitionException, TokenStreamException {
3673
3674
3675 log.debug( "entered chopBefore()" );
3676 Dn chopBeforeExclusion = null;
3677
3678
3679 match(ID_chopBefore);
3680 {
3681 _loop333:
3682 do {
3683 if ((LA(1)==SP)) {
3684 match(SP);
3685 }
3686 else {
3687 break _loop333;
3688 }
3689
3690 } while (true);
3691 }
3692 match(COLON);
3693 {
3694 _loop335:
3695 do {
3696 if ((LA(1)==SP)) {
3697 match(SP);
3698 }
3699 else {
3700 break _loop335;
3701 }
3702
3703 } while (true);
3704 }
3705 chopBeforeExclusion=distinguishedName();
3706
3707 chopBeforeExclusions.add( chopBeforeExclusion );
3708
3709 }
3710
3711 public final void chopAfter() throws RecognitionException, TokenStreamException {
3712
3713
3714 log.debug( "entered chopAfter()" );
3715 Dn chopAfterExclusion = null;
3716
3717
3718 match(ID_chopAfter);
3719 {
3720 _loop338:
3721 do {
3722 if ((LA(1)==SP)) {
3723 match(SP);
3724 }
3725 else {
3726 break _loop338;
3727 }
3728
3729 } while (true);
3730 }
3731 match(COLON);
3732 {
3733 _loop340:
3734 do {
3735 if ((LA(1)==SP)) {
3736 match(SP);
3737 }
3738 else {
3739 break _loop340;
3740 }
3741
3742 } while (true);
3743 }
3744 chopAfterExclusion=distinguishedName();
3745
3746 chopAfterExclusions.add( chopAfterExclusion );
3747
3748 }
3749
3750 public final int baseDistance() throws RecognitionException, TokenStreamException {
3751 int distance ;
3752
3753 Token token = null;
3754
3755 log.debug( "entered baseDistance()" );
3756 distance = 0;
3757
3758
3759 token = LT(1);
3760 match(INTEGER);
3761
3762 distance = token2Integer( token );
3763
3764 return distance ;
3765 }
3766
3767 public final LeafNode item() throws RecognitionException, TokenStreamException {
3768 LeafNode node ;
3769
3770
3771 log.debug( "entered item()" );
3772 node = null;
3773 String oid = null;
3774
3775
3776 match(ID_item);
3777 {
3778 _loop354:
3779 do {
3780 if ((LA(1)==SP)) {
3781 match(SP);
3782 }
3783 else {
3784 break _loop354;
3785 }
3786
3787 } while (true);
3788 }
3789 match(COLON);
3790 {
3791 _loop356:
3792 do {
3793 if ((LA(1)==SP)) {
3794 match(SP);
3795 }
3796 else {
3797 break _loop356;
3798 }
3799
3800 } while (true);
3801 }
3802 oid=oid();
3803
3804 node = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT , new StringValue( oid ) );
3805
3806 return node ;
3807 }
3808
3809 public final BranchNode and() throws RecognitionException, TokenStreamException {
3810 BranchNode node ;
3811
3812
3813 log.debug( "entered and()" );
3814 node = null;
3815 List<ExprNode> children = null;
3816
3817
3818 match(ID_and);
3819 {
3820 _loop359:
3821 do {
3822 if ((LA(1)==SP)) {
3823 match(SP);
3824 }
3825 else {
3826 break _loop359;
3827 }
3828
3829 } while (true);
3830 }
3831 match(COLON);
3832 {
3833 _loop361:
3834 do {
3835 if ((LA(1)==SP)) {
3836 match(SP);
3837 }
3838 else {
3839 break _loop361;
3840 }
3841
3842 } while (true);
3843 }
3844 children=refinements();
3845
3846 node = new AndNode( children );
3847
3848 return node ;
3849 }
3850
3851 public final BranchNode or() throws RecognitionException, TokenStreamException {
3852 BranchNode node ;
3853
3854
3855 log.debug( "entered or()" );
3856 node = null;
3857 List<ExprNode> children = null;
3858
3859
3860 match(ID_or);
3861 {
3862 _loop364:
3863 do {
3864 if ((LA(1)==SP)) {
3865 match(SP);
3866 }
3867 else {
3868 break _loop364;
3869 }
3870
3871 } while (true);
3872 }
3873 match(COLON);
3874 {
3875 _loop366:
3876 do {
3877 if ((LA(1)==SP)) {
3878 match(SP);
3879 }
3880 else {
3881 break _loop366;
3882 }
3883
3884 } while (true);
3885 }
3886 children=refinements();
3887
3888 node = new OrNode( children );
3889
3890 return node ;
3891 }
3892
3893 public final BranchNode not() throws RecognitionException, TokenStreamException {
3894 BranchNode node ;
3895
3896
3897 log.debug( "entered not()" );
3898 node = null;
3899 List<ExprNode> children = null;
3900
3901
3902 match(ID_not);
3903 {
3904 _loop369:
3905 do {
3906 if ((LA(1)==SP)) {
3907 match(SP);
3908 }
3909 else {
3910 break _loop369;
3911 }
3912
3913 } while (true);
3914 }
3915 match(COLON);
3916 {
3917 _loop371:
3918 do {
3919 if ((LA(1)==SP)) {
3920 match(SP);
3921 }
3922 else {
3923 break _loop371;
3924 }
3925
3926 } while (true);
3927 }
3928 children=refinements();
3929
3930 node = new NotNode( children );
3931
3932 return node ;
3933 }
3934
3935 public final List<ExprNode> refinements() throws RecognitionException, TokenStreamException {
3936 List<ExprNode> children ;
3937
3938
3939 log.debug( "entered refinements()" );
3940 children = null;
3941 ExprNode child = null;
3942 List<ExprNode> tempChildren = new ArrayList<ExprNode>();
3943
3944
3945 match(OPEN_CURLY);
3946 {
3947 _loop374:
3948 do {
3949 if ((LA(1)==SP)) {
3950 match(SP);
3951 }
3952 else {
3953 break _loop374;
3954 }
3955
3956 } while (true);
3957 }
3958 {
3959 switch ( LA(1)) {
3960 case ID_item:
3961 case ID_and:
3962 case ID_or:
3963 case ID_not:
3964 {
3965 child=refinement();
3966 {
3967 _loop377:
3968 do {
3969 if ((LA(1)==SP)) {
3970 match(SP);
3971 }
3972 else {
3973 break _loop377;
3974 }
3975
3976 } while (true);
3977 }
3978
3979 tempChildren.add( child );
3980
3981 {
3982 _loop383:
3983 do {
3984 if ((LA(1)==SEP)) {
3985 match(SEP);
3986 {
3987 _loop380:
3988 do {
3989 if ((LA(1)==SP)) {
3990 match(SP);
3991 }
3992 else {
3993 break _loop380;
3994 }
3995
3996 } while (true);
3997 }
3998 child=refinement();
3999 {
4000 _loop382:
4001 do {
4002 if ((LA(1)==SP)) {
4003 match(SP);
4004 }
4005 else {
4006 break _loop382;
4007 }
4008
4009 } while (true);
4010 }
4011
4012 tempChildren.add( child );
4013
4014 }
4015 else {
4016 break _loop383;
4017 }
4018
4019 } while (true);
4020 }
4021 break;
4022 }
4023 case CLOSE_CURLY:
4024 {
4025 break;
4026 }
4027 default:
4028 {
4029 throw new NoViableAltException(LT(1), getFilename());
4030 }
4031 }
4032 }
4033 match(CLOSE_CURLY);
4034
4035 children = tempChildren;
4036
4037 return children ;
4038 }
4039
4040
4041 public static final String[] _tokenNames = {
4042 "<0>",
4043 "EOF",
4044 "<2>",
4045 "NULL_TREE_LOOKAHEAD",
4046 "ATTRIBUTE_VALUE_CANDIDATE",
4047 "RANGE_OF_VALUES_CANDIDATE",
4048 "SP",
4049 "OPEN_CURLY",
4050 "SEP",
4051 "CLOSE_CURLY",
4052 "\"identificationTag\"",
4053 "SAFEUTF8STRING",
4054 "\"precedence\"",
4055 "INTEGER",
4056 "\"authenticationLevel\"",
4057 "\"none\"",
4058 "\"simple\"",
4059 "\"strong\"",
4060 "\"itemOrUserFirst\"",
4061 "\"itemFirst\"",
4062 "COLON",
4063 "\"userFirst\"",
4064 "\"protectedItems\"",
4065 "\"entry\"",
4066 "\"allUserAttributeTypes\"",
4067 "\"attributeType\"",
4068 "\"allAttributeValues\"",
4069 "\"allUserAttributeTypesAndValues\"",
4070 "\"selfValue\"",
4071 "\"maxValueCount\"",
4072 "\"type\"",
4073 "\"maxCount\"",
4074 "\"maxImmSub\"",
4075 "\"restrictedBy\"",
4076 "\"valuesIn\"",
4077 "\"classes\"",
4078 "\"itemPermissions\"",
4079 "\"grantsAndDenials\"",
4080 "\"grantAdd\"",
4081 "\"denyAdd\"",
4082 "\"grantDiscloseOnError\"",
4083 "\"denyDiscloseOnError\"",
4084 "\"grantRead\"",
4085 "\"denyRead\"",
4086 "\"grantRemove\"",
4087 "\"denyRemove\"",
4088 "\"grantBrowse\"",
4089 "\"denyBrowse\"",
4090 "\"grantExport\"",
4091 "\"denyExport\"",
4092 "\"grantImport\"",
4093 "\"denyImport\"",
4094 "\"grantModify\"",
4095 "\"denyModify\"",
4096 "\"grantRename\"",
4097 "\"denyRename\"",
4098 "\"grantReturnDN\"",
4099 "\"denyReturnDN\"",
4100 "\"grantCompare\"",
4101 "\"denyCompare\"",
4102 "\"grantFilterMatch\"",
4103 "\"denyFilterMatch\"",
4104 "\"grantInvoke\"",
4105 "\"denyInvoke\"",
4106 "\"userClasses\"",
4107 "\"allUsers\"",
4108 "\"thisEntry\"",
4109 "\"parentOfEntry\"",
4110 "\"name\"",
4111 "\"userGroup\"",
4112 "\"subtree\"",
4113 "\"userPermissions\"",
4114 "\"base\"",
4115 "\"specificExclusions\"",
4116 "\"chopBefore\"",
4117 "\"chopAfter\"",
4118 "\"minimum\"",
4119 "\"maximum\"",
4120 "DESCR",
4121 "NUMERICOID",
4122 "\"item\"",
4123 "\"and\"",
4124 "\"or\"",
4125 "\"not\"",
4126 "\"FALSE\"",
4127 "\"TRUE\"",
4128 "\"level\"",
4129 "\"basicLevels\"",
4130 "\"localQualifier\"",
4131 "\"signed\"",
4132 "\"rangeOfValues\"",
4133 "\"specificationFilter\"",
4134 "SAFEUTF8CHAR",
4135 "DIGIT",
4136 "LDIGIT",
4137 "ALPHA",
4138 "HYPHEN",
4139 "DOT",
4140 "INTEGER_OR_NUMERICOID",
4141 "FILTER",
4142 "FILTER_VALUE"
4143 };
4144
4145
4146 }