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