001 // $ANTLR 2.7.4: "ACIItem.g" -> "AntlrACIItemParser.java"$
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements. See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership. The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License. You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied. See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 *
021 */
022
023
024 package org.apache.directory.shared.ldap.aci;
025
026
027 import java.util.List;
028 import java.util.ArrayList;
029 import java.util.HashSet;
030 import java.util.Map;
031 import java.util.Set;
032 import java.util.Enumeration;
033
034 import javax.naming.directory.Attribute;
035 import javax.naming.directory.BasicAttribute;
036
037 import org.apache.directory.shared.ldap.filter.BranchNode;
038 import org.apache.directory.shared.ldap.filter.AndNode;
039 import org.apache.directory.shared.ldap.filter.OrNode;
040 import org.apache.directory.shared.ldap.filter.NotNode;
041 import org.apache.directory.shared.ldap.filter.ExprNode;
042 import org.apache.directory.shared.ldap.filter.LeafNode;
043 import org.apache.directory.shared.ldap.filter.EqualityNode;
044 import org.apache.directory.shared.ldap.filter.FilterParser;
045 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
046 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
047 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationModifier;
048 import org.apache.directory.shared.ldap.util.ComponentsMonitor;
049 import org.apache.directory.shared.ldap.util.MandatoryAndOptionalComponentsMonitor;
050 import org.apache.directory.shared.ldap.util.MandatoryComponentsMonitor;
051 import org.apache.directory.shared.ldap.util.NamespaceTools;
052 import org.apache.directory.shared.ldap.util.NoDuplicateKeysMap;
053 import org.apache.directory.shared.ldap.util.OptionalComponentsMonitor;
054 import org.apache.directory.shared.ldap.name.LdapDN;
055 import org.apache.directory.shared.ldap.constants.SchemaConstants;
056 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
057 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
058 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
059
060 import org.slf4j.Logger;
061 import org.slf4j.LoggerFactory;
062
063
064 import antlr.TokenBuffer;
065 import antlr.TokenStreamException;
066 import antlr.TokenStreamIOException;
067 import antlr.ANTLRException;
068 import antlr.LLkParser;
069 import antlr.Token;
070 import antlr.TokenStream;
071 import antlr.RecognitionException;
072 import antlr.NoViableAltException;
073 import antlr.MismatchedTokenException;
074 import antlr.SemanticException;
075 import antlr.ParserSharedInputState;
076 import antlr.collections.impl.BitSet;
077
078 /**
079 * The antlr generated ACIItem parser.
080 *
081 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
082 * @version $Rev$
083 */
084 public class AntlrACIItemParser extends antlr.LLkParser implements AntlrACIItemParserTokenTypes
085 {
086
087 private static final Logger log = LoggerFactory.getLogger( AntlrACIItemParser.class );
088
089 NameComponentNormalizer normalizer;
090
091 // nonshared global data needed to avoid extensive pass/return stuff
092 // these are only used by three first order components
093 private String identificationTag;
094 private AuthenticationLevel authenticationLevel;
095 private int aciPrecedence = -1;
096
097 private boolean isItemFirstACIItem;
098
099 // shared global data needed to avoid extensive pass/return stuff
100 private Set<ProtectedItem> protectedItems;
101 private Map<String, ProtectedItem> protectedItemsMap;
102 private Set<UserClass> userClasses;
103 private Map<String, UserClass> userClassesMap;
104 private Set<ItemPermission> itemPermissions;
105 private int precedence = -1;
106 private Set<GrantAndDenial> grantsAndDenials;
107 private Set<UserPermission> userPermissions;
108 private Map<String, OidNormalizer> oidsMap;
109
110 private Set<LdapDN> chopBeforeExclusions;
111 private Set<LdapDN> chopAfterExclusions;
112 private SubtreeSpecificationModifier ssModifier = null;
113
114 private ComponentsMonitor mainACIItemComponentsMonitor;
115 private ComponentsMonitor itemPermissionComponentsMonitor;
116 private ComponentsMonitor userPermissionComponentsMonitor;
117 private ComponentsMonitor subtreeSpecificationComponentsMonitor;
118
119
120 /**
121 * Creates a (normalizing) subordinate DnParser for parsing Names.
122 * This method MUST be called for each instance while we cannot do
123 * constructor overloading for this class.
124 *
125 * @return the DnParser to be used for parsing Names
126 */
127 public void init( Map<String, OidNormalizer> oidsMap )
128 {
129 this.oidsMap = oidsMap;
130 }
131
132 /**
133 * Sets the NameComponentNormalizer for this parser's dnParser.
134 */
135 public void setNormalizer(NameComponentNormalizer normalizer)
136 {
137 this.normalizer = normalizer;
138 }
139
140 private int token2Integer( Token token ) throws RecognitionException
141 {
142 int i = 0;
143
144 try
145 {
146 i = Integer.parseInt( token.getText());
147 }
148 catch ( NumberFormatException e )
149 {
150 throw new RecognitionException( "Value of INTEGER token " +
151 token.getText() +
152 " cannot be converted to an Integer" );
153 }
154
155 return i;
156 }
157
158 protected AntlrACIItemParser(TokenBuffer tokenBuf, int k) {
159 super(tokenBuf,k);
160 tokenNames = _tokenNames;
161 }
162
163 public AntlrACIItemParser(TokenBuffer tokenBuf) {
164 this(tokenBuf,1);
165 }
166
167 protected AntlrACIItemParser(TokenStream lexer, int k) {
168 super(lexer,k);
169 tokenNames = _tokenNames;
170 }
171
172 public AntlrACIItemParser(TokenStream lexer) {
173 this(lexer,1);
174 }
175
176 public AntlrACIItemParser(ParserSharedInputState state) {
177 super(state,1);
178 tokenNames = _tokenNames;
179 }
180
181 public final ACIItem wrapperEntryPoint() throws RecognitionException, TokenStreamException {
182 ACIItem l_ACIItem ;
183
184
185 log.debug( "entered wrapperEntryPoint()" );
186 l_ACIItem = null;
187
188
189 {
190 _loop3:
191 do {
192 if ((LA(1)==SP)) {
193 match(SP);
194 }
195 else {
196 break _loop3;
197 }
198
199 } while (true);
200 }
201 l_ACIItem=theACIItem();
202 {
203 _loop5:
204 do {
205 if ((LA(1)==SP)) {
206 match(SP);
207 }
208 else {
209 break _loop5;
210 }
211
212 } while (true);
213 }
214 match(Token.EOF_TYPE);
215 return l_ACIItem ;
216 }
217
218 public final ACIItem theACIItem() throws RecognitionException, TokenStreamException {
219 ACIItem ACIItem ;
220
221
222 log.debug( "entered theACIItem()" );
223 ACIItem = null;
224 mainACIItemComponentsMonitor = new MandatoryComponentsMonitor(
225 new String [] { "identificationTag", "precedence", "authenticationLevel", "itemOrUserFirst" } );
226
227
228 match(OPEN_CURLY);
229 {
230 _loop8:
231 do {
232 if ((LA(1)==SP)) {
233 match(SP);
234 }
235 else {
236 break _loop8;
237 }
238
239 } while (true);
240 }
241 mainACIItemComponent();
242 {
243 _loop10:
244 do {
245 if ((LA(1)==SP)) {
246 match(SP);
247 }
248 else {
249 break _loop10;
250 }
251
252 } while (true);
253 }
254 {
255 _loop16:
256 do {
257 if ((LA(1)==SEP)) {
258 match(SEP);
259 {
260 _loop13:
261 do {
262 if ((LA(1)==SP)) {
263 match(SP);
264 }
265 else {
266 break _loop13;
267 }
268
269 } while (true);
270 }
271 mainACIItemComponent();
272 {
273 _loop15:
274 do {
275 if ((LA(1)==SP)) {
276 match(SP);
277 }
278 else {
279 break _loop15;
280 }
281
282 } while (true);
283 }
284 }
285 else {
286 break _loop16;
287 }
288
289 } while (true);
290 }
291 match(CLOSE_CURLY);
292
293 if ( !mainACIItemComponentsMonitor.finalStateValid() )
294 {
295 throw new RecognitionException( "Missing mandatory ACIItem components: "
296 + mainACIItemComponentsMonitor.getRemainingComponents() );
297 }
298
299 if ( isItemFirstACIItem )
300 {
301 ACIItem = new ItemFirstACIItem(
302 identificationTag,
303 aciPrecedence,
304 authenticationLevel,
305 protectedItems,
306 itemPermissions );
307 }
308 else
309 {
310 ACIItem = new UserFirstACIItem(
311 identificationTag,
312 aciPrecedence,
313 authenticationLevel,
314 userClasses,
315 userPermissions );
316 }
317
318
319 return ACIItem ;
320 }
321
322 public final void mainACIItemComponent() throws RecognitionException, TokenStreamException {
323
324
325 log.debug( "entered mainACIItemComponent()" );
326
327
328 try { // for error handling
329 switch ( LA(1)) {
330 case ID_identificationTag:
331 {
332 aci_identificationTag();
333
334 mainACIItemComponentsMonitor.useComponent( "identificationTag" );
335
336 break;
337 }
338 case ID_precedence:
339 {
340 aci_precedence();
341
342 mainACIItemComponentsMonitor.useComponent( "precedence" );
343
344 break;
345 }
346 case ID_authenticationLevel:
347 {
348 aci_authenticationLevel();
349
350 mainACIItemComponentsMonitor.useComponent( "authenticationLevel" );
351
352 break;
353 }
354 case ID_itemOrUserFirst:
355 {
356 aci_itemOrUserFirst();
357
358 mainACIItemComponentsMonitor.useComponent( "itemOrUserFirst" );
359
360 break;
361 }
362 default:
363 {
364 throw new NoViableAltException(LT(1), getFilename());
365 }
366 }
367 }
368 catch (IllegalArgumentException e) {
369
370 throw new RecognitionException( e.getMessage() );
371
372 }
373 }
374
375 public final void aci_identificationTag() throws RecognitionException, TokenStreamException {
376
377 Token token = null;
378
379 log.debug( "entered aci_identificationTag()" );
380
381
382 match(ID_identificationTag);
383 {
384 int _cnt20=0;
385 _loop20:
386 do {
387 if ((LA(1)==SP)) {
388 match(SP);
389 }
390 else {
391 if ( _cnt20>=1 ) { break _loop20; } else {throw new NoViableAltException(LT(1), getFilename());}
392 }
393
394 _cnt20++;
395 } while (true);
396 }
397 token = LT(1);
398 match(SAFEUTF8STRING);
399
400 identificationTag = token.getText();
401
402 }
403
404 public final void aci_precedence() throws RecognitionException, TokenStreamException {
405
406
407 log.debug( "entered aci_precedence()" );
408
409
410 precedence();
411
412 aciPrecedence = precedence;
413 precedence = -1;
414
415 }
416
417 public final void aci_authenticationLevel() throws RecognitionException, TokenStreamException {
418
419
420 log.debug( "entered aci_authenticationLevel()" );
421
422
423 match(ID_authenticationLevel);
424 {
425 int _cnt27=0;
426 _loop27:
427 do {
428 if ((LA(1)==SP)) {
429 match(SP);
430 }
431 else {
432 if ( _cnt27>=1 ) { break _loop27; } else {throw new NoViableAltException(LT(1), getFilename());}
433 }
434
435 _cnt27++;
436 } while (true);
437 }
438 authenticationLevel();
439 }
440
441 public final void aci_itemOrUserFirst() throws RecognitionException, TokenStreamException {
442
443
444 log.debug( "entered aci_itemOrUserFirst()" );
445
446
447 match(ID_itemOrUserFirst);
448 {
449 int _cnt31=0;
450 _loop31:
451 do {
452 if ((LA(1)==SP)) {
453 match(SP);
454 }
455 else {
456 if ( _cnt31>=1 ) { break _loop31; } else {throw new NoViableAltException(LT(1), getFilename());}
457 }
458
459 _cnt31++;
460 } while (true);
461 }
462 itemOrUserFirst();
463 }
464
465 public final void precedence() throws RecognitionException, TokenStreamException {
466
467 Token token = null;
468
469 log.debug( "entered precedence()" );
470
471
472 match(ID_precedence);
473 {
474 int _cnt24=0;
475 _loop24:
476 do {
477 if ((LA(1)==SP)) {
478 match(SP);
479 }
480 else {
481 if ( _cnt24>=1 ) { break _loop24; } else {throw new NoViableAltException(LT(1), getFilename());}
482 }
483
484 _cnt24++;
485 } while (true);
486 }
487 token = LT(1);
488 match(INTEGER);
489
490 precedence = token2Integer( token );
491
492 if ( ( precedence < 0 ) || ( precedence > 255 ) )
493 {
494 throw new RecognitionException( "Expecting INTEGER token having an Integer value between 0 and 255, found " + precedence );
495 }
496
497 }
498
499 public final void authenticationLevel() throws RecognitionException, TokenStreamException {
500
501
502 log.debug( "entered authenticationLevel()" );
503
504
505 switch ( LA(1)) {
506 case ID_none:
507 {
508 match(ID_none);
509
510 authenticationLevel = AuthenticationLevel.NONE;
511
512 break;
513 }
514 case ID_simple:
515 {
516 match(ID_simple);
517
518 authenticationLevel = AuthenticationLevel.SIMPLE;
519
520 break;
521 }
522 case ID_strong:
523 {
524 match(ID_strong);
525
526 authenticationLevel = AuthenticationLevel.STRONG;
527
528 break;
529 }
530 default:
531 {
532 throw new NoViableAltException(LT(1), getFilename());
533 }
534 }
535 }
536
537 public final void itemOrUserFirst() throws RecognitionException, TokenStreamException {
538
539
540 log.debug( "entered itemOrUserFirst()" );
541
542
543 switch ( LA(1)) {
544 case ID_itemFirst:
545 {
546 itemFirst();
547 break;
548 }
549 case ID_userFirst:
550 {
551 userFirst();
552 break;
553 }
554 default:
555 {
556 throw new NoViableAltException(LT(1), getFilename());
557 }
558 }
559 }
560
561 public final void itemFirst() throws RecognitionException, TokenStreamException {
562
563
564 log.debug( "entered itemFirst()" );
565
566
567 match(ID_itemFirst);
568 {
569 _loop35:
570 do {
571 if ((LA(1)==SP)) {
572 match(SP);
573 }
574 else {
575 break _loop35;
576 }
577
578 } while (true);
579 }
580 match(COLON);
581 {
582 _loop37:
583 do {
584 if ((LA(1)==SP)) {
585 match(SP);
586 }
587 else {
588 break _loop37;
589 }
590
591 } while (true);
592 }
593 match(OPEN_CURLY);
594 {
595 _loop39:
596 do {
597 if ((LA(1)==SP)) {
598 match(SP);
599 }
600 else {
601 break _loop39;
602 }
603
604 } while (true);
605 }
606 {
607 switch ( LA(1)) {
608 case ID_protectedItems:
609 {
610 protectedItems();
611 {
612 _loop42:
613 do {
614 if ((LA(1)==SP)) {
615 match(SP);
616 }
617 else {
618 break _loop42;
619 }
620
621 } while (true);
622 }
623 match(SEP);
624 {
625 _loop44:
626 do {
627 if ((LA(1)==SP)) {
628 match(SP);
629 }
630 else {
631 break _loop44;
632 }
633
634 } while (true);
635 }
636 itemPermissions();
637 break;
638 }
639 case ID_itemPermissions:
640 {
641 itemPermissions();
642 {
643 _loop46:
644 do {
645 if ((LA(1)==SP)) {
646 match(SP);
647 }
648 else {
649 break _loop46;
650 }
651
652 } while (true);
653 }
654 match(SEP);
655 {
656 _loop48:
657 do {
658 if ((LA(1)==SP)) {
659 match(SP);
660 }
661 else {
662 break _loop48;
663 }
664
665 } while (true);
666 }
667 protectedItems();
668 break;
669 }
670 default:
671 {
672 throw new NoViableAltException(LT(1), getFilename());
673 }
674 }
675 }
676 {
677 _loop50:
678 do {
679 if ((LA(1)==SP)) {
680 match(SP);
681 }
682 else {
683 break _loop50;
684 }
685
686 } while (true);
687 }
688 match(CLOSE_CURLY);
689
690 isItemFirstACIItem = true;
691
692 }
693
694 public final void userFirst() throws RecognitionException, TokenStreamException {
695
696
697 log.debug( "entered userFirst()" );
698
699
700 match(ID_userFirst);
701 {
702 _loop53:
703 do {
704 if ((LA(1)==SP)) {
705 match(SP);
706 }
707 else {
708 break _loop53;
709 }
710
711 } while (true);
712 }
713 match(COLON);
714 {
715 _loop55:
716 do {
717 if ((LA(1)==SP)) {
718 match(SP);
719 }
720 else {
721 break _loop55;
722 }
723
724 } while (true);
725 }
726 match(OPEN_CURLY);
727 {
728 _loop57:
729 do {
730 if ((LA(1)==SP)) {
731 match(SP);
732 }
733 else {
734 break _loop57;
735 }
736
737 } while (true);
738 }
739 {
740 switch ( LA(1)) {
741 case ID_userClasses:
742 {
743 userClasses();
744 {
745 _loop60:
746 do {
747 if ((LA(1)==SP)) {
748 match(SP);
749 }
750 else {
751 break _loop60;
752 }
753
754 } while (true);
755 }
756 match(SEP);
757 {
758 _loop62:
759 do {
760 if ((LA(1)==SP)) {
761 match(SP);
762 }
763 else {
764 break _loop62;
765 }
766
767 } while (true);
768 }
769 userPermissions();
770 break;
771 }
772 case ID_userPermissions:
773 {
774 userPermissions();
775 {
776 _loop64:
777 do {
778 if ((LA(1)==SP)) {
779 match(SP);
780 }
781 else {
782 break _loop64;
783 }
784
785 } while (true);
786 }
787 match(SEP);
788 {
789 _loop66:
790 do {
791 if ((LA(1)==SP)) {
792 match(SP);
793 }
794 else {
795 break _loop66;
796 }
797
798 } while (true);
799 }
800 userClasses();
801 break;
802 }
803 default:
804 {
805 throw new NoViableAltException(LT(1), getFilename());
806 }
807 }
808 }
809 {
810 _loop68:
811 do {
812 if ((LA(1)==SP)) {
813 match(SP);
814 }
815 else {
816 break _loop68;
817 }
818
819 } while (true);
820 }
821 match(CLOSE_CURLY);
822
823 isItemFirstACIItem = false;
824
825 }
826
827 public final void protectedItems() throws RecognitionException, TokenStreamException {
828
829
830 log.debug( "entered protectedItems()" );
831 protectedItemsMap = new NoDuplicateKeysMap();
832
833
834 try { // for error handling
835 match(ID_protectedItems);
836 {
837 _loop71:
838 do {
839 if ((LA(1)==SP)) {
840 match(SP);
841 }
842 else {
843 break _loop71;
844 }
845
846 } while (true);
847 }
848 match(OPEN_CURLY);
849 {
850 _loop73:
851 do {
852 if ((LA(1)==SP)) {
853 match(SP);
854 }
855 else {
856 break _loop73;
857 }
858
859 } while (true);
860 }
861 {
862 switch ( LA(1)) {
863 case ATTRIBUTE_VALUE_CANDIDATE:
864 case RANGE_OF_VALUES_CANDIDATE:
865 case ID_entry:
866 case ID_allUserAttributeTypes:
867 case ID_attributeType:
868 case ID_allAttributeValues:
869 case ID_allUserAttributeTypesAndValues:
870 case ID_selfValue:
871 case ID_maxValueCount:
872 case ID_maxImmSub:
873 case ID_restrictedBy:
874 case ID_classes:
875 {
876 protectedItem();
877 {
878 _loop76:
879 do {
880 if ((LA(1)==SP)) {
881 match(SP);
882 }
883 else {
884 break _loop76;
885 }
886
887 } while (true);
888 }
889 {
890 _loop82:
891 do {
892 if ((LA(1)==SEP)) {
893 match(SEP);
894 {
895 _loop79:
896 do {
897 if ((LA(1)==SP)) {
898 match(SP);
899 }
900 else {
901 break _loop79;
902 }
903
904 } while (true);
905 }
906 protectedItem();
907 {
908 _loop81:
909 do {
910 if ((LA(1)==SP)) {
911 match(SP);
912 }
913 else {
914 break _loop81;
915 }
916
917 } while (true);
918 }
919 }
920 else {
921 break _loop82;
922 }
923
924 } while (true);
925 }
926 break;
927 }
928 case CLOSE_CURLY:
929 {
930 break;
931 }
932 default:
933 {
934 throw new NoViableAltException(LT(1), getFilename());
935 }
936 }
937 }
938 match(CLOSE_CURLY);
939
940 protectedItems = new HashSet<ProtectedItem>( protectedItemsMap.values() );
941
942 }
943 catch (IllegalArgumentException e) {
944
945 throw new RecognitionException( "Protected Items cannot be duplicated. " + e.getMessage() );
946
947 }
948 }
949
950 public final void itemPermissions() throws RecognitionException, TokenStreamException {
951
952
953 log.debug( "entered itemPermissions()" );
954 itemPermissions = new HashSet<ItemPermission>();
955 ItemPermission itemPermission = null;
956
957
958 match(ID_itemPermissions);
959 {
960 int _cnt187=0;
961 _loop187:
962 do {
963 if ((LA(1)==SP)) {
964 match(SP);
965 }
966 else {
967 if ( _cnt187>=1 ) { break _loop187; } else {throw new NoViableAltException(LT(1), getFilename());}
968 }
969
970 _cnt187++;
971 } while (true);
972 }
973 match(OPEN_CURLY);
974 {
975 _loop189:
976 do {
977 if ((LA(1)==SP)) {
978 match(SP);
979 }
980 else {
981 break _loop189;
982 }
983
984 } while (true);
985 }
986 {
987 switch ( LA(1)) {
988 case OPEN_CURLY:
989 {
990 itemPermission=itemPermission();
991 {
992 _loop192:
993 do {
994 if ((LA(1)==SP)) {
995 match(SP);
996 }
997 else {
998 break _loop192;
999 }
1000
1001 } while (true);
1002 }
1003
1004 itemPermissions.add( itemPermission );
1005
1006 {
1007 _loop198:
1008 do {
1009 if ((LA(1)==SEP)) {
1010 match(SEP);
1011 {
1012 _loop195:
1013 do {
1014 if ((LA(1)==SP)) {
1015 match(SP);
1016 }
1017 else {
1018 break _loop195;
1019 }
1020
1021 } while (true);
1022 }
1023 itemPermission=itemPermission();
1024 {
1025 _loop197:
1026 do {
1027 if ((LA(1)==SP)) {
1028 match(SP);
1029 }
1030 else {
1031 break _loop197;
1032 }
1033
1034 } while (true);
1035 }
1036
1037 itemPermissions.add( itemPermission );
1038
1039 }
1040 else {
1041 break _loop198;
1042 }
1043
1044 } while (true);
1045 }
1046 break;
1047 }
1048 case CLOSE_CURLY:
1049 {
1050 break;
1051 }
1052 default:
1053 {
1054 throw new NoViableAltException(LT(1), getFilename());
1055 }
1056 }
1057 }
1058 match(CLOSE_CURLY);
1059 }
1060
1061 public final void userClasses() throws RecognitionException, TokenStreamException {
1062
1063
1064 log.debug( "entered userClasses()" );
1065 userClassesMap = new NoDuplicateKeysMap();
1066
1067
1068 try { // for error handling
1069 match(ID_userClasses);
1070 {
1071 int _cnt228=0;
1072 _loop228:
1073 do {
1074 if ((LA(1)==SP)) {
1075 match(SP);
1076 }
1077 else {
1078 if ( _cnt228>=1 ) { break _loop228; } else {throw new NoViableAltException(LT(1), getFilename());}
1079 }
1080
1081 _cnt228++;
1082 } while (true);
1083 }
1084 match(OPEN_CURLY);
1085 {
1086 _loop230:
1087 do {
1088 if ((LA(1)==SP)) {
1089 match(SP);
1090 }
1091 else {
1092 break _loop230;
1093 }
1094
1095 } while (true);
1096 }
1097 {
1098 switch ( LA(1)) {
1099 case ID_allUsers:
1100 case ID_thisEntry:
1101 case ID_parentOfEntry:
1102 case ID_name:
1103 case ID_userGroup:
1104 case ID_subtree:
1105 {
1106 userClass();
1107 {
1108 _loop233:
1109 do {
1110 if ((LA(1)==SP)) {
1111 match(SP);
1112 }
1113 else {
1114 break _loop233;
1115 }
1116
1117 } while (true);
1118 }
1119 {
1120 _loop239:
1121 do {
1122 if ((LA(1)==SEP)) {
1123 match(SEP);
1124 {
1125 _loop236:
1126 do {
1127 if ((LA(1)==SP)) {
1128 match(SP);
1129 }
1130 else {
1131 break _loop236;
1132 }
1133
1134 } while (true);
1135 }
1136 userClass();
1137 {
1138 _loop238:
1139 do {
1140 if ((LA(1)==SP)) {
1141 match(SP);
1142 }
1143 else {
1144 break _loop238;
1145 }
1146
1147 } while (true);
1148 }
1149 }
1150 else {
1151 break _loop239;
1152 }
1153
1154 } while (true);
1155 }
1156 break;
1157 }
1158 case CLOSE_CURLY:
1159 {
1160 break;
1161 }
1162 default:
1163 {
1164 throw new NoViableAltException(LT(1), getFilename());
1165 }
1166 }
1167 }
1168 match(CLOSE_CURLY);
1169
1170 userClasses = new HashSet<UserClass>( userClassesMap.values() );
1171
1172 }
1173 catch (IllegalArgumentException e) {
1174
1175 throw new RecognitionException( "User Classes cannot be duplicated. " + e.getMessage() );
1176
1177 }
1178 }
1179
1180 public final void userPermissions() throws RecognitionException, TokenStreamException {
1181
1182
1183 log.debug( "entered userPermissions()" );
1184 userPermissions = new HashSet<UserPermission>();
1185 UserPermission userPermission = null;
1186
1187
1188 match(ID_userPermissions);
1189 {
1190 int _cnt285=0;
1191 _loop285:
1192 do {
1193 if ((LA(1)==SP)) {
1194 match(SP);
1195 }
1196 else {
1197 if ( _cnt285>=1 ) { break _loop285; } else {throw new NoViableAltException(LT(1), getFilename());}
1198 }
1199
1200 _cnt285++;
1201 } while (true);
1202 }
1203 match(OPEN_CURLY);
1204 {
1205 _loop287:
1206 do {
1207 if ((LA(1)==SP)) {
1208 match(SP);
1209 }
1210 else {
1211 break _loop287;
1212 }
1213
1214 } while (true);
1215 }
1216 {
1217 switch ( LA(1)) {
1218 case OPEN_CURLY:
1219 {
1220 userPermission=userPermission();
1221 {
1222 _loop290:
1223 do {
1224 if ((LA(1)==SP)) {
1225 match(SP);
1226 }
1227 else {
1228 break _loop290;
1229 }
1230
1231 } while (true);
1232 }
1233
1234 userPermissions.add( userPermission );
1235
1236 {
1237 _loop296:
1238 do {
1239 if ((LA(1)==SEP)) {
1240 match(SEP);
1241 {
1242 _loop293:
1243 do {
1244 if ((LA(1)==SP)) {
1245 match(SP);
1246 }
1247 else {
1248 break _loop293;
1249 }
1250
1251 } while (true);
1252 }
1253 userPermission=userPermission();
1254 {
1255 _loop295:
1256 do {
1257 if ((LA(1)==SP)) {
1258 match(SP);
1259 }
1260 else {
1261 break _loop295;
1262 }
1263
1264 } while (true);
1265 }
1266
1267 userPermissions.add( userPermission );
1268
1269 }
1270 else {
1271 break _loop296;
1272 }
1273
1274 } while (true);
1275 }
1276 break;
1277 }
1278 case CLOSE_CURLY:
1279 {
1280 break;
1281 }
1282 default:
1283 {
1284 throw new NoViableAltException(LT(1), getFilename());
1285 }
1286 }
1287 }
1288 match(CLOSE_CURLY);
1289 }
1290
1291 public final void protectedItem() throws RecognitionException, TokenStreamException {
1292
1293
1294 log.debug( "entered protectedItem()" );
1295
1296
1297 switch ( LA(1)) {
1298 case ID_entry:
1299 {
1300 entry();
1301 break;
1302 }
1303 case ID_allUserAttributeTypes:
1304 {
1305 allUserAttributeTypes();
1306 break;
1307 }
1308 case ID_attributeType:
1309 {
1310 attributeType();
1311 break;
1312 }
1313 case ID_allAttributeValues:
1314 {
1315 allAttributeValues();
1316 break;
1317 }
1318 case ID_allUserAttributeTypesAndValues:
1319 {
1320 allUserAttributeTypesAndValues();
1321 break;
1322 }
1323 case ATTRIBUTE_VALUE_CANDIDATE:
1324 {
1325 attributeValue();
1326 break;
1327 }
1328 case ID_selfValue:
1329 {
1330 selfValue();
1331 break;
1332 }
1333 case RANGE_OF_VALUES_CANDIDATE:
1334 {
1335 rangeOfValues();
1336 break;
1337 }
1338 case ID_maxValueCount:
1339 {
1340 maxValueCount();
1341 break;
1342 }
1343 case ID_maxImmSub:
1344 {
1345 maxImmSub();
1346 break;
1347 }
1348 case ID_restrictedBy:
1349 {
1350 restrictedBy();
1351 break;
1352 }
1353 case ID_classes:
1354 {
1355 classes();
1356 break;
1357 }
1358 default:
1359 {
1360 throw new NoViableAltException(LT(1), getFilename());
1361 }
1362 }
1363 }
1364
1365 public final void entry() throws RecognitionException, TokenStreamException {
1366
1367
1368 log.debug( "entered entry()" );
1369
1370
1371 match(ID_entry);
1372
1373 protectedItemsMap.put( "entry", ProtectedItem.ENTRY );
1374
1375 }
1376
1377 public final void allUserAttributeTypes() throws RecognitionException, TokenStreamException {
1378
1379
1380 log.debug( "entered allUserAttributeTypes()" );
1381
1382
1383 match(ID_allUserAttributeTypes);
1384
1385 protectedItemsMap.put( "allUserAttributeTypes", ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
1386
1387 }
1388
1389 public final void attributeType() throws RecognitionException, TokenStreamException {
1390
1391
1392 log.debug( "entered attributeType()" );
1393 Set<String> attributeTypeSet = null;
1394
1395
1396 match(ID_attributeType);
1397 {
1398 int _cnt88=0;
1399 _loop88:
1400 do {
1401 if ((LA(1)==SP)) {
1402 match(SP);
1403 }
1404 else {
1405 if ( _cnt88>=1 ) { break _loop88; } else {throw new NoViableAltException(LT(1), getFilename());}
1406 }
1407
1408 _cnt88++;
1409 } while (true);
1410 }
1411 attributeTypeSet=attributeTypeSet();
1412
1413 protectedItemsMap.put( "attributeType", new ProtectedItem.AttributeType(attributeTypeSet ) );
1414
1415 }
1416
1417 public final void allAttributeValues() throws RecognitionException, TokenStreamException {
1418
1419
1420 log.debug( "entered allAttributeValues()" );
1421 Set<String> attributeTypeSet = null;
1422
1423
1424 match(ID_allAttributeValues);
1425 {
1426 int _cnt91=0;
1427 _loop91:
1428 do {
1429 if ((LA(1)==SP)) {
1430 match(SP);
1431 }
1432 else {
1433 if ( _cnt91>=1 ) { break _loop91; } else {throw new NoViableAltException(LT(1), getFilename());}
1434 }
1435
1436 _cnt91++;
1437 } while (true);
1438 }
1439 attributeTypeSet=attributeTypeSet();
1440
1441 protectedItemsMap.put( "allAttributeValues", new ProtectedItem.AllAttributeValues( attributeTypeSet ) );
1442
1443 }
1444
1445 public final void allUserAttributeTypesAndValues() throws RecognitionException, TokenStreamException {
1446
1447
1448 log.debug( "entered allUserAttributeTypesAndValues()" );
1449
1450
1451 match(ID_allUserAttributeTypesAndValues);
1452
1453 protectedItemsMap.put( "allUserAttributeTypesAndValues", ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
1454
1455 }
1456
1457 public final void attributeValue() throws RecognitionException, TokenStreamException {
1458
1459 Token token = null;
1460
1461 log.debug( "entered attributeValue()" );
1462 String attributeTypeAndValue = null;
1463 String attributeType = null;
1464 String attributeValue = null;
1465 Set<Attribute> attributeSet = new HashSet<Attribute>();
1466
1467
1468 try { // for error handling
1469 token = LT(1);
1470 match(ATTRIBUTE_VALUE_CANDIDATE);
1471
1472 // A Dn can be considered as a set of attributeTypeAndValues
1473 // So, parse the set as a Dn and extract each attributeTypeAndValue
1474 LdapDN attributeTypeAndValueSetAsDn = new LdapDN( token.getText() );
1475
1476 if ( oidsMap != null )
1477 {
1478 attributeTypeAndValueSetAsDn.normalize( oidsMap );
1479 }
1480
1481 Enumeration attributeTypeAndValueSet = attributeTypeAndValueSetAsDn.getAll();
1482
1483 while ( attributeTypeAndValueSet.hasMoreElements() )
1484 {
1485 attributeTypeAndValue = ( String ) attributeTypeAndValueSet.nextElement();
1486 attributeType = NamespaceTools.getRdnAttribute( attributeTypeAndValue );
1487 attributeValue = NamespaceTools.getRdnValue( attributeTypeAndValue );
1488 attributeSet.add( new BasicAttribute( attributeType, attributeValue ) );
1489 log.debug( "An attributeTypeAndValue from the set: " + attributeType + "=" + attributeValue);
1490 }
1491
1492 protectedItemsMap.put( "attributeValue", new ProtectedItem.AttributeValue( attributeSet ) );
1493
1494 }
1495 catch (Exception e) {
1496
1497 throw new RecognitionException( "dnParser failed for " + token.getText() + " , " + e.getMessage() );
1498
1499 }
1500 }
1501
1502 public final void selfValue() throws RecognitionException, TokenStreamException {
1503
1504
1505 log.debug( "entered selfValue()" );
1506 Set<String> attributeTypeSet = null;
1507
1508
1509 match(ID_selfValue);
1510 {
1511 int _cnt96=0;
1512 _loop96:
1513 do {
1514 if ((LA(1)==SP)) {
1515 match(SP);
1516 }
1517 else {
1518 if ( _cnt96>=1 ) { break _loop96; } else {throw new NoViableAltException(LT(1), getFilename());}
1519 }
1520
1521 _cnt96++;
1522 } while (true);
1523 }
1524 attributeTypeSet=attributeTypeSet();
1525
1526 protectedItemsMap.put( "sefValue", new ProtectedItem.SelfValue( attributeTypeSet ) );
1527
1528 }
1529
1530 public final void rangeOfValues() throws RecognitionException, TokenStreamException {
1531
1532 Token token = null;
1533
1534 log.debug( "entered rangeOfValues()" );
1535
1536
1537 try { // for error handling
1538 token = LT(1);
1539 match(RANGE_OF_VALUES_CANDIDATE);
1540
1541 protectedItemsMap.put( "rangeOfValues",
1542 new ProtectedItem.RangeOfValues(
1543 FilterParser.parse( token.getText() ) ) );
1544 log.debug( "filterParser parsed " + token.getText() );
1545
1546 }
1547 catch (Exception e) {
1548
1549 throw new RecognitionException( "filterParser failed. " + e.getMessage() );
1550
1551 }
1552 }
1553
1554 public final void maxValueCount() throws RecognitionException, TokenStreamException {
1555
1556
1557 log.debug( "entered maxValueCount()" );
1558 ProtectedItem.MaxValueCountItem maxValueCount = null;
1559 Set<ProtectedItem.MaxValueCountItem> maxValueCountSet = new HashSet<ProtectedItem.MaxValueCountItem>();
1560
1561
1562 match(ID_maxValueCount);
1563 {
1564 int _cnt100=0;
1565 _loop100:
1566 do {
1567 if ((LA(1)==SP)) {
1568 match(SP);
1569 }
1570 else {
1571 if ( _cnt100>=1 ) { break _loop100; } else {throw new NoViableAltException(LT(1), getFilename());}
1572 }
1573
1574 _cnt100++;
1575 } while (true);
1576 }
1577 match(OPEN_CURLY);
1578 {
1579 _loop102:
1580 do {
1581 if ((LA(1)==SP)) {
1582 match(SP);
1583 }
1584 else {
1585 break _loop102;
1586 }
1587
1588 } while (true);
1589 }
1590 maxValueCount=aMaxValueCount();
1591 {
1592 _loop104:
1593 do {
1594 if ((LA(1)==SP)) {
1595 match(SP);
1596 }
1597 else {
1598 break _loop104;
1599 }
1600
1601 } while (true);
1602 }
1603
1604 maxValueCountSet.add( maxValueCount );
1605
1606 {
1607 _loop110:
1608 do {
1609 if ((LA(1)==SEP)) {
1610 match(SEP);
1611 {
1612 _loop107:
1613 do {
1614 if ((LA(1)==SP)) {
1615 match(SP);
1616 }
1617 else {
1618 break _loop107;
1619 }
1620
1621 } while (true);
1622 }
1623 maxValueCount=aMaxValueCount();
1624 {
1625 _loop109:
1626 do {
1627 if ((LA(1)==SP)) {
1628 match(SP);
1629 }
1630 else {
1631 break _loop109;
1632 }
1633
1634 } while (true);
1635 }
1636
1637 maxValueCountSet.add( maxValueCount );
1638
1639 }
1640 else {
1641 break _loop110;
1642 }
1643
1644 } while (true);
1645 }
1646 match(CLOSE_CURLY);
1647
1648 protectedItemsMap.put( "maxValueCount", new ProtectedItem.MaxValueCount( maxValueCountSet ) );
1649
1650 }
1651
1652 public final void maxImmSub() throws RecognitionException, TokenStreamException {
1653
1654 Token token = null;
1655
1656 log.debug( "entered maxImmSub()" );
1657
1658
1659 match(ID_maxImmSub);
1660 {
1661 int _cnt135=0;
1662 _loop135:
1663 do {
1664 if ((LA(1)==SP)) {
1665 match(SP);
1666 }
1667 else {
1668 if ( _cnt135>=1 ) { break _loop135; } else {throw new NoViableAltException(LT(1), getFilename());}
1669 }
1670
1671 _cnt135++;
1672 } while (true);
1673 }
1674 token = LT(1);
1675 match(INTEGER);
1676
1677
1678 protectedItemsMap.put( "maxImmSub",
1679 new ProtectedItem.MaxImmSub(
1680 token2Integer( token ) ) );
1681
1682 }
1683
1684 public final void restrictedBy() throws RecognitionException, TokenStreamException {
1685
1686
1687 log.debug( "entered restrictedBy()" );
1688 ProtectedItem.RestrictedByItem restrictedValue = null;
1689 Set<ProtectedItem.RestrictedByItem> restrictedBy = new HashSet<ProtectedItem.RestrictedByItem>();
1690
1691
1692 match(ID_restrictedBy);
1693 {
1694 int _cnt138=0;
1695 _loop138:
1696 do {
1697 if ((LA(1)==SP)) {
1698 match(SP);
1699 }
1700 else {
1701 if ( _cnt138>=1 ) { break _loop138; } else {throw new NoViableAltException(LT(1), getFilename());}
1702 }
1703
1704 _cnt138++;
1705 } while (true);
1706 }
1707 match(OPEN_CURLY);
1708 {
1709 _loop140:
1710 do {
1711 if ((LA(1)==SP)) {
1712 match(SP);
1713 }
1714 else {
1715 break _loop140;
1716 }
1717
1718 } while (true);
1719 }
1720 restrictedValue=restrictedValue();
1721 {
1722 _loop142:
1723 do {
1724 if ((LA(1)==SP)) {
1725 match(SP);
1726 }
1727 else {
1728 break _loop142;
1729 }
1730
1731 } while (true);
1732 }
1733
1734 restrictedBy.add( restrictedValue );
1735
1736 {
1737 _loop148:
1738 do {
1739 if ((LA(1)==SEP)) {
1740 match(SEP);
1741 {
1742 _loop145:
1743 do {
1744 if ((LA(1)==SP)) {
1745 match(SP);
1746 }
1747 else {
1748 break _loop145;
1749 }
1750
1751 } while (true);
1752 }
1753 restrictedValue=restrictedValue();
1754 {
1755 _loop147:
1756 do {
1757 if ((LA(1)==SP)) {
1758 match(SP);
1759 }
1760 else {
1761 break _loop147;
1762 }
1763
1764 } while (true);
1765 }
1766
1767 restrictedBy.add( restrictedValue );
1768
1769 }
1770 else {
1771 break _loop148;
1772 }
1773
1774 } while (true);
1775 }
1776 match(CLOSE_CURLY);
1777
1778 protectedItemsMap.put( "restrictedBy", new ProtectedItem.RestrictedBy( restrictedBy ) );
1779
1780 }
1781
1782 public final void classes() throws RecognitionException, TokenStreamException {
1783
1784
1785 log.debug( "entered classes()" );
1786 ExprNode classes = null;
1787
1788
1789 match(ID_classes);
1790 {
1791 int _cnt184=0;
1792 _loop184:
1793 do {
1794 if ((LA(1)==SP)) {
1795 match(SP);
1796 }
1797 else {
1798 if ( _cnt184>=1 ) { break _loop184; } else {throw new NoViableAltException(LT(1), getFilename());}
1799 }
1800
1801 _cnt184++;
1802 } while (true);
1803 }
1804 classes=refinement();
1805
1806 protectedItemsMap.put( "classes", new ProtectedItem.Classes( classes ) );
1807
1808 }
1809
1810 public final Set<String> attributeTypeSet() throws RecognitionException, TokenStreamException {
1811 Set<String> attributeTypeSet ;
1812
1813
1814 log.debug( "entered attributeTypeSet()" );
1815 String oid = null;
1816 attributeTypeSet = new HashSet<String>();
1817
1818
1819 match(OPEN_CURLY);
1820 {
1821 _loop173:
1822 do {
1823 if ((LA(1)==SP)) {
1824 match(SP);
1825 }
1826 else {
1827 break _loop173;
1828 }
1829
1830 } while (true);
1831 }
1832 oid=oid();
1833 {
1834 _loop175:
1835 do {
1836 if ((LA(1)==SP)) {
1837 match(SP);
1838 }
1839 else {
1840 break _loop175;
1841 }
1842
1843 } while (true);
1844 }
1845
1846 attributeTypeSet.add( oid );
1847
1848 {
1849 _loop181:
1850 do {
1851 if ((LA(1)==SEP)) {
1852 match(SEP);
1853 {
1854 _loop178:
1855 do {
1856 if ((LA(1)==SP)) {
1857 match(SP);
1858 }
1859 else {
1860 break _loop178;
1861 }
1862
1863 } while (true);
1864 }
1865 oid=oid();
1866 {
1867 _loop180:
1868 do {
1869 if ((LA(1)==SP)) {
1870 match(SP);
1871 }
1872 else {
1873 break _loop180;
1874 }
1875
1876 } while (true);
1877 }
1878
1879 attributeTypeSet.add( oid );
1880
1881 }
1882 else {
1883 break _loop181;
1884 }
1885
1886 } while (true);
1887 }
1888 match(CLOSE_CURLY);
1889 return attributeTypeSet ;
1890 }
1891
1892 public final ProtectedItem.MaxValueCountItem aMaxValueCount() throws RecognitionException, TokenStreamException {
1893 ProtectedItem.MaxValueCountItem maxValueCount ;
1894
1895 Token token1 = null;
1896 Token token2 = null;
1897
1898 log.debug( "entered aMaxValueCount()" );
1899 maxValueCount = null;
1900 String oid = null;
1901 Token token = null;
1902
1903
1904 match(OPEN_CURLY);
1905 {
1906 _loop113:
1907 do {
1908 if ((LA(1)==SP)) {
1909 match(SP);
1910 }
1911 else {
1912 break _loop113;
1913 }
1914
1915 } while (true);
1916 }
1917 {
1918 switch ( LA(1)) {
1919 case ID_type:
1920 {
1921 match(ID_type);
1922 {
1923 int _cnt116=0;
1924 _loop116:
1925 do {
1926 if ((LA(1)==SP)) {
1927 match(SP);
1928 }
1929 else {
1930 if ( _cnt116>=1 ) { break _loop116; } else {throw new NoViableAltException(LT(1), getFilename());}
1931 }
1932
1933 _cnt116++;
1934 } while (true);
1935 }
1936 oid=oid();
1937 {
1938 _loop118:
1939 do {
1940 if ((LA(1)==SP)) {
1941 match(SP);
1942 }
1943 else {
1944 break _loop118;
1945 }
1946
1947 } while (true);
1948 }
1949 match(SEP);
1950 {
1951 _loop120:
1952 do {
1953 if ((LA(1)==SP)) {
1954 match(SP);
1955 }
1956 else {
1957 break _loop120;
1958 }
1959
1960 } while (true);
1961 }
1962 match(ID_maxCount);
1963 {
1964 int _cnt122=0;
1965 _loop122:
1966 do {
1967 if ((LA(1)==SP)) {
1968 match(SP);
1969 }
1970 else {
1971 if ( _cnt122>=1 ) { break _loop122; } else {throw new NoViableAltException(LT(1), getFilename());}
1972 }
1973
1974 _cnt122++;
1975 } while (true);
1976 }
1977 token1 = LT(1);
1978 match(INTEGER);
1979 token = token1;
1980 break;
1981 }
1982 case ID_maxCount:
1983 {
1984 match(ID_maxCount);
1985 {
1986 int _cnt124=0;
1987 _loop124:
1988 do {
1989 if ((LA(1)==SP)) {
1990 match(SP);
1991 }
1992 else {
1993 if ( _cnt124>=1 ) { break _loop124; } else {throw new NoViableAltException(LT(1), getFilename());}
1994 }
1995
1996 _cnt124++;
1997 } while (true);
1998 }
1999 token2 = LT(1);
2000 match(INTEGER);
2001 {
2002 _loop126:
2003 do {
2004 if ((LA(1)==SP)) {
2005 match(SP);
2006 }
2007 else {
2008 break _loop126;
2009 }
2010
2011 } while (true);
2012 }
2013 match(SEP);
2014 {
2015 _loop128:
2016 do {
2017 if ((LA(1)==SP)) {
2018 match(SP);
2019 }
2020 else {
2021 break _loop128;
2022 }
2023
2024 } while (true);
2025 }
2026 match(ID_type);
2027 {
2028 int _cnt130=0;
2029 _loop130:
2030 do {
2031 if ((LA(1)==SP)) {
2032 match(SP);
2033 }
2034 else {
2035 if ( _cnt130>=1 ) { break _loop130; } else {throw new NoViableAltException(LT(1), getFilename());}
2036 }
2037
2038 _cnt130++;
2039 } while (true);
2040 }
2041 oid=oid();
2042 token = token2;
2043 break;
2044 }
2045 default:
2046 {
2047 throw new NoViableAltException(LT(1), getFilename());
2048 }
2049 }
2050 }
2051 {
2052 _loop132:
2053 do {
2054 if ((LA(1)==SP)) {
2055 match(SP);
2056 }
2057 else {
2058 break _loop132;
2059 }
2060
2061 } while (true);
2062 }
2063 match(CLOSE_CURLY);
2064
2065 maxValueCount = new ProtectedItem.MaxValueCountItem( oid, token2Integer( token ) );
2066
2067 return maxValueCount ;
2068 }
2069
2070 public final String oid() throws RecognitionException, TokenStreamException {
2071 String result ;
2072
2073
2074 log.debug( "entered oid()" );
2075 result = null;
2076 Token token = null;
2077
2078
2079 token = LT( 1 );
2080 {
2081 switch ( LA(1)) {
2082 case DESCR:
2083 {
2084 match(DESCR);
2085 break;
2086 }
2087 case NUMERICOID:
2088 {
2089 match(NUMERICOID);
2090 break;
2091 }
2092 default:
2093 {
2094 throw new NoViableAltException(LT(1), getFilename());
2095 }
2096 }
2097 }
2098
2099 result = token.getText();
2100 log.debug( "recognized an oid: " + result );
2101
2102 return result ;
2103 }
2104
2105 public final ProtectedItem.RestrictedByItem restrictedValue() throws RecognitionException, TokenStreamException {
2106 ProtectedItem.RestrictedByItem restrictedValue ;
2107
2108
2109 log.debug( "entered restrictedValue()" );
2110 String typeOid = null;
2111 String valuesInOid = null;
2112 restrictedValue = null;
2113
2114
2115 match(OPEN_CURLY);
2116 {
2117 _loop151:
2118 do {
2119 if ((LA(1)==SP)) {
2120 match(SP);
2121 }
2122 else {
2123 break _loop151;
2124 }
2125
2126 } while (true);
2127 }
2128 {
2129 switch ( LA(1)) {
2130 case ID_type:
2131 {
2132 match(ID_type);
2133 {
2134 int _cnt154=0;
2135 _loop154:
2136 do {
2137 if ((LA(1)==SP)) {
2138 match(SP);
2139 }
2140 else {
2141 if ( _cnt154>=1 ) { break _loop154; } else {throw new NoViableAltException(LT(1), getFilename());}
2142 }
2143
2144 _cnt154++;
2145 } while (true);
2146 }
2147 typeOid=oid();
2148 {
2149 _loop156:
2150 do {
2151 if ((LA(1)==SP)) {
2152 match(SP);
2153 }
2154 else {
2155 break _loop156;
2156 }
2157
2158 } while (true);
2159 }
2160 match(SEP);
2161 {
2162 _loop158:
2163 do {
2164 if ((LA(1)==SP)) {
2165 match(SP);
2166 }
2167 else {
2168 break _loop158;
2169 }
2170
2171 } while (true);
2172 }
2173 match(ID_valuesIn);
2174 {
2175 int _cnt160=0;
2176 _loop160:
2177 do {
2178 if ((LA(1)==SP)) {
2179 match(SP);
2180 }
2181 else {
2182 if ( _cnt160>=1 ) { break _loop160; } else {throw new NoViableAltException(LT(1), getFilename());}
2183 }
2184
2185 _cnt160++;
2186 } while (true);
2187 }
2188 valuesInOid=oid();
2189 break;
2190 }
2191 case ID_valuesIn:
2192 {
2193 match(ID_valuesIn);
2194 {
2195 int _cnt162=0;
2196 _loop162:
2197 do {
2198 if ((LA(1)==SP)) {
2199 match(SP);
2200 }
2201 else {
2202 if ( _cnt162>=1 ) { break _loop162; } else {throw new NoViableAltException(LT(1), getFilename());}
2203 }
2204
2205 _cnt162++;
2206 } while (true);
2207 }
2208 valuesInOid=oid();
2209 {
2210 _loop164:
2211 do {
2212 if ((LA(1)==SP)) {
2213 match(SP);
2214 }
2215 else {
2216 break _loop164;
2217 }
2218
2219 } while (true);
2220 }
2221 match(SEP);
2222 {
2223 _loop166:
2224 do {
2225 if ((LA(1)==SP)) {
2226 match(SP);
2227 }
2228 else {
2229 break _loop166;
2230 }
2231
2232 } while (true);
2233 }
2234 match(ID_type);
2235 {
2236 int _cnt168=0;
2237 _loop168:
2238 do {
2239 if ((LA(1)==SP)) {
2240 match(SP);
2241 }
2242 else {
2243 if ( _cnt168>=1 ) { break _loop168; } else {throw new NoViableAltException(LT(1), getFilename());}
2244 }
2245
2246 _cnt168++;
2247 } while (true);
2248 }
2249 typeOid=oid();
2250 break;
2251 }
2252 default:
2253 {
2254 throw new NoViableAltException(LT(1), getFilename());
2255 }
2256 }
2257 }
2258 {
2259 _loop170:
2260 do {
2261 if ((LA(1)==SP)) {
2262 match(SP);
2263 }
2264 else {
2265 break _loop170;
2266 }
2267
2268 } while (true);
2269 }
2270 match(CLOSE_CURLY);
2271
2272 restrictedValue = new ProtectedItem.RestrictedByItem( typeOid, valuesInOid );
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 _loop201:
2327 do {
2328 if ((LA(1)==SP)) {
2329 match(SP);
2330 }
2331 else {
2332 break _loop201;
2333 }
2334
2335 } while (true);
2336 }
2337 anyItemPermission();
2338 {
2339 _loop203:
2340 do {
2341 if ((LA(1)==SP)) {
2342 match(SP);
2343 }
2344 else {
2345 break _loop203;
2346 }
2347
2348 } while (true);
2349 }
2350 {
2351 _loop209:
2352 do {
2353 if ((LA(1)==SEP)) {
2354 match(SEP);
2355 {
2356 _loop206:
2357 do {
2358 if ((LA(1)==SP)) {
2359 match(SP);
2360 }
2361 else {
2362 break _loop206;
2363 }
2364
2365 } while (true);
2366 }
2367 anyItemPermission();
2368 {
2369 _loop208:
2370 do {
2371 if ((LA(1)==SP)) {
2372 match(SP);
2373 }
2374 else {
2375 break _loop208;
2376 }
2377
2378 } while (true);
2379 }
2380 }
2381 else {
2382 break _loop209;
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 = -1;
2397
2398 return itemPermission ;
2399 }
2400
2401 public final void anyItemPermission() throws RecognitionException, TokenStreamException {
2402
2403
2404 try { // for error handling
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 _cnt213=0;
2454 _loop213:
2455 do {
2456 if ((LA(1)==SP)) {
2457 match(SP);
2458 }
2459 else {
2460 if ( _cnt213>=1 ) { break _loop213; } else {throw new NoViableAltException(LT(1), getFilename());}
2461 }
2462
2463 _cnt213++;
2464 } while (true);
2465 }
2466 match(OPEN_CURLY);
2467 {
2468 _loop215:
2469 do {
2470 if ((LA(1)==SP)) {
2471 match(SP);
2472 }
2473 else {
2474 break _loop215;
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 _loop218:
2511 do {
2512 if ((LA(1)==SP)) {
2513 match(SP);
2514 }
2515 else {
2516 break _loop218;
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 _loop224:
2529 do {
2530 if ((LA(1)==SEP)) {
2531 match(SEP);
2532 {
2533 _loop221:
2534 do {
2535 if ((LA(1)==SP)) {
2536 match(SP);
2537 }
2538 else {
2539 break _loop221;
2540 }
2541
2542 } while (true);
2543 }
2544 grantAndDenial=grantAndDenial();
2545 {
2546 _loop223:
2547 do {
2548 if ((LA(1)==SP)) {
2549 match(SP);
2550 }
2551 else {
2552 break _loop223;
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 _loop224;
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<LdapDN> names = new HashSet<LdapDN>();
2843 LdapDN distinguishedName = null;
2844
2845
2846 match(ID_name);
2847 {
2848 int _cnt246=0;
2849 _loop246:
2850 do {
2851 if ((LA(1)==SP)) {
2852 match(SP);
2853 }
2854 else {
2855 if ( _cnt246>=1 ) { break _loop246; } else {throw new NoViableAltException(LT(1), getFilename());}
2856 }
2857
2858 _cnt246++;
2859 } while (true);
2860 }
2861 match(OPEN_CURLY);
2862 {
2863 _loop248:
2864 do {
2865 if ((LA(1)==SP)) {
2866 match(SP);
2867 }
2868 else {
2869 break _loop248;
2870 }
2871
2872 } while (true);
2873 }
2874 distinguishedName=distinguishedName();
2875 {
2876 _loop250:
2877 do {
2878 if ((LA(1)==SP)) {
2879 match(SP);
2880 }
2881 else {
2882 break _loop250;
2883 }
2884
2885 } while (true);
2886 }
2887
2888 names.add( distinguishedName );
2889
2890 {
2891 _loop256:
2892 do {
2893 if ((LA(1)==SEP)) {
2894 match(SEP);
2895 {
2896 _loop253:
2897 do {
2898 if ((LA(1)==SP)) {
2899 match(SP);
2900 }
2901 else {
2902 break _loop253;
2903 }
2904
2905 } while (true);
2906 }
2907 distinguishedName=distinguishedName();
2908 {
2909 _loop255:
2910 do {
2911 if ((LA(1)==SP)) {
2912 match(SP);
2913 }
2914 else {
2915 break _loop255;
2916 }
2917
2918 } while (true);
2919 }
2920
2921 names.add( distinguishedName );
2922
2923 }
2924 else {
2925 break _loop256;
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<LdapDN> userGroup = new HashSet<LdapDN>();
2941 LdapDN distinguishedName = null;
2942
2943
2944 match(ID_userGroup);
2945 {
2946 int _cnt259=0;
2947 _loop259:
2948 do {
2949 if ((LA(1)==SP)) {
2950 match(SP);
2951 }
2952 else {
2953 if ( _cnt259>=1 ) { break _loop259; } else {throw new NoViableAltException(LT(1), getFilename());}
2954 }
2955
2956 _cnt259++;
2957 } while (true);
2958 }
2959 match(OPEN_CURLY);
2960 {
2961 _loop261:
2962 do {
2963 if ((LA(1)==SP)) {
2964 match(SP);
2965 }
2966 else {
2967 break _loop261;
2968 }
2969
2970 } while (true);
2971 }
2972 distinguishedName=distinguishedName();
2973 {
2974 _loop263:
2975 do {
2976 if ((LA(1)==SP)) {
2977 match(SP);
2978 }
2979 else {
2980 break _loop263;
2981 }
2982
2983 } while (true);
2984 }
2985
2986 userGroup.add( distinguishedName );
2987
2988 {
2989 _loop269:
2990 do {
2991 if ((LA(1)==SEP)) {
2992 match(SEP);
2993 {
2994 _loop266:
2995 do {
2996 if ((LA(1)==SP)) {
2997 match(SP);
2998 }
2999 else {
3000 break _loop266;
3001 }
3002
3003 } while (true);
3004 }
3005 distinguishedName=distinguishedName();
3006 {
3007 _loop268:
3008 do {
3009 if ((LA(1)==SP)) {
3010 match(SP);
3011 }
3012 else {
3013 break _loop268;
3014 }
3015
3016 } while (true);
3017 }
3018
3019 userGroup.add( distinguishedName );
3020
3021 }
3022 else {
3023 break _loop269;
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 _cnt272=0;
3045 _loop272:
3046 do {
3047 if ((LA(1)==SP)) {
3048 match(SP);
3049 }
3050 else {
3051 if ( _cnt272>=1 ) { break _loop272; } else {throw new NoViableAltException(LT(1), getFilename());}
3052 }
3053
3054 _cnt272++;
3055 } while (true);
3056 }
3057 match(OPEN_CURLY);
3058 {
3059 _loop274:
3060 do {
3061 if ((LA(1)==SP)) {
3062 match(SP);
3063 }
3064 else {
3065 break _loop274;
3066 }
3067
3068 } while (true);
3069 }
3070 subtreeSpecification=subtreeSpecification();
3071 {
3072 _loop276:
3073 do {
3074 if ((LA(1)==SP)) {
3075 match(SP);
3076 }
3077 else {
3078 break _loop276;
3079 }
3080
3081 } while (true);
3082 }
3083
3084 subtrees.add( subtreeSpecification );
3085
3086 {
3087 _loop282:
3088 do {
3089 if ((LA(1)==SEP)) {
3090 match(SEP);
3091 {
3092 _loop279:
3093 do {
3094 if ((LA(1)==SP)) {
3095 match(SP);
3096 }
3097 else {
3098 break _loop279;
3099 }
3100
3101 } while (true);
3102 }
3103 subtreeSpecification=subtreeSpecification();
3104 {
3105 _loop281:
3106 do {
3107 if ((LA(1)==SP)) {
3108 match(SP);
3109 }
3110 else {
3111 break _loop281;
3112 }
3113
3114 } while (true);
3115 }
3116
3117 subtrees.add( subtreeSpecification );
3118
3119 }
3120 else {
3121 break _loop282;
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 LdapDN distinguishedName() throws RecognitionException, TokenStreamException {
3133 LdapDN name ;
3134
3135 Token token = null;
3136
3137 log.debug( "entered distinguishedName()" );
3138 name = null;
3139
3140
3141 try { // for error handling
3142 token = LT(1);
3143 match(SAFEUTF8STRING);
3144
3145 name = new LdapDN( token.getText() );
3146 if ( oidsMap != null )
3147 {
3148 name.normalize( oidsMap );
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 // clear out ss, ssModifier, chopBeforeExclusions and chopAfterExclusions
3167 // in case something is left from the last parse
3168 ss = null;
3169 ssModifier = new SubtreeSpecificationModifier();
3170 chopBeforeExclusions = new HashSet<LdapDN>();
3171 chopAfterExclusions = new HashSet<LdapDN>();
3172 subtreeSpecificationComponentsMonitor = new OptionalComponentsMonitor(
3173 new String [] { "base", "specificExclusions", "minimum", "maximum" } );
3174
3175
3176 match(OPEN_CURLY);
3177 {
3178 _loop311:
3179 do {
3180 if ((LA(1)==SP)) {
3181 match(SP);
3182 }
3183 else {
3184 break _loop311;
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 _loop314:
3199 do {
3200 if ((LA(1)==SP)) {
3201 match(SP);
3202 }
3203 else {
3204 break _loop314;
3205 }
3206
3207 } while (true);
3208 }
3209 {
3210 _loop320:
3211 do {
3212 if ((LA(1)==SEP)) {
3213 match(SEP);
3214 {
3215 _loop317:
3216 do {
3217 if ((LA(1)==SP)) {
3218 match(SP);
3219 }
3220 else {
3221 break _loop317;
3222 }
3223
3224 } while (true);
3225 }
3226 subtreeSpecificationComponent();
3227 {
3228 _loop319:
3229 do {
3230 if ((LA(1)==SP)) {
3231 match(SP);
3232 }
3233 else {
3234 break _loop319;
3235 }
3236
3237 } while (true);
3238 }
3239 }
3240 else {
3241 break _loop320;
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 _loop299:
3278 do {
3279 if ((LA(1)==SP)) {
3280 match(SP);
3281 }
3282 else {
3283 break _loop299;
3284 }
3285
3286 } while (true);
3287 }
3288 anyUserPermission();
3289 {
3290 _loop301:
3291 do {
3292 if ((LA(1)==SP)) {
3293 match(SP);
3294 }
3295 else {
3296 break _loop301;
3297 }
3298
3299 } while (true);
3300 }
3301 {
3302 _loop307:
3303 do {
3304 if ((LA(1)==SEP)) {
3305 match(SEP);
3306 {
3307 _loop304:
3308 do {
3309 if ((LA(1)==SP)) {
3310 match(SP);
3311 }
3312 else {
3313 break _loop304;
3314 }
3315
3316 } while (true);
3317 }
3318 anyUserPermission();
3319 {
3320 _loop306:
3321 do {
3322 if ((LA(1)==SP)) {
3323 match(SP);
3324 }
3325 else {
3326 break _loop306;
3327 }
3328
3329 } while (true);
3330 }
3331 }
3332 else {
3333 break _loop307;
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 = -1;
3348
3349 return userPermission ;
3350 }
3351
3352 public final void anyUserPermission() throws RecognitionException, TokenStreamException {
3353
3354
3355 try { // for error handling
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 { // for error handling
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 LdapDN base = null;
3452
3453
3454 match(ID_base);
3455 {
3456 int _cnt324=0;
3457 _loop324:
3458 do {
3459 if ((LA(1)==SP)) {
3460 match(SP);
3461 }
3462 else {
3463 if ( _cnt324>=1 ) { break _loop324; } else {throw new NoViableAltException(LT(1), getFilename());}
3464 }
3465
3466 _cnt324++;
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 _cnt327=0;
3484 _loop327:
3485 do {
3486 if ((LA(1)==SP)) {
3487 match(SP);
3488 }
3489 else {
3490 if ( _cnt327>=1 ) { break _loop327; } else {throw new NoViableAltException(LT(1), getFilename());}
3491 }
3492
3493 _cnt327++;
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 _cnt353=0;
3513 _loop353:
3514 do {
3515 if ((LA(1)==SP)) {
3516 match(SP);
3517 }
3518 else {
3519 if ( _cnt353>=1 ) { break _loop353; } else {throw new NoViableAltException(LT(1), getFilename());}
3520 }
3521
3522 _cnt353++;
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 _cnt356=0;
3541 _loop356:
3542 do {
3543 if ((LA(1)==SP)) {
3544 match(SP);
3545 }
3546 else {
3547 if ( _cnt356>=1 ) { break _loop356; } else {throw new NoViableAltException(LT(1), getFilename());}
3548 }
3549
3550 _cnt356++;
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 _loop330:
3568 do {
3569 if ((LA(1)==SP)) {
3570 match(SP);
3571 }
3572 else {
3573 break _loop330;
3574 }
3575
3576 } while (true);
3577 }
3578 {
3579 switch ( LA(1)) {
3580 case ID_chopBefore:
3581 case ID_chopAfter:
3582 {
3583 specificExclusion();
3584 {
3585 _loop333:
3586 do {
3587 if ((LA(1)==SP)) {
3588 match(SP);
3589 }
3590 else {
3591 break _loop333;
3592 }
3593
3594 } while (true);
3595 }
3596 {
3597 _loop339:
3598 do {
3599 if ((LA(1)==SEP)) {
3600 match(SEP);
3601 {
3602 _loop336:
3603 do {
3604 if ((LA(1)==SP)) {
3605 match(SP);
3606 }
3607 else {
3608 break _loop336;
3609 }
3610
3611 } while (true);
3612 }
3613 specificExclusion();
3614 {
3615 _loop338:
3616 do {
3617 if ((LA(1)==SP)) {
3618 match(SP);
3619 }
3620 else {
3621 break _loop338;
3622 }
3623
3624 } while (true);
3625 }
3626 }
3627 else {
3628 break _loop339;
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 LdapDN chopBeforeExclusion = null;
3677
3678
3679 match(ID_chopBefore);
3680 {
3681 _loop343:
3682 do {
3683 if ((LA(1)==SP)) {
3684 match(SP);
3685 }
3686 else {
3687 break _loop343;
3688 }
3689
3690 } while (true);
3691 }
3692 match(COLON);
3693 {
3694 _loop345:
3695 do {
3696 if ((LA(1)==SP)) {
3697 match(SP);
3698 }
3699 else {
3700 break _loop345;
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 LdapDN chopAfterExclusion = null;
3716
3717
3718 match(ID_chopAfter);
3719 {
3720 _loop348:
3721 do {
3722 if ((LA(1)==SP)) {
3723 match(SP);
3724 }
3725 else {
3726 break _loop348;
3727 }
3728
3729 } while (true);
3730 }
3731 match(COLON);
3732 {
3733 _loop350:
3734 do {
3735 if ((LA(1)==SP)) {
3736 match(SP);
3737 }
3738 else {
3739 break _loop350;
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 _loop364:
3779 do {
3780 if ((LA(1)==SP)) {
3781 match(SP);
3782 }
3783 else {
3784 break _loop364;
3785 }
3786
3787 } while (true);
3788 }
3789 match(COLON);
3790 {
3791 _loop366:
3792 do {
3793 if ((LA(1)==SP)) {
3794 match(SP);
3795 }
3796 else {
3797 break _loop366;
3798 }
3799
3800 } while (true);
3801 }
3802 oid=oid();
3803
3804 node = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT , new ClientStringValue( 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 _loop369:
3821 do {
3822 if ((LA(1)==SP)) {
3823 match(SP);
3824 }
3825 else {
3826 break _loop369;
3827 }
3828
3829 } while (true);
3830 }
3831 match(COLON);
3832 {
3833 _loop371:
3834 do {
3835 if ((LA(1)==SP)) {
3836 match(SP);
3837 }
3838 else {
3839 break _loop371;
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 _loop374:
3863 do {
3864 if ((LA(1)==SP)) {
3865 match(SP);
3866 }
3867 else {
3868 break _loop374;
3869 }
3870
3871 } while (true);
3872 }
3873 match(COLON);
3874 {
3875 _loop376:
3876 do {
3877 if ((LA(1)==SP)) {
3878 match(SP);
3879 }
3880 else {
3881 break _loop376;
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 _loop379:
3905 do {
3906 if ((LA(1)==SP)) {
3907 match(SP);
3908 }
3909 else {
3910 break _loop379;
3911 }
3912
3913 } while (true);
3914 }
3915 match(COLON);
3916 {
3917 _loop381:
3918 do {
3919 if ((LA(1)==SP)) {
3920 match(SP);
3921 }
3922 else {
3923 break _loop381;
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 _loop384:
3948 do {
3949 if ((LA(1)==SP)) {
3950 match(SP);
3951 }
3952 else {
3953 break _loop384;
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 _loop387:
3968 do {
3969 if ((LA(1)==SP)) {
3970 match(SP);
3971 }
3972 else {
3973 break _loop387;
3974 }
3975
3976 } while (true);
3977 }
3978
3979 tempChildren.add( child );
3980
3981 {
3982 _loop393:
3983 do {
3984 if ((LA(1)==SEP)) {
3985 match(SEP);
3986 {
3987 _loop390:
3988 do {
3989 if ((LA(1)==SP)) {
3990 match(SP);
3991 }
3992 else {
3993 break _loop390;
3994 }
3995
3996 } while (true);
3997 }
3998 child=refinement();
3999 {
4000 _loop392:
4001 do {
4002 if ((LA(1)==SP)) {
4003 match(SP);
4004 }
4005 else {
4006 break _loop392;
4007 }
4008
4009 } while (true);
4010 }
4011
4012 tempChildren.add( child );
4013
4014 }
4015 else {
4016 break _loop393;
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 }