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