1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.apache.maven.buildcache.xml.config.io.xpp3;
25
26
27
28
29
30 import java.io.IOException;
31 import java.io.InputStream;
32 import java.io.Reader;
33 import java.text.DateFormat;
34 import org.apache.maven.buildcache.xml.config.AttachedOutputs;
35 import org.apache.maven.buildcache.xml.config.CacheConfig;
36 import org.apache.maven.buildcache.xml.config.Configuration;
37 import org.apache.maven.buildcache.xml.config.CoordinatesBase;
38 import org.apache.maven.buildcache.xml.config.DirName;
39 import org.apache.maven.buildcache.xml.config.DirScanConfig;
40 import org.apache.maven.buildcache.xml.config.Discovery;
41 import org.apache.maven.buildcache.xml.config.EffectivePom;
42 import org.apache.maven.buildcache.xml.config.Exclude;
43 import org.apache.maven.buildcache.xml.config.Executables;
44 import org.apache.maven.buildcache.xml.config.ExecutionConfigurationScan;
45 import org.apache.maven.buildcache.xml.config.ExecutionControl;
46 import org.apache.maven.buildcache.xml.config.ExecutionIdsList;
47 import org.apache.maven.buildcache.xml.config.GoalId;
48 import org.apache.maven.buildcache.xml.config.GoalReconciliation;
49 import org.apache.maven.buildcache.xml.config.GoalsList;
50 import org.apache.maven.buildcache.xml.config.Include;
51 import org.apache.maven.buildcache.xml.config.Input;
52 import org.apache.maven.buildcache.xml.config.Local;
53 import org.apache.maven.buildcache.xml.config.MultiModule;
54 import org.apache.maven.buildcache.xml.config.Output;
55 import org.apache.maven.buildcache.xml.config.OutputExclude;
56 import org.apache.maven.buildcache.xml.config.PathSet;
57 import org.apache.maven.buildcache.xml.config.PluginConfigurationScan;
58 import org.apache.maven.buildcache.xml.config.PluginSet;
59 import org.apache.maven.buildcache.xml.config.ProjectVersioning;
60 import org.apache.maven.buildcache.xml.config.PropertyName;
61 import org.apache.maven.buildcache.xml.config.Reconcile;
62 import org.apache.maven.buildcache.xml.config.Remote;
63 import org.apache.maven.buildcache.xml.config.TagExclude;
64 import org.apache.maven.buildcache.xml.config.TagScanConfig;
65 import org.apache.maven.buildcache.xml.config.TrackedProperty;
66 import org.codehaus.plexus.util.xml.XmlStreamReader;
67 import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
68 import org.codehaus.plexus.util.xml.pull.MXParser;
69 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
70 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
71
72
73
74
75
76
77 @SuppressWarnings( "all" )
78 public class BuildCacheConfigXpp3Reader
79 {
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95 private boolean addDefaultEntities = true;
96
97
98
99
100 public final ContentTransformer contentTransformer;
101
102
103
104
105
106
107 public BuildCacheConfigXpp3Reader()
108 {
109 this( new ContentTransformer()
110 {
111 public String transform( String source, String fieldName )
112 {
113 return source;
114 }
115 } );
116 }
117
118 public BuildCacheConfigXpp3Reader(ContentTransformer contentTransformer)
119 {
120 this.contentTransformer = contentTransformer;
121 }
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139 private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set<String> parsed )
140 throws XmlPullParserException
141 {
142 if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
143 {
144 return false;
145 }
146 if ( !parsed.add( tagName ) )
147 {
148 throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
149 }
150 return true;
151 }
152
153
154
155
156
157
158
159
160
161
162
163
164 private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
165 throws XmlPullParserException, IOException
166 {
167
168 if ( strict )
169 {
170 throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
171 }
172 }
173
174
175
176
177
178
179
180
181
182
183 private void checkUnknownElement( XmlPullParser parser, boolean strict )
184 throws XmlPullParserException, IOException
185 {
186 if ( strict )
187 {
188 throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
189 }
190
191 for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
192 {
193 int eventType = parser.next();
194 if ( eventType == XmlPullParser.START_TAG )
195 {
196 unrecognizedTagCount++;
197 }
198 else if ( eventType == XmlPullParser.END_TAG )
199 {
200 unrecognizedTagCount--;
201 }
202 }
203 }
204
205
206
207
208
209
210 public boolean getAddDefaultEntities()
211 {
212 return addDefaultEntities;
213 }
214
215
216
217
218
219
220
221
222
223
224
225 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
226 throws XmlPullParserException
227 {
228 return getBooleanValue( s, attribute, parser, null );
229 }
230
231
232
233
234
235
236
237
238
239
240
241
242 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
243 throws XmlPullParserException
244 {
245 if ( s != null && s.length() != 0 )
246 {
247 return Boolean.valueOf( s ).booleanValue();
248 }
249 if ( defaultValue != null )
250 {
251 return Boolean.valueOf( defaultValue ).booleanValue();
252 }
253 return false;
254 }
255
256
257
258
259
260
261
262
263
264
265
266
267 private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
268 throws XmlPullParserException
269 {
270 if ( s != null )
271 {
272 try
273 {
274 return Byte.valueOf( s ).byteValue();
275 }
276 catch ( NumberFormatException nfe )
277 {
278 if ( strict )
279 {
280 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
281 }
282 }
283 }
284 return 0;
285 }
286
287
288
289
290
291
292
293
294
295
296
297 private char getCharacterValue( String s, String attribute, XmlPullParser parser )
298 throws XmlPullParserException
299 {
300 if ( s != null )
301 {
302 return s.charAt( 0 );
303 }
304 return 0;
305 }
306
307
308
309
310
311
312
313
314
315
316
317 private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
318 throws XmlPullParserException
319 {
320 return getDateValue( s, attribute, null, parser );
321 }
322
323
324
325
326
327
328
329
330
331
332
333
334 private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
335 throws XmlPullParserException
336 {
337 if ( s != null )
338 {
339 String effectiveDateFormat = dateFormat;
340 if ( dateFormat == null )
341 {
342 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
343 }
344 if ( "long".equals( effectiveDateFormat ) )
345 {
346 try
347 {
348 return new java.util.Date( Long.parseLong( s ) );
349 }
350 catch ( NumberFormatException e )
351 {
352 throw new XmlPullParserException( e.getMessage(), parser, e );
353 }
354 }
355 else
356 {
357 try
358 {
359 DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US );
360 return dateParser.parse( s );
361 }
362 catch ( java.text.ParseException e )
363 {
364 throw new XmlPullParserException( e.getMessage(), parser, e );
365 }
366 }
367 }
368 return null;
369 }
370
371
372
373
374
375
376
377
378
379
380
381
382 private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
383 throws XmlPullParserException
384 {
385 if ( s != null )
386 {
387 try
388 {
389 return Double.valueOf( s ).doubleValue();
390 }
391 catch ( NumberFormatException nfe )
392 {
393 if ( strict )
394 {
395 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
396 }
397 }
398 }
399 return 0;
400 }
401
402
403
404
405
406
407
408
409
410
411
412
413 private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
414 throws XmlPullParserException
415 {
416 if ( s != null )
417 {
418 try
419 {
420 return Float.valueOf( s ).floatValue();
421 }
422 catch ( NumberFormatException nfe )
423 {
424 if ( strict )
425 {
426 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
427 }
428 }
429 }
430 return 0;
431 }
432
433
434
435
436
437
438
439
440
441
442
443
444 private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
445 throws XmlPullParserException
446 {
447 if ( s != null )
448 {
449 try
450 {
451 return Integer.valueOf( s ).intValue();
452 }
453 catch ( NumberFormatException nfe )
454 {
455 if ( strict )
456 {
457 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
458 }
459 }
460 }
461 return 0;
462 }
463
464
465
466
467
468
469
470
471
472
473
474
475 private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
476 throws XmlPullParserException
477 {
478 if ( s != null )
479 {
480 try
481 {
482 return Long.valueOf( s ).longValue();
483 }
484 catch ( NumberFormatException nfe )
485 {
486 if ( strict )
487 {
488 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
489 }
490 }
491 }
492 return 0;
493 }
494
495
496
497
498
499
500
501
502
503
504
505
506 private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
507 throws XmlPullParserException
508 {
509 if ( s == null )
510 {
511 if ( strict )
512 {
513 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
514 }
515 }
516 return s;
517 }
518
519
520
521
522
523
524
525
526
527
528
529
530 private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
531 throws XmlPullParserException
532 {
533 if ( s != null )
534 {
535 try
536 {
537 return Short.valueOf( s ).shortValue();
538 }
539 catch ( NumberFormatException nfe )
540 {
541 if ( strict )
542 {
543 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
544 }
545 }
546 }
547 return 0;
548 }
549
550
551
552
553
554
555
556 private String getTrimmedValue( String s )
557 {
558 if ( s != null )
559 {
560 s = s.trim();
561 }
562 return s;
563 }
564
565
566
567
568
569
570
571
572 private String interpolatedTrimmed( String value, String context )
573 {
574 return getTrimmedValue( contentTransformer.transform( value, context ) );
575 }
576
577
578
579
580
581
582
583
584
585
586 private int nextTag( XmlPullParser parser )
587 throws IOException, XmlPullParserException
588 {
589 int eventType = parser.next();
590 if ( eventType == XmlPullParser.TEXT )
591 {
592 eventType = parser.next();
593 }
594 if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
595 {
596 throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
597 }
598 return eventType;
599 }
600
601
602
603
604
605
606
607
608
609
610
611 public CacheConfig read( XmlPullParser parser, boolean strict )
612 throws IOException, XmlPullParserException
613 {
614 CacheConfig cacheConfig = null;
615 int eventType = parser.getEventType();
616 boolean parsed = false;
617 while ( eventType != XmlPullParser.END_DOCUMENT )
618 {
619 if ( eventType == XmlPullParser.START_TAG )
620 {
621 if ( strict && ! "cache".equals( parser.getName() ) )
622 {
623 throw new XmlPullParserException( "Expected root element 'cache' but found '" + parser.getName() + "'", parser, null );
624 }
625 else if ( parsed )
626 {
627
628 throw new XmlPullParserException( "Duplicated tag: 'cache'", parser, null );
629 }
630 cacheConfig = parseCacheConfig( parser, strict );
631 cacheConfig.setModelEncoding( parser.getInputEncoding() );
632 parsed = true;
633 }
634 eventType = parser.next();
635 }
636 if ( parsed )
637 {
638 return cacheConfig;
639 }
640 throw new XmlPullParserException( "Expected root element 'cache' but found no element at all: invalid XML document", parser, null );
641 }
642
643
644
645
646
647
648
649
650
651
652
653 public CacheConfig read( Reader reader, boolean strict )
654 throws IOException, XmlPullParserException
655 {
656 XmlPullParser parser = addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser( );
657
658 parser.setInput( reader );
659
660
661 return read( parser, strict );
662 }
663
664
665
666
667
668
669
670
671
672
673 public CacheConfig read( Reader reader )
674 throws IOException, XmlPullParserException
675 {
676 return read( reader, true );
677 }
678
679
680
681
682
683
684
685
686
687
688
689 public CacheConfig read( InputStream in, boolean strict )
690 throws IOException, XmlPullParserException
691 {
692 return read( new XmlStreamReader( in ), strict );
693 }
694
695
696
697
698
699
700
701
702
703
704 public CacheConfig read( InputStream in )
705 throws IOException, XmlPullParserException
706 {
707 return read( new XmlStreamReader( in ) );
708 }
709
710
711
712
713
714
715
716
717
718
719
720 private AttachedOutputs parseAttachedOutputs( XmlPullParser parser, boolean strict )
721 throws IOException, XmlPullParserException
722 {
723 String tagName = parser.getName();
724 AttachedOutputs attachedOutputs = new AttachedOutputs();
725 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
726 {
727 String name = parser.getAttributeName( i );
728 String value = parser.getAttributeValue( i );
729
730 if ( name.indexOf( ':' ) >= 0 )
731 {
732
733 }
734 else
735 {
736 checkUnknownAttribute( parser, name, tagName, strict );
737 }
738 }
739 java.util.Set<String> parsed = new java.util.HashSet<String>();
740 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
741 {
742 if ( checkFieldWithDuplicate( parser, "preservePermissions", null, parsed ) )
743 {
744 attachedOutputs.setPreservePermissions( getBooleanValue( interpolatedTrimmed( parser.nextText(), "preservePermissions" ), "preservePermissions", parser, "true" ) );
745 }
746 else if ( checkFieldWithDuplicate( parser, "dirNames", null, parsed ) )
747 {
748 java.util.List<DirName> dirNames = new java.util.ArrayList<DirName>();
749 while ( parser.nextTag() == XmlPullParser.START_TAG )
750 {
751 if ( "dirName".equals( parser.getName() ) )
752 {
753 dirNames.add( parseDirName( parser, strict ) );
754 }
755 else
756 {
757 checkUnknownElement( parser, strict );
758 }
759 }
760 attachedOutputs.setDirNames( dirNames );
761 }
762 else
763 {
764 checkUnknownElement( parser, strict );
765 }
766 }
767 return attachedOutputs;
768 }
769
770
771
772
773
774
775
776
777
778
779
780 private CacheConfig parseCacheConfig( XmlPullParser parser, boolean strict )
781 throws IOException, XmlPullParserException
782 {
783 String tagName = parser.getName();
784 CacheConfig cacheConfig = new CacheConfig();
785 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
786 {
787 String name = parser.getAttributeName( i );
788 String value = parser.getAttributeValue( i );
789
790 if ( name.indexOf( ':' ) >= 0 )
791 {
792
793 }
794 else if ( "xmlns".equals( name ) )
795 {
796
797 }
798 else
799 {
800 checkUnknownAttribute( parser, name, tagName, strict );
801 }
802 }
803 java.util.Set<String> parsed = new java.util.HashSet<String>();
804 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
805 {
806 if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
807 {
808 cacheConfig.setConfiguration( parseConfiguration( parser, strict ) );
809 }
810 else if ( checkFieldWithDuplicate( parser, "input", null, parsed ) )
811 {
812 cacheConfig.setInput( parseInput( parser, strict ) );
813 }
814 else if ( checkFieldWithDuplicate( parser, "output", null, parsed ) )
815 {
816 cacheConfig.setOutput( parseOutput( parser, strict ) );
817 }
818 else if ( checkFieldWithDuplicate( parser, "executionControl", null, parsed ) )
819 {
820 cacheConfig.setExecutionControl( parseExecutionControl( parser, strict ) );
821 }
822 else
823 {
824 checkUnknownElement( parser, strict );
825 }
826 }
827 return cacheConfig;
828 }
829
830
831
832
833
834
835
836
837
838
839
840 private Configuration parseConfiguration( XmlPullParser parser, boolean strict )
841 throws IOException, XmlPullParserException
842 {
843 String tagName = parser.getName();
844 Configuration configuration = new Configuration();
845 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
846 {
847 String name = parser.getAttributeName( i );
848 String value = parser.getAttributeValue( i );
849
850 if ( name.indexOf( ':' ) >= 0 )
851 {
852
853 }
854 else
855 {
856 checkUnknownAttribute( parser, name, tagName, strict );
857 }
858 }
859 java.util.Set<String> parsed = new java.util.HashSet<String>();
860 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
861 {
862 if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) )
863 {
864 configuration.setEnabled( getBooleanValue( interpolatedTrimmed( parser.nextText(), "enabled" ), "enabled", parser, "true" ) );
865 }
866 else if ( checkFieldWithDuplicate( parser, "hashAlgorithm", null, parsed ) )
867 {
868 configuration.setHashAlgorithm( interpolatedTrimmed( parser.nextText(), "hashAlgorithm" ) );
869 }
870 else if ( checkFieldWithDuplicate( parser, "validateXml", null, parsed ) )
871 {
872 configuration.setValidateXml( getBooleanValue( interpolatedTrimmed( parser.nextText(), "validateXml" ), "validateXml", parser, "false" ) );
873 }
874 else if ( checkFieldWithDuplicate( parser, "mandatoryClean", null, parsed ) )
875 {
876 configuration.setMandatoryClean( getBooleanValue( interpolatedTrimmed( parser.nextText(), "mandatoryClean" ), "mandatoryClean", parser, "false" ) );
877 }
878 else if ( checkFieldWithDuplicate( parser, "multiModule", null, parsed ) )
879 {
880 configuration.setMultiModule( parseMultiModule( parser, strict ) );
881 }
882 else if ( checkFieldWithDuplicate( parser, "projectVersioning", null, parsed ) )
883 {
884 configuration.setProjectVersioning( parseProjectVersioning( parser, strict ) );
885 }
886 else if ( checkFieldWithDuplicate( parser, "remote", null, parsed ) )
887 {
888 configuration.setRemote( parseRemote( parser, strict ) );
889 }
890 else if ( checkFieldWithDuplicate( parser, "attachedOutputs", null, parsed ) )
891 {
892 configuration.setAttachedOutputs( parseAttachedOutputs( parser, strict ) );
893 }
894 else if ( checkFieldWithDuplicate( parser, "local", null, parsed ) )
895 {
896 configuration.setLocal( parseLocal( parser, strict ) );
897 }
898 else if ( checkFieldWithDuplicate( parser, "debugs", null, parsed ) )
899 {
900 java.util.List<String> debugs = new java.util.ArrayList<String>();
901 while ( parser.nextTag() == XmlPullParser.START_TAG )
902 {
903 if ( "debug".equals( parser.getName() ) )
904 {
905 debugs.add( interpolatedTrimmed( parser.nextText(), "debugs" ) );
906 }
907 else
908 {
909 checkUnknownElement( parser, strict );
910 }
911 }
912 configuration.setDebugs( debugs );
913 }
914 else
915 {
916 checkUnknownElement( parser, strict );
917 }
918 }
919 return configuration;
920 }
921
922
923
924
925
926
927
928
929
930
931
932 private CoordinatesBase parseCoordinatesBase( XmlPullParser parser, boolean strict )
933 throws IOException, XmlPullParserException
934 {
935 String tagName = parser.getName();
936 CoordinatesBase coordinatesBase = new CoordinatesBase();
937 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
938 {
939 String name = parser.getAttributeName( i );
940 String value = parser.getAttributeValue( i );
941
942 if ( name.indexOf( ':' ) >= 0 )
943 {
944
945 }
946 else if ( "groupId".equals( name ) )
947 {
948 coordinatesBase.setGroupId( interpolatedTrimmed( value, "groupId" ) );
949 }
950 else if ( "artifactId".equals( name ) )
951 {
952 coordinatesBase.setArtifactId( interpolatedTrimmed( value, "artifactId" ) );
953 }
954 else
955 {
956 checkUnknownAttribute( parser, name, tagName, strict );
957 }
958 }
959 java.util.Set<String> parsed = new java.util.HashSet<String>();
960 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
961 {
962 checkUnknownElement( parser, strict );
963 }
964 return coordinatesBase;
965 }
966
967
968
969
970
971
972
973
974
975
976
977 private DirName parseDirName( XmlPullParser parser, boolean strict )
978 throws IOException, XmlPullParserException
979 {
980 String tagName = parser.getName();
981 DirName dirName = new DirName();
982 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
983 {
984 String name = parser.getAttributeName( i );
985 String value = parser.getAttributeValue( i );
986
987 if ( name.indexOf( ':' ) >= 0 )
988 {
989
990 }
991 else if ( "glob".equals( name ) )
992 {
993 dirName.setGlob( interpolatedTrimmed( value, "glob" ) );
994 }
995 else
996 {
997 checkUnknownAttribute( parser, name, tagName, strict );
998 }
999 }
1000 dirName.setValue( interpolatedTrimmed( parser.nextText(), "value" ) );
1001 return dirName;
1002 }
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014 private DirScanConfig parseDirScanConfig( XmlPullParser parser, boolean strict )
1015 throws IOException, XmlPullParserException
1016 {
1017 String tagName = parser.getName();
1018 DirScanConfig dirScanConfig = new DirScanConfig();
1019 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1020 {
1021 String name = parser.getAttributeName( i );
1022 String value = parser.getAttributeValue( i );
1023
1024 if ( name.indexOf( ':' ) >= 0 )
1025 {
1026
1027 }
1028 else if ( "ignoreParent".equals( name ) )
1029 {
1030 dirScanConfig.setIgnoreParent( getBooleanValue( interpolatedTrimmed( value, "ignoreParent" ), "ignoreParent", parser, "false" ) );
1031 }
1032 else if ( "mode".equals( name ) )
1033 {
1034 dirScanConfig.setMode( interpolatedTrimmed( value, "mode" ) );
1035 }
1036 else
1037 {
1038 checkUnknownAttribute( parser, name, tagName, strict );
1039 }
1040 }
1041 java.util.Set<String> parsed = new java.util.HashSet<String>();
1042 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1043 {
1044 if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1045 {
1046 java.util.List<TagScanConfig> includes = new java.util.ArrayList<TagScanConfig>();
1047 while ( parser.nextTag() == XmlPullParser.START_TAG )
1048 {
1049 if ( "include".equals( parser.getName() ) )
1050 {
1051 includes.add( parseTagScanConfig( parser, strict ) );
1052 }
1053 else
1054 {
1055 checkUnknownElement( parser, strict );
1056 }
1057 }
1058 dirScanConfig.setIncludes( includes );
1059 }
1060 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1061 {
1062 java.util.List<TagExclude> excludes = new java.util.ArrayList<TagExclude>();
1063 while ( parser.nextTag() == XmlPullParser.START_TAG )
1064 {
1065 if ( "exclude".equals( parser.getName() ) )
1066 {
1067 excludes.add( parseTagExclude( parser, strict ) );
1068 }
1069 else
1070 {
1071 checkUnknownElement( parser, strict );
1072 }
1073 }
1074 dirScanConfig.setExcludes( excludes );
1075 }
1076 else if ( checkFieldWithDuplicate( parser, "tagScanConfigs", null, parsed ) )
1077 {
1078 java.util.List<TagScanConfig> tagScanConfigs = new java.util.ArrayList<TagScanConfig>();
1079 while ( parser.nextTag() == XmlPullParser.START_TAG )
1080 {
1081 if ( "tagScanConfig".equals( parser.getName() ) )
1082 {
1083 tagScanConfigs.add( parseTagScanConfig( parser, strict ) );
1084 }
1085 else
1086 {
1087 checkUnknownElement( parser, strict );
1088 }
1089 }
1090 dirScanConfig.setTagScanConfigs( tagScanConfigs );
1091 }
1092 else
1093 {
1094 checkUnknownElement( parser, strict );
1095 }
1096 }
1097 return dirScanConfig;
1098 }
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110 private Discovery parseDiscovery( XmlPullParser parser, boolean strict )
1111 throws IOException, XmlPullParserException
1112 {
1113 String tagName = parser.getName();
1114 Discovery discovery = new Discovery();
1115 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1116 {
1117 String name = parser.getAttributeName( i );
1118 String value = parser.getAttributeValue( i );
1119
1120 if ( name.indexOf( ':' ) >= 0 )
1121 {
1122
1123 }
1124 else
1125 {
1126 checkUnknownAttribute( parser, name, tagName, strict );
1127 }
1128 }
1129 java.util.Set<String> parsed = new java.util.HashSet<String>();
1130 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1131 {
1132 if ( checkFieldWithDuplicate( parser, "scanProfiles", null, parsed ) )
1133 {
1134 java.util.List<String> scanProfiles = new java.util.ArrayList<String>();
1135 while ( parser.nextTag() == XmlPullParser.START_TAG )
1136 {
1137 if ( "scanProfile".equals( parser.getName() ) )
1138 {
1139 scanProfiles.add( interpolatedTrimmed( parser.nextText(), "scanProfiles" ) );
1140 }
1141 else
1142 {
1143 checkUnknownElement( parser, strict );
1144 }
1145 }
1146 discovery.setScanProfiles( scanProfiles );
1147 }
1148 else
1149 {
1150 checkUnknownElement( parser, strict );
1151 }
1152 }
1153 return discovery;
1154 }
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166 private EffectivePom parseEffectivePom( XmlPullParser parser, boolean strict )
1167 throws IOException, XmlPullParserException
1168 {
1169 String tagName = parser.getName();
1170 EffectivePom effectivePom = new EffectivePom();
1171 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1172 {
1173 String name = parser.getAttributeName( i );
1174 String value = parser.getAttributeValue( i );
1175
1176 if ( name.indexOf( ':' ) >= 0 )
1177 {
1178
1179 }
1180 else
1181 {
1182 checkUnknownAttribute( parser, name, tagName, strict );
1183 }
1184 }
1185 java.util.Set<String> parsed = new java.util.HashSet<String>();
1186 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1187 {
1188 if ( checkFieldWithDuplicate( parser, "excludeProperties", null, parsed ) )
1189 {
1190 java.util.List<String> excludeProperties = new java.util.ArrayList<String>();
1191 while ( parser.nextTag() == XmlPullParser.START_TAG )
1192 {
1193 if ( "excludeProperty".equals( parser.getName() ) )
1194 {
1195 excludeProperties.add( interpolatedTrimmed( parser.nextText(), "excludeProperties" ) );
1196 }
1197 else
1198 {
1199 checkUnknownElement( parser, strict );
1200 }
1201 }
1202 effectivePom.setExcludeProperties( excludeProperties );
1203 }
1204 else
1205 {
1206 checkUnknownElement( parser, strict );
1207 }
1208 }
1209 return effectivePom;
1210 }
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222 private Exclude parseExclude( XmlPullParser parser, boolean strict )
1223 throws IOException, XmlPullParserException
1224 {
1225 String tagName = parser.getName();
1226 Exclude exclude = new Exclude();
1227 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1228 {
1229 String name = parser.getAttributeName( i );
1230 String value = parser.getAttributeValue( i );
1231
1232 if ( name.indexOf( ':' ) >= 0 )
1233 {
1234
1235 }
1236 else if ( "glob".equals( name ) )
1237 {
1238 exclude.setGlob( interpolatedTrimmed( value, "glob" ) );
1239 }
1240 else if ( "entryType".equals( name ) )
1241 {
1242 exclude.setEntryType( interpolatedTrimmed( value, "entryType" ) );
1243 }
1244 else if ( "matcherType".equals( name ) )
1245 {
1246 exclude.setMatcherType( interpolatedTrimmed( value, "matcherType" ) );
1247 }
1248 else
1249 {
1250 checkUnknownAttribute( parser, name, tagName, strict );
1251 }
1252 }
1253 exclude.setValue( interpolatedTrimmed( parser.nextText(), "value" ) );
1254 return exclude;
1255 }
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267 private Executables parseExecutables( XmlPullParser parser, boolean strict )
1268 throws IOException, XmlPullParserException
1269 {
1270 String tagName = parser.getName();
1271 Executables executables = new Executables();
1272 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1273 {
1274 String name = parser.getAttributeName( i );
1275 String value = parser.getAttributeValue( i );
1276
1277 if ( name.indexOf( ':' ) >= 0 )
1278 {
1279
1280 }
1281 else
1282 {
1283 checkUnknownAttribute( parser, name, tagName, strict );
1284 }
1285 }
1286 java.util.Set<String> parsed = new java.util.HashSet<String>();
1287 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1288 {
1289 if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
1290 {
1291 java.util.List<PluginSet> plugins = new java.util.ArrayList<PluginSet>();
1292 while ( parser.nextTag() == XmlPullParser.START_TAG )
1293 {
1294 if ( "plugin".equals( parser.getName() ) )
1295 {
1296 plugins.add( parsePluginSet( parser, strict ) );
1297 }
1298 else
1299 {
1300 checkUnknownElement( parser, strict );
1301 }
1302 }
1303 executables.setPlugins( plugins );
1304 }
1305 else if ( checkFieldWithDuplicate( parser, "executions", null, parsed ) )
1306 {
1307 java.util.List<ExecutionIdsList> executions = new java.util.ArrayList<ExecutionIdsList>();
1308 while ( parser.nextTag() == XmlPullParser.START_TAG )
1309 {
1310 if ( "execution".equals( parser.getName() ) )
1311 {
1312 executions.add( parseExecutionIdsList( parser, strict ) );
1313 }
1314 else
1315 {
1316 checkUnknownElement( parser, strict );
1317 }
1318 }
1319 executables.setExecutions( executions );
1320 }
1321 else if ( checkFieldWithDuplicate( parser, "goalsLists", null, parsed ) )
1322 {
1323 java.util.List<GoalsList> goalsLists = new java.util.ArrayList<GoalsList>();
1324 while ( parser.nextTag() == XmlPullParser.START_TAG )
1325 {
1326 if ( "goalsList".equals( parser.getName() ) )
1327 {
1328 goalsLists.add( parseGoalsList( parser, strict ) );
1329 }
1330 else
1331 {
1332 checkUnknownElement( parser, strict );
1333 }
1334 }
1335 executables.setGoalsLists( goalsLists );
1336 }
1337 else
1338 {
1339 checkUnknownElement( parser, strict );
1340 }
1341 }
1342 return executables;
1343 }
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355 private ExecutionConfigurationScan parseExecutionConfigurationScan( XmlPullParser parser, boolean strict )
1356 throws IOException, XmlPullParserException
1357 {
1358 String tagName = parser.getName();
1359 ExecutionConfigurationScan executionConfigurationScan = new ExecutionConfigurationScan();
1360 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1361 {
1362 String name = parser.getAttributeName( i );
1363 String value = parser.getAttributeValue( i );
1364
1365 if ( name.indexOf( ':' ) >= 0 )
1366 {
1367
1368 }
1369 else if ( "ignoreParentConfig".equals( name ) )
1370 {
1371 executionConfigurationScan.setIgnoreParentConfig( getBooleanValue( interpolatedTrimmed( value, "ignoreParentConfig" ), "ignoreParentConfig", parser, "false" ) );
1372 }
1373 else
1374 {
1375 checkUnknownAttribute( parser, name, tagName, strict );
1376 }
1377 }
1378 java.util.Set<String> parsed = new java.util.HashSet<String>();
1379 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1380 {
1381 if ( checkFieldWithDuplicate( parser, "execIds", null, parsed ) )
1382 {
1383 java.util.List<String> execIds = new java.util.ArrayList<String>();
1384 while ( parser.nextTag() == XmlPullParser.START_TAG )
1385 {
1386 if ( "execId".equals( parser.getName() ) )
1387 {
1388 execIds.add( interpolatedTrimmed( parser.nextText(), "execIds" ) );
1389 }
1390 else
1391 {
1392 checkUnknownElement( parser, strict );
1393 }
1394 }
1395 executionConfigurationScan.setExecIds( execIds );
1396 }
1397 else if ( checkFieldWithDuplicate( parser, "dirScan", null, parsed ) )
1398 {
1399 executionConfigurationScan.setDirScan( parseDirScanConfig( parser, strict ) );
1400 }
1401 else
1402 {
1403 checkUnknownElement( parser, strict );
1404 }
1405 }
1406 return executionConfigurationScan;
1407 }
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419 private ExecutionControl parseExecutionControl( XmlPullParser parser, boolean strict )
1420 throws IOException, XmlPullParserException
1421 {
1422 String tagName = parser.getName();
1423 ExecutionControl executionControl = new ExecutionControl();
1424 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1425 {
1426 String name = parser.getAttributeName( i );
1427 String value = parser.getAttributeValue( i );
1428
1429 if ( name.indexOf( ':' ) >= 0 )
1430 {
1431
1432 }
1433 else
1434 {
1435 checkUnknownAttribute( parser, name, tagName, strict );
1436 }
1437 }
1438 java.util.Set<String> parsed = new java.util.HashSet<String>();
1439 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1440 {
1441 if ( checkFieldWithDuplicate( parser, "runAlways", null, parsed ) )
1442 {
1443 executionControl.setRunAlways( parseExecutables( parser, strict ) );
1444 }
1445 else if ( checkFieldWithDuplicate( parser, "ignoreMissing", null, parsed ) )
1446 {
1447 executionControl.setIgnoreMissing( parseExecutables( parser, strict ) );
1448 }
1449 else if ( checkFieldWithDuplicate( parser, "reconcile", null, parsed ) )
1450 {
1451 executionControl.setReconcile( parseReconcile( parser, strict ) );
1452 }
1453 else
1454 {
1455 checkUnknownElement( parser, strict );
1456 }
1457 }
1458 return executionControl;
1459 }
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471 private ExecutionIdsList parseExecutionIdsList( XmlPullParser parser, boolean strict )
1472 throws IOException, XmlPullParserException
1473 {
1474 String tagName = parser.getName();
1475 ExecutionIdsList executionIdsList = new ExecutionIdsList();
1476 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1477 {
1478 String name = parser.getAttributeName( i );
1479 String value = parser.getAttributeValue( i );
1480
1481 if ( name.indexOf( ':' ) >= 0 )
1482 {
1483
1484 }
1485 else if ( "groupId".equals( name ) )
1486 {
1487 executionIdsList.setGroupId( interpolatedTrimmed( value, "groupId" ) );
1488 }
1489 else if ( "artifactId".equals( name ) )
1490 {
1491 executionIdsList.setArtifactId( interpolatedTrimmed( value, "artifactId" ) );
1492 }
1493 else
1494 {
1495 checkUnknownAttribute( parser, name, tagName, strict );
1496 }
1497 }
1498 java.util.Set<String> parsed = new java.util.HashSet<String>();
1499 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1500 {
1501 if ( checkFieldWithDuplicate( parser, "execIds", null, parsed ) )
1502 {
1503 java.util.List<String> execIds = new java.util.ArrayList<String>();
1504 while ( parser.nextTag() == XmlPullParser.START_TAG )
1505 {
1506 if ( "execId".equals( parser.getName() ) )
1507 {
1508 execIds.add( interpolatedTrimmed( parser.nextText(), "execIds" ) );
1509 }
1510 else
1511 {
1512 checkUnknownElement( parser, strict );
1513 }
1514 }
1515 executionIdsList.setExecIds( execIds );
1516 }
1517 else
1518 {
1519 checkUnknownElement( parser, strict );
1520 }
1521 }
1522 return executionIdsList;
1523 }
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535 private GoalId parseGoalId( XmlPullParser parser, boolean strict )
1536 throws IOException, XmlPullParserException
1537 {
1538 String tagName = parser.getName();
1539 GoalId goalId = new GoalId();
1540 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1541 {
1542 String name = parser.getAttributeName( i );
1543 String value = parser.getAttributeValue( i );
1544
1545 if ( name.indexOf( ':' ) >= 0 )
1546 {
1547
1548 }
1549 else if ( "goal".equals( name ) )
1550 {
1551 goalId.setGoal( interpolatedTrimmed( value, "goal" ) );
1552 }
1553 else if ( "groupId".equals( name ) )
1554 {
1555 goalId.setGroupId( interpolatedTrimmed( value, "groupId" ) );
1556 }
1557 else if ( "artifactId".equals( name ) )
1558 {
1559 goalId.setArtifactId( interpolatedTrimmed( value, "artifactId" ) );
1560 }
1561 else
1562 {
1563 checkUnknownAttribute( parser, name, tagName, strict );
1564 }
1565 }
1566 java.util.Set<String> parsed = new java.util.HashSet<String>();
1567 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1568 {
1569 checkUnknownElement( parser, strict );
1570 }
1571 return goalId;
1572 }
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584 private GoalReconciliation parseGoalReconciliation( XmlPullParser parser, boolean strict )
1585 throws IOException, XmlPullParserException
1586 {
1587 String tagName = parser.getName();
1588 GoalReconciliation goalReconciliation = new GoalReconciliation();
1589 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1590 {
1591 String name = parser.getAttributeName( i );
1592 String value = parser.getAttributeValue( i );
1593
1594 if ( name.indexOf( ':' ) >= 0 )
1595 {
1596
1597 }
1598 else if ( "goal".equals( name ) )
1599 {
1600 goalReconciliation.setGoal( interpolatedTrimmed( value, "goal" ) );
1601 }
1602 else if ( "groupId".equals( name ) )
1603 {
1604 goalReconciliation.setGroupId( interpolatedTrimmed( value, "groupId" ) );
1605 }
1606 else if ( "artifactId".equals( name ) )
1607 {
1608 goalReconciliation.setArtifactId( interpolatedTrimmed( value, "artifactId" ) );
1609 }
1610 else
1611 {
1612 checkUnknownAttribute( parser, name, tagName, strict );
1613 }
1614 }
1615 java.util.Set<String> parsed = new java.util.HashSet<String>();
1616 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1617 {
1618 if ( checkFieldWithDuplicate( parser, "reconciles", null, parsed ) )
1619 {
1620 java.util.List<TrackedProperty> reconciles = new java.util.ArrayList<TrackedProperty>();
1621 while ( parser.nextTag() == XmlPullParser.START_TAG )
1622 {
1623 if ( "reconcile".equals( parser.getName() ) )
1624 {
1625 reconciles.add( parseTrackedProperty( parser, strict ) );
1626 }
1627 else
1628 {
1629 checkUnknownElement( parser, strict );
1630 }
1631 }
1632 goalReconciliation.setReconciles( reconciles );
1633 }
1634 else if ( checkFieldWithDuplicate( parser, "logs", null, parsed ) )
1635 {
1636 java.util.List<PropertyName> logs = new java.util.ArrayList<PropertyName>();
1637 while ( parser.nextTag() == XmlPullParser.START_TAG )
1638 {
1639 if ( "log".equals( parser.getName() ) )
1640 {
1641 logs.add( parsePropertyName( parser, strict ) );
1642 }
1643 else
1644 {
1645 checkUnknownElement( parser, strict );
1646 }
1647 }
1648 goalReconciliation.setLogs( logs );
1649 }
1650 else if ( checkFieldWithDuplicate( parser, "nologs", null, parsed ) )
1651 {
1652 java.util.List<PropertyName> nologs = new java.util.ArrayList<PropertyName>();
1653 while ( parser.nextTag() == XmlPullParser.START_TAG )
1654 {
1655 if ( "nolog".equals( parser.getName() ) )
1656 {
1657 nologs.add( parsePropertyName( parser, strict ) );
1658 }
1659 else
1660 {
1661 checkUnknownElement( parser, strict );
1662 }
1663 }
1664 goalReconciliation.setNologs( nologs );
1665 }
1666 else if ( checkFieldWithDuplicate( parser, "logAll", null, parsed ) )
1667 {
1668 goalReconciliation.setLogAll( getBooleanValue( interpolatedTrimmed( parser.nextText(), "logAll" ), "logAll", parser, "true" ) );
1669 }
1670 else
1671 {
1672 checkUnknownElement( parser, strict );
1673 }
1674 }
1675 return goalReconciliation;
1676 }
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688 private GoalsList parseGoalsList( XmlPullParser parser, boolean strict )
1689 throws IOException, XmlPullParserException
1690 {
1691 String tagName = parser.getName();
1692 GoalsList goalsList = new GoalsList();
1693 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1694 {
1695 String name = parser.getAttributeName( i );
1696 String value = parser.getAttributeValue( i );
1697
1698 if ( name.indexOf( ':' ) >= 0 )
1699 {
1700
1701 }
1702 else if ( "groupId".equals( name ) )
1703 {
1704 goalsList.setGroupId( interpolatedTrimmed( value, "groupId" ) );
1705 }
1706 else if ( "artifactId".equals( name ) )
1707 {
1708 goalsList.setArtifactId( interpolatedTrimmed( value, "artifactId" ) );
1709 }
1710 else
1711 {
1712 checkUnknownAttribute( parser, name, tagName, strict );
1713 }
1714 }
1715 java.util.Set<String> parsed = new java.util.HashSet<String>();
1716 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1717 {
1718 if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
1719 {
1720 java.util.List<String> goals = new java.util.ArrayList<String>();
1721 while ( parser.nextTag() == XmlPullParser.START_TAG )
1722 {
1723 if ( "goal".equals( parser.getName() ) )
1724 {
1725 goals.add( interpolatedTrimmed( parser.nextText(), "goals" ) );
1726 }
1727 else
1728 {
1729 checkUnknownElement( parser, strict );
1730 }
1731 }
1732 goalsList.setGoals( goals );
1733 }
1734 else
1735 {
1736 checkUnknownElement( parser, strict );
1737 }
1738 }
1739 return goalsList;
1740 }
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752 private Include parseInclude( XmlPullParser parser, boolean strict )
1753 throws IOException, XmlPullParserException
1754 {
1755 String tagName = parser.getName();
1756 Include include = new Include();
1757 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1758 {
1759 String name = parser.getAttributeName( i );
1760 String value = parser.getAttributeValue( i );
1761
1762 if ( name.indexOf( ':' ) >= 0 )
1763 {
1764
1765 }
1766 else if ( "recursive".equals( name ) )
1767 {
1768 include.setRecursive( getBooleanValue( interpolatedTrimmed( value, "recursive" ), "recursive", parser, "true" ) );
1769 }
1770 else if ( "glob".equals( name ) )
1771 {
1772 include.setGlob( interpolatedTrimmed( value, "glob" ) );
1773 }
1774 else
1775 {
1776 checkUnknownAttribute( parser, name, tagName, strict );
1777 }
1778 }
1779 include.setValue( interpolatedTrimmed( parser.nextText(), "value" ) );
1780 return include;
1781 }
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793 private Input parseInput( XmlPullParser parser, boolean strict )
1794 throws IOException, XmlPullParserException
1795 {
1796 String tagName = parser.getName();
1797 Input input = new Input();
1798 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1799 {
1800 String name = parser.getAttributeName( i );
1801 String value = parser.getAttributeValue( i );
1802
1803 if ( name.indexOf( ':' ) >= 0 )
1804 {
1805
1806 }
1807 else
1808 {
1809 checkUnknownAttribute( parser, name, tagName, strict );
1810 }
1811 }
1812 java.util.Set<String> parsed = new java.util.HashSet<String>();
1813 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1814 {
1815 if ( checkFieldWithDuplicate( parser, "global", null, parsed ) )
1816 {
1817 input.setGlobal( parsePathSet( parser, strict ) );
1818 }
1819 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
1820 {
1821 java.util.List<PluginConfigurationScan> plugins = new java.util.ArrayList<PluginConfigurationScan>();
1822 while ( parser.nextTag() == XmlPullParser.START_TAG )
1823 {
1824 if ( "plugin".equals( parser.getName() ) )
1825 {
1826 plugins.add( parsePluginConfigurationScan( parser, strict ) );
1827 }
1828 else
1829 {
1830 checkUnknownElement( parser, strict );
1831 }
1832 }
1833 input.setPlugins( plugins );
1834 }
1835 else
1836 {
1837 checkUnknownElement( parser, strict );
1838 }
1839 }
1840 return input;
1841 }
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853 private Local parseLocal( XmlPullParser parser, boolean strict )
1854 throws IOException, XmlPullParserException
1855 {
1856 String tagName = parser.getName();
1857 Local local = new Local();
1858 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1859 {
1860 String name = parser.getAttributeName( i );
1861 String value = parser.getAttributeValue( i );
1862
1863 if ( name.indexOf( ':' ) >= 0 )
1864 {
1865
1866 }
1867 else
1868 {
1869 checkUnknownAttribute( parser, name, tagName, strict );
1870 }
1871 }
1872 java.util.Set<String> parsed = new java.util.HashSet<String>();
1873 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1874 {
1875 if ( checkFieldWithDuplicate( parser, "location", null, parsed ) )
1876 {
1877 local.setLocation( interpolatedTrimmed( parser.nextText(), "location" ) );
1878 }
1879 else if ( checkFieldWithDuplicate( parser, "maxBuildsCached", null, parsed ) )
1880 {
1881 local.setMaxBuildsCached( getIntegerValue( interpolatedTrimmed( parser.nextText(), "maxBuildsCached" ), "maxBuildsCached", parser, strict ) );
1882 }
1883 else
1884 {
1885 checkUnknownElement( parser, strict );
1886 }
1887 }
1888 return local;
1889 }
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901 private MultiModule parseMultiModule( XmlPullParser parser, boolean strict )
1902 throws IOException, XmlPullParserException
1903 {
1904 String tagName = parser.getName();
1905 MultiModule multiModule = new MultiModule();
1906 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1907 {
1908 String name = parser.getAttributeName( i );
1909 String value = parser.getAttributeValue( i );
1910
1911 if ( name.indexOf( ':' ) >= 0 )
1912 {
1913
1914 }
1915 else
1916 {
1917 checkUnknownAttribute( parser, name, tagName, strict );
1918 }
1919 }
1920 java.util.Set<String> parsed = new java.util.HashSet<String>();
1921 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1922 {
1923 if ( checkFieldWithDuplicate( parser, "discovery", null, parsed ) )
1924 {
1925 multiModule.setDiscovery( parseDiscovery( parser, strict ) );
1926 }
1927 else
1928 {
1929 checkUnknownElement( parser, strict );
1930 }
1931 }
1932 return multiModule;
1933 }
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945 private Output parseOutput( XmlPullParser parser, boolean strict )
1946 throws IOException, XmlPullParserException
1947 {
1948 String tagName = parser.getName();
1949 Output output = new Output();
1950 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1951 {
1952 String name = parser.getAttributeName( i );
1953 String value = parser.getAttributeValue( i );
1954
1955 if ( name.indexOf( ':' ) >= 0 )
1956 {
1957
1958 }
1959 else
1960 {
1961 checkUnknownAttribute( parser, name, tagName, strict );
1962 }
1963 }
1964 java.util.Set<String> parsed = new java.util.HashSet<String>();
1965 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1966 {
1967 if ( checkFieldWithDuplicate( parser, "exclude", null, parsed ) )
1968 {
1969 output.setExclude( parseOutputExclude( parser, strict ) );
1970 }
1971 else
1972 {
1973 checkUnknownElement( parser, strict );
1974 }
1975 }
1976 return output;
1977 }
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989 private OutputExclude parseOutputExclude( XmlPullParser parser, boolean strict )
1990 throws IOException, XmlPullParserException
1991 {
1992 String tagName = parser.getName();
1993 OutputExclude outputExclude = new OutputExclude();
1994 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1995 {
1996 String name = parser.getAttributeName( i );
1997 String value = parser.getAttributeValue( i );
1998
1999 if ( name.indexOf( ':' ) >= 0 )
2000 {
2001
2002 }
2003 else
2004 {
2005 checkUnknownAttribute( parser, name, tagName, strict );
2006 }
2007 }
2008 java.util.Set<String> parsed = new java.util.HashSet<String>();
2009 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2010 {
2011 if ( checkFieldWithDuplicate( parser, "patterns", null, parsed ) )
2012 {
2013 java.util.List<String> patterns = new java.util.ArrayList<String>();
2014 while ( parser.nextTag() == XmlPullParser.START_TAG )
2015 {
2016 if ( "pattern".equals( parser.getName() ) )
2017 {
2018 patterns.add( interpolatedTrimmed( parser.nextText(), "patterns" ) );
2019 }
2020 else
2021 {
2022 checkUnknownElement( parser, strict );
2023 }
2024 }
2025 outputExclude.setPatterns( patterns );
2026 }
2027 else
2028 {
2029 checkUnknownElement( parser, strict );
2030 }
2031 }
2032 return outputExclude;
2033 }
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045 private PathSet parsePathSet( XmlPullParser parser, boolean strict )
2046 throws IOException, XmlPullParserException
2047 {
2048 String tagName = parser.getName();
2049 PathSet pathSet = new PathSet();
2050 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2051 {
2052 String name = parser.getAttributeName( i );
2053 String value = parser.getAttributeValue( i );
2054
2055 if ( name.indexOf( ':' ) >= 0 )
2056 {
2057
2058 }
2059 else
2060 {
2061 checkUnknownAttribute( parser, name, tagName, strict );
2062 }
2063 }
2064 java.util.Set<String> parsed = new java.util.HashSet<String>();
2065 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2066 {
2067 if ( checkFieldWithDuplicate( parser, "glob", null, parsed ) )
2068 {
2069 pathSet.setGlob( interpolatedTrimmed( parser.nextText(), "glob" ) );
2070 }
2071 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
2072 {
2073 java.util.List<Include> includes = new java.util.ArrayList<Include>();
2074 while ( parser.nextTag() == XmlPullParser.START_TAG )
2075 {
2076 if ( "include".equals( parser.getName() ) )
2077 {
2078 includes.add( parseInclude( parser, strict ) );
2079 }
2080 else
2081 {
2082 checkUnknownElement( parser, strict );
2083 }
2084 }
2085 pathSet.setIncludes( includes );
2086 }
2087 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
2088 {
2089 java.util.List<Exclude> excludes = new java.util.ArrayList<Exclude>();
2090 while ( parser.nextTag() == XmlPullParser.START_TAG )
2091 {
2092 if ( "exclude".equals( parser.getName() ) )
2093 {
2094 excludes.add( parseExclude( parser, strict ) );
2095 }
2096 else
2097 {
2098 checkUnknownElement( parser, strict );
2099 }
2100 }
2101 pathSet.setExcludes( excludes );
2102 }
2103 else
2104 {
2105 checkUnknownElement( parser, strict );
2106 }
2107 }
2108 return pathSet;
2109 }
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121 private PluginConfigurationScan parsePluginConfigurationScan( XmlPullParser parser, boolean strict )
2122 throws IOException, XmlPullParserException
2123 {
2124 String tagName = parser.getName();
2125 PluginConfigurationScan pluginConfigurationScan = new PluginConfigurationScan();
2126 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2127 {
2128 String name = parser.getAttributeName( i );
2129 String value = parser.getAttributeValue( i );
2130
2131 if ( name.indexOf( ':' ) >= 0 )
2132 {
2133
2134 }
2135 else if ( "excludeDependencies".equals( name ) )
2136 {
2137 pluginConfigurationScan.setExcludeDependencies( getBooleanValue( interpolatedTrimmed( value, "excludeDependencies" ), "excludeDependencies", parser, "false" ) );
2138 }
2139 else if ( "groupId".equals( name ) )
2140 {
2141 pluginConfigurationScan.setGroupId( interpolatedTrimmed( value, "groupId" ) );
2142 }
2143 else if ( "artifactId".equals( name ) )
2144 {
2145 pluginConfigurationScan.setArtifactId( interpolatedTrimmed( value, "artifactId" ) );
2146 }
2147 else
2148 {
2149 checkUnknownAttribute( parser, name, tagName, strict );
2150 }
2151 }
2152 java.util.Set<String> parsed = new java.util.HashSet<String>();
2153 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2154 {
2155 if ( checkFieldWithDuplicate( parser, "effectivePom", null, parsed ) )
2156 {
2157 pluginConfigurationScan.setEffectivePom( parseEffectivePom( parser, strict ) );
2158 }
2159 else if ( checkFieldWithDuplicate( parser, "dirScan", null, parsed ) )
2160 {
2161 pluginConfigurationScan.setDirScan( parseDirScanConfig( parser, strict ) );
2162 }
2163 else if ( checkFieldWithDuplicate( parser, "executions", null, parsed ) )
2164 {
2165 java.util.List<ExecutionConfigurationScan> executions = new java.util.ArrayList<ExecutionConfigurationScan>();
2166 while ( parser.nextTag() == XmlPullParser.START_TAG )
2167 {
2168 if ( "execution".equals( parser.getName() ) )
2169 {
2170 executions.add( parseExecutionConfigurationScan( parser, strict ) );
2171 }
2172 else
2173 {
2174 checkUnknownElement( parser, strict );
2175 }
2176 }
2177 pluginConfigurationScan.setExecutions( executions );
2178 }
2179 else
2180 {
2181 checkUnknownElement( parser, strict );
2182 }
2183 }
2184 return pluginConfigurationScan;
2185 }
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197 private PluginSet parsePluginSet( XmlPullParser parser, boolean strict )
2198 throws IOException, XmlPullParserException
2199 {
2200 String tagName = parser.getName();
2201 PluginSet pluginSet = new PluginSet();
2202 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2203 {
2204 String name = parser.getAttributeName( i );
2205 String value = parser.getAttributeValue( i );
2206
2207 if ( name.indexOf( ':' ) >= 0 )
2208 {
2209
2210 }
2211 else if ( "groupId".equals( name ) )
2212 {
2213 pluginSet.setGroupId( interpolatedTrimmed( value, "groupId" ) );
2214 }
2215 else if ( "artifactId".equals( name ) )
2216 {
2217 pluginSet.setArtifactId( interpolatedTrimmed( value, "artifactId" ) );
2218 }
2219 else
2220 {
2221 checkUnknownAttribute( parser, name, tagName, strict );
2222 }
2223 }
2224 java.util.Set<String> parsed = new java.util.HashSet<String>();
2225 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2226 {
2227 checkUnknownElement( parser, strict );
2228 }
2229 return pluginSet;
2230 }
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242 private ProjectVersioning parseProjectVersioning( XmlPullParser parser, boolean strict )
2243 throws IOException, XmlPullParserException
2244 {
2245 String tagName = parser.getName();
2246 ProjectVersioning projectVersioning = new ProjectVersioning();
2247 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2248 {
2249 String name = parser.getAttributeName( i );
2250 String value = parser.getAttributeValue( i );
2251
2252 if ( name.indexOf( ':' ) >= 0 )
2253 {
2254
2255 }
2256 else if ( "adjustMetaInf".equals( name ) )
2257 {
2258 projectVersioning.setAdjustMetaInf( getBooleanValue( interpolatedTrimmed( value, "adjustMetaInf" ), "adjustMetaInf", parser, "false" ) );
2259 }
2260 else if ( "calculateProjectVersionChecksum".equals( name ) )
2261 {
2262 projectVersioning.setCalculateProjectVersionChecksum( getBooleanValue( interpolatedTrimmed( value, "calculateProjectVersionChecksum" ), "calculateProjectVersionChecksum", parser, "false" ) );
2263 }
2264 else
2265 {
2266 checkUnknownAttribute( parser, name, tagName, strict );
2267 }
2268 }
2269 java.util.Set<String> parsed = new java.util.HashSet<String>();
2270 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2271 {
2272 checkUnknownElement( parser, strict );
2273 }
2274 return projectVersioning;
2275 }
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287 private PropertyName parsePropertyName( XmlPullParser parser, boolean strict )
2288 throws IOException, XmlPullParserException
2289 {
2290 String tagName = parser.getName();
2291 PropertyName propertyName = new PropertyName();
2292 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2293 {
2294 String name = parser.getAttributeName( i );
2295 String value = parser.getAttributeValue( i );
2296
2297 if ( name.indexOf( ':' ) >= 0 )
2298 {
2299
2300 }
2301 else if ( "propertyName".equals( name ) )
2302 {
2303 propertyName.setPropertyName( interpolatedTrimmed( value, "propertyName" ) );
2304 }
2305 else
2306 {
2307 checkUnknownAttribute( parser, name, tagName, strict );
2308 }
2309 }
2310 propertyName.setValue( interpolatedTrimmed( parser.nextText(), "value" ) );
2311 return propertyName;
2312 }
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324 private Reconcile parseReconcile( XmlPullParser parser, boolean strict )
2325 throws IOException, XmlPullParserException
2326 {
2327 String tagName = parser.getName();
2328 Reconcile reconcile = new Reconcile();
2329 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2330 {
2331 String name = parser.getAttributeName( i );
2332 String value = parser.getAttributeValue( i );
2333
2334 if ( name.indexOf( ':' ) >= 0 )
2335 {
2336
2337 }
2338 else if ( "logAllProperties".equals( name ) )
2339 {
2340 reconcile.setLogAllProperties( getBooleanValue( interpolatedTrimmed( value, "logAllProperties" ), "logAllProperties", parser, "true" ) );
2341 }
2342 else
2343 {
2344 checkUnknownAttribute( parser, name, tagName, strict );
2345 }
2346 }
2347 java.util.Set<String> parsed = new java.util.HashSet<String>();
2348 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2349 {
2350 if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
2351 {
2352 java.util.List<GoalReconciliation> plugins = new java.util.ArrayList<GoalReconciliation>();
2353 while ( parser.nextTag() == XmlPullParser.START_TAG )
2354 {
2355 if ( "plugin".equals( parser.getName() ) )
2356 {
2357 plugins.add( parseGoalReconciliation( parser, strict ) );
2358 }
2359 else
2360 {
2361 checkUnknownElement( parser, strict );
2362 }
2363 }
2364 reconcile.setPlugins( plugins );
2365 }
2366 else
2367 {
2368 checkUnknownElement( parser, strict );
2369 }
2370 }
2371 return reconcile;
2372 }
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384 private Remote parseRemote( XmlPullParser parser, boolean strict )
2385 throws IOException, XmlPullParserException
2386 {
2387 String tagName = parser.getName();
2388 Remote remote = new Remote();
2389 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2390 {
2391 String name = parser.getAttributeName( i );
2392 String value = parser.getAttributeValue( i );
2393
2394 if ( name.indexOf( ':' ) >= 0 )
2395 {
2396
2397 }
2398 else if ( "enabled".equals( name ) )
2399 {
2400 remote.setEnabled( getBooleanValue( interpolatedTrimmed( value, "enabled" ), "enabled", parser, "true" ) );
2401 }
2402 else if ( "saveToRemote".equals( name ) )
2403 {
2404 remote.setSaveToRemote( getBooleanValue( interpolatedTrimmed( value, "saveToRemote" ), "saveToRemote", parser, "false" ) );
2405 }
2406 else if ( "transport".equals( name ) )
2407 {
2408 remote.setTransport( interpolatedTrimmed( value, "transport" ) );
2409 }
2410 else if ( "id".equals( name ) )
2411 {
2412 remote.setId( interpolatedTrimmed( value, "id" ) );
2413 }
2414 else
2415 {
2416 checkUnknownAttribute( parser, name, tagName, strict );
2417 }
2418 }
2419 java.util.Set<String> parsed = new java.util.HashSet<String>();
2420 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2421 {
2422 if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2423 {
2424 remote.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
2425 }
2426 else
2427 {
2428 checkUnknownElement( parser, strict );
2429 }
2430 }
2431 return remote;
2432 }
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444 private TagExclude parseTagExclude( XmlPullParser parser, boolean strict )
2445 throws IOException, XmlPullParserException
2446 {
2447 String tagName = parser.getName();
2448 TagExclude tagExclude = new TagExclude();
2449 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2450 {
2451 String name = parser.getAttributeName( i );
2452 String value = parser.getAttributeValue( i );
2453
2454 if ( name.indexOf( ':' ) >= 0 )
2455 {
2456
2457 }
2458 else if ( "tagName".equals( name ) )
2459 {
2460 tagExclude.setTagName( interpolatedTrimmed( value, "tagName" ) );
2461 }
2462 else
2463 {
2464 checkUnknownAttribute( parser, name, tagName, strict );
2465 }
2466 }
2467 java.util.Set<String> parsed = new java.util.HashSet<String>();
2468 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2469 {
2470 checkUnknownElement( parser, strict );
2471 }
2472 return tagExclude;
2473 }
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485 private TagScanConfig parseTagScanConfig( XmlPullParser parser, boolean strict )
2486 throws IOException, XmlPullParserException
2487 {
2488 String tagName = parser.getName();
2489 TagScanConfig tagScanConfig = new TagScanConfig();
2490 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2491 {
2492 String name = parser.getAttributeName( i );
2493 String value = parser.getAttributeValue( i );
2494
2495 if ( name.indexOf( ':' ) >= 0 )
2496 {
2497
2498 }
2499 else if ( "recursive".equals( name ) )
2500 {
2501 tagScanConfig.setRecursive( getBooleanValue( interpolatedTrimmed( value, "recursive" ), "recursive", parser, "true" ) );
2502 }
2503 else if ( "glob".equals( name ) )
2504 {
2505 tagScanConfig.setGlob( interpolatedTrimmed( value, "glob" ) );
2506 }
2507 else if ( "tagName".equals( name ) )
2508 {
2509 tagScanConfig.setTagName( interpolatedTrimmed( value, "tagName" ) );
2510 }
2511 else
2512 {
2513 checkUnknownAttribute( parser, name, tagName, strict );
2514 }
2515 }
2516 java.util.Set<String> parsed = new java.util.HashSet<String>();
2517 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2518 {
2519 checkUnknownElement( parser, strict );
2520 }
2521 return tagScanConfig;
2522 }
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534 private TrackedProperty parseTrackedProperty( XmlPullParser parser, boolean strict )
2535 throws IOException, XmlPullParserException
2536 {
2537 String tagName = parser.getName();
2538 TrackedProperty trackedProperty = new TrackedProperty();
2539 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2540 {
2541 String name = parser.getAttributeName( i );
2542 String value = parser.getAttributeValue( i );
2543
2544 if ( name.indexOf( ':' ) >= 0 )
2545 {
2546
2547 }
2548 else if ( "propertyName".equals( name ) )
2549 {
2550 trackedProperty.setPropertyName( interpolatedTrimmed( value, "propertyName" ) );
2551 }
2552 else if ( "skipValue".equals( name ) )
2553 {
2554 trackedProperty.setSkipValue( interpolatedTrimmed( value, "skipValue" ) );
2555 }
2556 else if ( "defaultValue".equals( name ) )
2557 {
2558 trackedProperty.setDefaultValue( interpolatedTrimmed( value, "defaultValue" ) );
2559 }
2560 else
2561 {
2562 checkUnknownAttribute( parser, name, tagName, strict );
2563 }
2564 }
2565 trackedProperty.setValue( interpolatedTrimmed( parser.nextText(), "value" ) );
2566 return trackedProperty;
2567 }
2568
2569
2570
2571
2572
2573
2574 public void setAddDefaultEntities( boolean addDefaultEntities )
2575 {
2576 this.addDefaultEntities = addDefaultEntities;
2577 }
2578
2579 public static interface ContentTransformer
2580 {
2581
2582
2583
2584
2585
2586
2587
2588 String transform( String source, String fieldName );
2589 }
2590
2591 }