1
2
3
4
5
6 package org.apache.maven.model.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.model.Activation;
17 import org.apache.maven.model.ActivationFile;
18 import org.apache.maven.model.ActivationOS;
19 import org.apache.maven.model.ActivationProperty;
20 import org.apache.maven.model.Build;
21 import org.apache.maven.model.BuildBase;
22 import org.apache.maven.model.CiManagement;
23 import org.apache.maven.model.ConfigurationContainer;
24 import org.apache.maven.model.Contributor;
25 import org.apache.maven.model.Dependency;
26 import org.apache.maven.model.DependencyManagement;
27 import org.apache.maven.model.DeploymentRepository;
28 import org.apache.maven.model.Developer;
29 import org.apache.maven.model.DistributionManagement;
30 import org.apache.maven.model.Exclusion;
31 import org.apache.maven.model.Extension;
32 import org.apache.maven.model.FileSet;
33 import org.apache.maven.model.InputLocation;
34 import org.apache.maven.model.InputSource;
35 import org.apache.maven.model.IssueManagement;
36 import org.apache.maven.model.License;
37 import org.apache.maven.model.MailingList;
38 import org.apache.maven.model.Model;
39 import org.apache.maven.model.ModelBase;
40 import org.apache.maven.model.Notifier;
41 import org.apache.maven.model.Organization;
42 import org.apache.maven.model.Parent;
43 import org.apache.maven.model.PatternSet;
44 import org.apache.maven.model.Plugin;
45 import org.apache.maven.model.PluginConfiguration;
46 import org.apache.maven.model.PluginContainer;
47 import org.apache.maven.model.PluginExecution;
48 import org.apache.maven.model.PluginManagement;
49 import org.apache.maven.model.Prerequisites;
50 import org.apache.maven.model.Profile;
51 import org.apache.maven.model.Relocation;
52 import org.apache.maven.model.ReportPlugin;
53 import org.apache.maven.model.ReportSet;
54 import org.apache.maven.model.Reporting;
55 import org.apache.maven.model.Repository;
56 import org.apache.maven.model.RepositoryBase;
57 import org.apache.maven.model.RepositoryPolicy;
58 import org.apache.maven.model.Resource;
59 import org.apache.maven.model.Scm;
60 import org.apache.maven.model.Site;
61 import org.codehaus.plexus.util.ReaderFactory;
62 import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
63 import org.codehaus.plexus.util.xml.pull.MXParser;
64 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
65 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
66
67
68
69
70
71
72 @SuppressWarnings( "all" )
73 public class MavenXpp3ReaderEx
74 {
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90 private boolean addDefaultEntities = true;
91
92
93
94
95 public final ContentTransformer contentTransformer;
96
97
98
99
100
101
102 public MavenXpp3ReaderEx()
103 {
104 this( new ContentTransformer()
105 {
106 public String transform( String source, String fieldName )
107 {
108 return source;
109 }
110 } );
111 }
112
113 public MavenXpp3ReaderEx(ContentTransformer contentTransformer)
114 {
115 this.contentTransformer = contentTransformer;
116 }
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
135 throws XmlPullParserException
136 {
137 if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
138 {
139 return false;
140 }
141 if ( !parsed.add( tagName ) )
142 {
143 throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
144 }
145 return true;
146 }
147
148
149
150
151
152
153
154
155
156
157
158
159 private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
160 throws XmlPullParserException, IOException
161 {
162
163 if ( strict )
164 {
165 throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
166 }
167 }
168
169
170
171
172
173
174
175
176
177
178 private void checkUnknownElement( XmlPullParser parser, boolean strict )
179 throws XmlPullParserException, IOException
180 {
181 if ( strict )
182 {
183 throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
184 }
185
186 for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
187 {
188 int eventType = parser.next();
189 if ( eventType == XmlPullParser.START_TAG )
190 {
191 unrecognizedTagCount++;
192 }
193 else if ( eventType == XmlPullParser.END_TAG )
194 {
195 unrecognizedTagCount--;
196 }
197 }
198 }
199
200
201
202
203
204
205 public boolean getAddDefaultEntities()
206 {
207 return addDefaultEntities;
208 }
209
210
211
212
213
214
215
216
217
218
219
220 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
221 throws XmlPullParserException
222 {
223 return getBooleanValue( s, attribute, parser, null );
224 }
225
226
227
228
229
230
231
232
233
234
235
236
237 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
238 throws XmlPullParserException
239 {
240 if ( s != null && s.length() != 0 )
241 {
242 return Boolean.valueOf( s ).booleanValue();
243 }
244 if ( defaultValue != null )
245 {
246 return Boolean.valueOf( defaultValue ).booleanValue();
247 }
248 return false;
249 }
250
251
252
253
254
255
256
257
258
259
260
261
262 private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
263 throws XmlPullParserException
264 {
265 if ( s != null )
266 {
267 try
268 {
269 return Byte.valueOf( s ).byteValue();
270 }
271 catch ( NumberFormatException nfe )
272 {
273 if ( strict )
274 {
275 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
276 }
277 }
278 }
279 return 0;
280 }
281
282
283
284
285
286
287
288
289
290
291
292 private char getCharacterValue( String s, String attribute, XmlPullParser parser )
293 throws XmlPullParserException
294 {
295 if ( s != null )
296 {
297 return s.charAt( 0 );
298 }
299 return 0;
300 }
301
302
303
304
305
306
307
308
309
310
311
312 private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
313 throws XmlPullParserException
314 {
315 return getDateValue( s, attribute, null, parser );
316 }
317
318
319
320
321
322
323
324
325
326
327
328
329 private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
330 throws XmlPullParserException
331 {
332 if ( s != null )
333 {
334 String effectiveDateFormat = dateFormat;
335 if ( dateFormat == null )
336 {
337 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
338 }
339 if ( "long".equals( effectiveDateFormat ) )
340 {
341 try
342 {
343 return new java.util.Date( Long.parseLong( s ) );
344 }
345 catch ( NumberFormatException e )
346 {
347 throw new XmlPullParserException( e.getMessage(), parser, e );
348 }
349 }
350 else
351 {
352 try
353 {
354 DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US );
355 return dateParser.parse( s );
356 }
357 catch ( java.text.ParseException e )
358 {
359 throw new XmlPullParserException( e.getMessage(), parser, e );
360 }
361 }
362 }
363 return null;
364 }
365
366
367
368
369
370
371
372
373
374
375
376
377 private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
378 throws XmlPullParserException
379 {
380 if ( s != null )
381 {
382 try
383 {
384 return Double.valueOf( s ).doubleValue();
385 }
386 catch ( NumberFormatException nfe )
387 {
388 if ( strict )
389 {
390 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
391 }
392 }
393 }
394 return 0;
395 }
396
397
398
399
400
401
402
403
404
405
406
407
408 private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
409 throws XmlPullParserException
410 {
411 if ( s != null )
412 {
413 try
414 {
415 return Float.valueOf( s ).floatValue();
416 }
417 catch ( NumberFormatException nfe )
418 {
419 if ( strict )
420 {
421 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
422 }
423 }
424 }
425 return 0;
426 }
427
428
429
430
431
432
433
434
435
436
437
438
439 private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
440 throws XmlPullParserException
441 {
442 if ( s != null )
443 {
444 try
445 {
446 return Integer.valueOf( s ).intValue();
447 }
448 catch ( NumberFormatException nfe )
449 {
450 if ( strict )
451 {
452 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
453 }
454 }
455 }
456 return 0;
457 }
458
459
460
461
462
463
464
465
466
467
468
469
470 private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
471 throws XmlPullParserException
472 {
473 if ( s != null )
474 {
475 try
476 {
477 return Long.valueOf( s ).longValue();
478 }
479 catch ( NumberFormatException nfe )
480 {
481 if ( strict )
482 {
483 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
484 }
485 }
486 }
487 return 0;
488 }
489
490
491
492
493
494
495
496
497
498
499
500
501 private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
502 throws XmlPullParserException
503 {
504 if ( s == null )
505 {
506 if ( strict )
507 {
508 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
509 }
510 }
511 return s;
512 }
513
514
515
516
517
518
519
520
521
522
523
524
525 private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
526 throws XmlPullParserException
527 {
528 if ( s != null )
529 {
530 try
531 {
532 return Short.valueOf( s ).shortValue();
533 }
534 catch ( NumberFormatException nfe )
535 {
536 if ( strict )
537 {
538 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
539 }
540 }
541 }
542 return 0;
543 }
544
545
546
547
548
549
550
551 private String getTrimmedValue( String s )
552 {
553 if ( s != null )
554 {
555 s = s.trim();
556 }
557 return s;
558 }
559
560
561
562
563
564
565
566
567 private String interpolatedTrimmed( String value, String context )
568 {
569 return getTrimmedValue( contentTransformer.transform( value, context ) );
570 }
571
572
573
574
575
576
577
578
579
580
581 private int nextTag( XmlPullParser parser )
582 throws IOException, XmlPullParserException
583 {
584 int eventType = parser.next();
585 if ( eventType == XmlPullParser.TEXT )
586 {
587 eventType = parser.next();
588 }
589 if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
590 {
591 throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
592 }
593 return eventType;
594 }
595
596
597
598
599
600
601
602
603
604
605
606
607 public Model read( Reader reader, boolean strict, InputSource source )
608 throws IOException, XmlPullParserException
609 {
610 XmlPullParser parser = addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser( );
611
612 parser.setInput( reader );
613
614
615 return read( parser, strict, source );
616 }
617
618
619
620
621
622
623
624
625
626
627
628
629 public Model read( InputStream in, boolean strict, InputSource source )
630 throws IOException, XmlPullParserException
631 {
632 return read( ReaderFactory.newXmlReader( in ), strict, source );
633 }
634
635
636
637
638
639
640
641
642
643
644
645
646 private Activation parseActivation( XmlPullParser parser, boolean strict, InputSource source )
647 throws IOException, XmlPullParserException
648 {
649 String tagName = parser.getName();
650 Activation activation = new Activation();
651 InputLocation _location;
652 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
653 activation.setLocation( "", _location );
654 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
655 {
656 String name = parser.getAttributeName( i );
657 String value = parser.getAttributeValue( i );
658
659 if ( name.indexOf( ':' ) >= 0 )
660 {
661
662 }
663 else
664 {
665 checkUnknownAttribute( parser, name, tagName, strict );
666 }
667 }
668 java.util.Set parsed = new java.util.HashSet();
669 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
670 {
671 if ( checkFieldWithDuplicate( parser, "activeByDefault", null, parsed ) )
672 {
673 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
674 activation.setLocation( "activeByDefault", _location );
675 activation.setActiveByDefault( getBooleanValue( interpolatedTrimmed( parser.nextText(), "activeByDefault" ), "activeByDefault", parser, "false" ) );
676 }
677 else if ( checkFieldWithDuplicate( parser, "jdk", null, parsed ) )
678 {
679 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
680 activation.setLocation( "jdk", _location );
681 activation.setJdk( interpolatedTrimmed( parser.nextText(), "jdk" ) );
682 }
683 else if ( checkFieldWithDuplicate( parser, "os", null, parsed ) )
684 {
685 activation.setOs( parseActivationOS( parser, strict, source ) );
686 }
687 else if ( checkFieldWithDuplicate( parser, "property", null, parsed ) )
688 {
689 activation.setProperty( parseActivationProperty( parser, strict, source ) );
690 }
691 else if ( checkFieldWithDuplicate( parser, "file", null, parsed ) )
692 {
693 activation.setFile( parseActivationFile( parser, strict, source ) );
694 }
695 else
696 {
697 checkUnknownElement( parser, strict );
698 }
699 }
700 return activation;
701 }
702
703
704
705
706
707
708
709
710
711
712
713
714 private ActivationFile parseActivationFile( XmlPullParser parser, boolean strict, InputSource source )
715 throws IOException, XmlPullParserException
716 {
717 String tagName = parser.getName();
718 ActivationFile activationFile = new ActivationFile();
719 InputLocation _location;
720 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
721 activationFile.setLocation( "", _location );
722 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
723 {
724 String name = parser.getAttributeName( i );
725 String value = parser.getAttributeValue( i );
726
727 if ( name.indexOf( ':' ) >= 0 )
728 {
729
730 }
731 else
732 {
733 checkUnknownAttribute( parser, name, tagName, strict );
734 }
735 }
736 java.util.Set parsed = new java.util.HashSet();
737 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
738 {
739 if ( checkFieldWithDuplicate( parser, "missing", null, parsed ) )
740 {
741 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
742 activationFile.setLocation( "missing", _location );
743 activationFile.setMissing( interpolatedTrimmed( parser.nextText(), "missing" ) );
744 }
745 else if ( checkFieldWithDuplicate( parser, "exists", null, parsed ) )
746 {
747 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
748 activationFile.setLocation( "exists", _location );
749 activationFile.setExists( interpolatedTrimmed( parser.nextText(), "exists" ) );
750 }
751 else
752 {
753 checkUnknownElement( parser, strict );
754 }
755 }
756 return activationFile;
757 }
758
759
760
761
762
763
764
765
766
767
768
769
770 private ActivationOS parseActivationOS( XmlPullParser parser, boolean strict, InputSource source )
771 throws IOException, XmlPullParserException
772 {
773 String tagName = parser.getName();
774 ActivationOS activationOS = new ActivationOS();
775 InputLocation _location;
776 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
777 activationOS.setLocation( "", _location );
778 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
779 {
780 String name = parser.getAttributeName( i );
781 String value = parser.getAttributeValue( i );
782
783 if ( name.indexOf( ':' ) >= 0 )
784 {
785
786 }
787 else
788 {
789 checkUnknownAttribute( parser, name, tagName, strict );
790 }
791 }
792 java.util.Set parsed = new java.util.HashSet();
793 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
794 {
795 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
796 {
797 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
798 activationOS.setLocation( "name", _location );
799 activationOS.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
800 }
801 else if ( checkFieldWithDuplicate( parser, "family", null, parsed ) )
802 {
803 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
804 activationOS.setLocation( "family", _location );
805 activationOS.setFamily( interpolatedTrimmed( parser.nextText(), "family" ) );
806 }
807 else if ( checkFieldWithDuplicate( parser, "arch", null, parsed ) )
808 {
809 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
810 activationOS.setLocation( "arch", _location );
811 activationOS.setArch( interpolatedTrimmed( parser.nextText(), "arch" ) );
812 }
813 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
814 {
815 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
816 activationOS.setLocation( "version", _location );
817 activationOS.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
818 }
819 else
820 {
821 checkUnknownElement( parser, strict );
822 }
823 }
824 return activationOS;
825 }
826
827
828
829
830
831
832
833
834
835
836
837
838 private ActivationProperty parseActivationProperty( XmlPullParser parser, boolean strict, InputSource source )
839 throws IOException, XmlPullParserException
840 {
841 String tagName = parser.getName();
842 ActivationProperty activationProperty = new ActivationProperty();
843 InputLocation _location;
844 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
845 activationProperty.setLocation( "", _location );
846 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
847 {
848 String name = parser.getAttributeName( i );
849 String value = parser.getAttributeValue( i );
850
851 if ( name.indexOf( ':' ) >= 0 )
852 {
853
854 }
855 else
856 {
857 checkUnknownAttribute( parser, name, tagName, strict );
858 }
859 }
860 java.util.Set parsed = new java.util.HashSet();
861 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
862 {
863 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
864 {
865 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
866 activationProperty.setLocation( "name", _location );
867 activationProperty.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
868 }
869 else if ( checkFieldWithDuplicate( parser, "value", null, parsed ) )
870 {
871 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
872 activationProperty.setLocation( "value", _location );
873 activationProperty.setValue( interpolatedTrimmed( parser.nextText(), "value" ) );
874 }
875 else
876 {
877 checkUnknownElement( parser, strict );
878 }
879 }
880 return activationProperty;
881 }
882
883
884
885
886
887
888
889
890
891
892
893
894 private Build parseBuild( XmlPullParser parser, boolean strict, InputSource source )
895 throws IOException, XmlPullParserException
896 {
897 String tagName = parser.getName();
898 Build build = new Build();
899 InputLocation _location;
900 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
901 build.setLocation( "", _location );
902 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
903 {
904 String name = parser.getAttributeName( i );
905 String value = parser.getAttributeValue( i );
906
907 if ( name.indexOf( ':' ) >= 0 )
908 {
909
910 }
911 else
912 {
913 checkUnknownAttribute( parser, name, tagName, strict );
914 }
915 }
916 java.util.Set parsed = new java.util.HashSet();
917 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
918 {
919 if ( checkFieldWithDuplicate( parser, "sourceDirectory", null, parsed ) )
920 {
921 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
922 build.setLocation( "sourceDirectory", _location );
923 build.setSourceDirectory( interpolatedTrimmed( parser.nextText(), "sourceDirectory" ) );
924 }
925 else if ( checkFieldWithDuplicate( parser, "scriptSourceDirectory", null, parsed ) )
926 {
927 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
928 build.setLocation( "scriptSourceDirectory", _location );
929 build.setScriptSourceDirectory( interpolatedTrimmed( parser.nextText(), "scriptSourceDirectory" ) );
930 }
931 else if ( checkFieldWithDuplicate( parser, "testSourceDirectory", null, parsed ) )
932 {
933 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
934 build.setLocation( "testSourceDirectory", _location );
935 build.setTestSourceDirectory( interpolatedTrimmed( parser.nextText(), "testSourceDirectory" ) );
936 }
937 else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
938 {
939 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
940 build.setLocation( "outputDirectory", _location );
941 build.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
942 }
943 else if ( checkFieldWithDuplicate( parser, "testOutputDirectory", null, parsed ) )
944 {
945 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
946 build.setLocation( "testOutputDirectory", _location );
947 build.setTestOutputDirectory( interpolatedTrimmed( parser.nextText(), "testOutputDirectory" ) );
948 }
949 else if ( checkFieldWithDuplicate( parser, "extensions", null, parsed ) )
950 {
951 java.util.List<Extension> extensions = new java.util.ArrayList<Extension>();
952 build.setExtensions( extensions );
953 while ( parser.nextTag() == XmlPullParser.START_TAG )
954 {
955 if ( "extension".equals( parser.getName() ) )
956 {
957 extensions.add( parseExtension( parser, strict, source ) );
958 }
959 else
960 {
961 checkUnknownElement( parser, strict );
962 }
963 }
964 }
965 else if ( checkFieldWithDuplicate( parser, "defaultGoal", null, parsed ) )
966 {
967 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
968 build.setLocation( "defaultGoal", _location );
969 build.setDefaultGoal( interpolatedTrimmed( parser.nextText(), "defaultGoal" ) );
970 }
971 else if ( checkFieldWithDuplicate( parser, "resources", null, parsed ) )
972 {
973 java.util.List<Resource> resources = new java.util.ArrayList<Resource>();
974 build.setResources( resources );
975 while ( parser.nextTag() == XmlPullParser.START_TAG )
976 {
977 if ( "resource".equals( parser.getName() ) )
978 {
979 resources.add( parseResource( parser, strict, source ) );
980 }
981 else
982 {
983 checkUnknownElement( parser, strict );
984 }
985 }
986 }
987 else if ( checkFieldWithDuplicate( parser, "testResources", null, parsed ) )
988 {
989 java.util.List<Resource> testResources = new java.util.ArrayList<Resource>();
990 build.setTestResources( testResources );
991 while ( parser.nextTag() == XmlPullParser.START_TAG )
992 {
993 if ( "testResource".equals( parser.getName() ) )
994 {
995 testResources.add( parseResource( parser, strict, source ) );
996 }
997 else
998 {
999 checkUnknownElement( parser, strict );
1000 }
1001 }
1002 }
1003 else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1004 {
1005 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1006 build.setLocation( "directory", _location );
1007 build.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
1008 }
1009 else if ( checkFieldWithDuplicate( parser, "finalName", null, parsed ) )
1010 {
1011 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1012 build.setLocation( "finalName", _location );
1013 build.setFinalName( interpolatedTrimmed( parser.nextText(), "finalName" ) );
1014 }
1015 else if ( checkFieldWithDuplicate( parser, "filters", null, parsed ) )
1016 {
1017 java.util.List<String> filters = new java.util.ArrayList<String>();
1018 build.setFilters( filters );
1019 InputLocation _locations;
1020 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1021 build.setLocation( "filters", _locations );
1022 while ( parser.nextTag() == XmlPullParser.START_TAG )
1023 {
1024 if ( "filter".equals( parser.getName() ) )
1025 {
1026 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1027 _locations.setLocation( Integer.valueOf( filters.size() ), _location );
1028 filters.add( interpolatedTrimmed( parser.nextText(), "filters" ) );
1029 }
1030 else
1031 {
1032 checkUnknownElement( parser, strict );
1033 }
1034 }
1035 }
1036 else if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
1037 {
1038 build.setPluginManagement( parsePluginManagement( parser, strict, source ) );
1039 }
1040 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
1041 {
1042 java.util.List<Plugin> plugins = new java.util.ArrayList<Plugin>();
1043 build.setPlugins( plugins );
1044 while ( parser.nextTag() == XmlPullParser.START_TAG )
1045 {
1046 if ( "plugin".equals( parser.getName() ) )
1047 {
1048 plugins.add( parsePlugin( parser, strict, source ) );
1049 }
1050 else
1051 {
1052 checkUnknownElement( parser, strict );
1053 }
1054 }
1055 }
1056 else
1057 {
1058 checkUnknownElement( parser, strict );
1059 }
1060 }
1061 return build;
1062 }
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075 private BuildBase parseBuildBase( XmlPullParser parser, boolean strict, InputSource source )
1076 throws IOException, XmlPullParserException
1077 {
1078 String tagName = parser.getName();
1079 BuildBase buildBase = new BuildBase();
1080 InputLocation _location;
1081 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1082 buildBase.setLocation( "", _location );
1083 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1084 {
1085 String name = parser.getAttributeName( i );
1086 String value = parser.getAttributeValue( i );
1087
1088 if ( name.indexOf( ':' ) >= 0 )
1089 {
1090
1091 }
1092 else
1093 {
1094 checkUnknownAttribute( parser, name, tagName, strict );
1095 }
1096 }
1097 java.util.Set parsed = new java.util.HashSet();
1098 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1099 {
1100 if ( checkFieldWithDuplicate( parser, "defaultGoal", null, parsed ) )
1101 {
1102 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1103 buildBase.setLocation( "defaultGoal", _location );
1104 buildBase.setDefaultGoal( interpolatedTrimmed( parser.nextText(), "defaultGoal" ) );
1105 }
1106 else if ( checkFieldWithDuplicate( parser, "resources", null, parsed ) )
1107 {
1108 java.util.List<Resource> resources = new java.util.ArrayList<Resource>();
1109 buildBase.setResources( resources );
1110 while ( parser.nextTag() == XmlPullParser.START_TAG )
1111 {
1112 if ( "resource".equals( parser.getName() ) )
1113 {
1114 resources.add( parseResource( parser, strict, source ) );
1115 }
1116 else
1117 {
1118 checkUnknownElement( parser, strict );
1119 }
1120 }
1121 }
1122 else if ( checkFieldWithDuplicate( parser, "testResources", null, parsed ) )
1123 {
1124 java.util.List<Resource> testResources = new java.util.ArrayList<Resource>();
1125 buildBase.setTestResources( testResources );
1126 while ( parser.nextTag() == XmlPullParser.START_TAG )
1127 {
1128 if ( "testResource".equals( parser.getName() ) )
1129 {
1130 testResources.add( parseResource( parser, strict, source ) );
1131 }
1132 else
1133 {
1134 checkUnknownElement( parser, strict );
1135 }
1136 }
1137 }
1138 else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1139 {
1140 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1141 buildBase.setLocation( "directory", _location );
1142 buildBase.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
1143 }
1144 else if ( checkFieldWithDuplicate( parser, "finalName", null, parsed ) )
1145 {
1146 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1147 buildBase.setLocation( "finalName", _location );
1148 buildBase.setFinalName( interpolatedTrimmed( parser.nextText(), "finalName" ) );
1149 }
1150 else if ( checkFieldWithDuplicate( parser, "filters", null, parsed ) )
1151 {
1152 java.util.List<String> filters = new java.util.ArrayList<String>();
1153 buildBase.setFilters( filters );
1154 InputLocation _locations;
1155 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1156 buildBase.setLocation( "filters", _locations );
1157 while ( parser.nextTag() == XmlPullParser.START_TAG )
1158 {
1159 if ( "filter".equals( parser.getName() ) )
1160 {
1161 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1162 _locations.setLocation( Integer.valueOf( filters.size() ), _location );
1163 filters.add( interpolatedTrimmed( parser.nextText(), "filters" ) );
1164 }
1165 else
1166 {
1167 checkUnknownElement( parser, strict );
1168 }
1169 }
1170 }
1171 else if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
1172 {
1173 buildBase.setPluginManagement( parsePluginManagement( parser, strict, source ) );
1174 }
1175 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
1176 {
1177 java.util.List<Plugin> plugins = new java.util.ArrayList<Plugin>();
1178 buildBase.setPlugins( plugins );
1179 while ( parser.nextTag() == XmlPullParser.START_TAG )
1180 {
1181 if ( "plugin".equals( parser.getName() ) )
1182 {
1183 plugins.add( parsePlugin( parser, strict, source ) );
1184 }
1185 else
1186 {
1187 checkUnknownElement( parser, strict );
1188 }
1189 }
1190 }
1191 else
1192 {
1193 checkUnknownElement( parser, strict );
1194 }
1195 }
1196 return buildBase;
1197 }
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210 private CiManagement parseCiManagement( XmlPullParser parser, boolean strict, InputSource source )
1211 throws IOException, XmlPullParserException
1212 {
1213 String tagName = parser.getName();
1214 CiManagement ciManagement = new CiManagement();
1215 InputLocation _location;
1216 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1217 ciManagement.setLocation( "", _location );
1218 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1219 {
1220 String name = parser.getAttributeName( i );
1221 String value = parser.getAttributeValue( i );
1222
1223 if ( name.indexOf( ':' ) >= 0 )
1224 {
1225
1226 }
1227 else
1228 {
1229 checkUnknownAttribute( parser, name, tagName, strict );
1230 }
1231 }
1232 java.util.Set parsed = new java.util.HashSet();
1233 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1234 {
1235 if ( checkFieldWithDuplicate( parser, "system", null, parsed ) )
1236 {
1237 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1238 ciManagement.setLocation( "system", _location );
1239 ciManagement.setSystem( interpolatedTrimmed( parser.nextText(), "system" ) );
1240 }
1241 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1242 {
1243 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1244 ciManagement.setLocation( "url", _location );
1245 ciManagement.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
1246 }
1247 else if ( checkFieldWithDuplicate( parser, "notifiers", null, parsed ) )
1248 {
1249 java.util.List<Notifier> notifiers = new java.util.ArrayList<Notifier>();
1250 ciManagement.setNotifiers( notifiers );
1251 while ( parser.nextTag() == XmlPullParser.START_TAG )
1252 {
1253 if ( "notifier".equals( parser.getName() ) )
1254 {
1255 notifiers.add( parseNotifier( parser, strict, source ) );
1256 }
1257 else
1258 {
1259 checkUnknownElement( parser, strict );
1260 }
1261 }
1262 }
1263 else
1264 {
1265 checkUnknownElement( parser, strict );
1266 }
1267 }
1268 return ciManagement;
1269 }
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282 private ConfigurationContainer parseConfigurationContainer( XmlPullParser parser, boolean strict, InputSource source )
1283 throws IOException, XmlPullParserException
1284 {
1285 String tagName = parser.getName();
1286 ConfigurationContainer configurationContainer = new ConfigurationContainer();
1287 InputLocation _location;
1288 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1289 configurationContainer.setLocation( "", _location );
1290 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1291 {
1292 String name = parser.getAttributeName( i );
1293 String value = parser.getAttributeValue( i );
1294
1295 if ( name.indexOf( ':' ) >= 0 )
1296 {
1297
1298 }
1299 else
1300 {
1301 checkUnknownAttribute( parser, name, tagName, strict );
1302 }
1303 }
1304 java.util.Set parsed = new java.util.HashSet();
1305 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1306 {
1307 if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
1308 {
1309 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1310 configurationContainer.setLocation( "inherited", _location );
1311 configurationContainer.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
1312 }
1313 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
1314 {
1315 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1316 configurationContainer.setLocation( "configuration", _location );
1317 configurationContainer.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
1318 }
1319 else
1320 {
1321 checkUnknownElement( parser, strict );
1322 }
1323 }
1324 return configurationContainer;
1325 }
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338 private Contributor parseContributor( XmlPullParser parser, boolean strict, InputSource source )
1339 throws IOException, XmlPullParserException
1340 {
1341 String tagName = parser.getName();
1342 Contributor contributor = new Contributor();
1343 InputLocation _location;
1344 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1345 contributor.setLocation( "", _location );
1346 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1347 {
1348 String name = parser.getAttributeName( i );
1349 String value = parser.getAttributeValue( i );
1350
1351 if ( name.indexOf( ':' ) >= 0 )
1352 {
1353
1354 }
1355 else
1356 {
1357 checkUnknownAttribute( parser, name, tagName, strict );
1358 }
1359 }
1360 java.util.Set parsed = new java.util.HashSet();
1361 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1362 {
1363 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1364 {
1365 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1366 contributor.setLocation( "name", _location );
1367 contributor.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
1368 }
1369 else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
1370 {
1371 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1372 contributor.setLocation( "email", _location );
1373 contributor.setEmail( interpolatedTrimmed( parser.nextText(), "email" ) );
1374 }
1375 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1376 {
1377 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1378 contributor.setLocation( "url", _location );
1379 contributor.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
1380 }
1381 else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
1382 {
1383 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1384 contributor.setLocation( "organization", _location );
1385 contributor.setOrganization( interpolatedTrimmed( parser.nextText(), "organization" ) );
1386 }
1387 else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
1388 {
1389 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1390 contributor.setLocation( "organizationUrl", _location );
1391 contributor.setOrganizationUrl( interpolatedTrimmed( parser.nextText(), "organizationUrl" ) );
1392 }
1393 else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
1394 {
1395 java.util.List<String> roles = new java.util.ArrayList<String>();
1396 contributor.setRoles( roles );
1397 InputLocation _locations;
1398 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1399 contributor.setLocation( "roles", _locations );
1400 while ( parser.nextTag() == XmlPullParser.START_TAG )
1401 {
1402 if ( "role".equals( parser.getName() ) )
1403 {
1404 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1405 _locations.setLocation( Integer.valueOf( roles.size() ), _location );
1406 roles.add( interpolatedTrimmed( parser.nextText(), "roles" ) );
1407 }
1408 else
1409 {
1410 checkUnknownElement( parser, strict );
1411 }
1412 }
1413 }
1414 else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
1415 {
1416 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1417 contributor.setLocation( "timezone", _location );
1418 contributor.setTimezone( interpolatedTrimmed( parser.nextText(), "timezone" ) );
1419 }
1420 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
1421 {
1422 InputLocation _locations;
1423 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1424 contributor.setLocation( "properties", _locations );
1425 while ( parser.nextTag() == XmlPullParser.START_TAG )
1426 {
1427 String key = parser.getName();
1428 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1429 _locations.setLocation( key, _location );
1430 String value = parser.nextText().trim();
1431 contributor.addProperty( key, value );
1432 }
1433 }
1434 else
1435 {
1436 checkUnknownElement( parser, strict );
1437 }
1438 }
1439 return contributor;
1440 }
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453 private Dependency parseDependency( XmlPullParser parser, boolean strict, InputSource source )
1454 throws IOException, XmlPullParserException
1455 {
1456 String tagName = parser.getName();
1457 Dependency dependency = new Dependency();
1458 InputLocation _location;
1459 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1460 dependency.setLocation( "", _location );
1461 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1462 {
1463 String name = parser.getAttributeName( i );
1464 String value = parser.getAttributeValue( i );
1465
1466 if ( name.indexOf( ':' ) >= 0 )
1467 {
1468
1469 }
1470 else
1471 {
1472 checkUnknownAttribute( parser, name, tagName, strict );
1473 }
1474 }
1475 java.util.Set parsed = new java.util.HashSet();
1476 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1477 {
1478 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1479 {
1480 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1481 dependency.setLocation( "groupId", _location );
1482 dependency.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
1483 }
1484 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
1485 {
1486 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1487 dependency.setLocation( "artifactId", _location );
1488 dependency.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
1489 }
1490 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1491 {
1492 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1493 dependency.setLocation( "version", _location );
1494 dependency.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
1495 }
1496 else if ( checkFieldWithDuplicate( parser, "type", null, parsed ) )
1497 {
1498 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1499 dependency.setLocation( "type", _location );
1500 dependency.setType( interpolatedTrimmed( parser.nextText(), "type" ) );
1501 }
1502 else if ( checkFieldWithDuplicate( parser, "classifier", null, parsed ) )
1503 {
1504 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1505 dependency.setLocation( "classifier", _location );
1506 dependency.setClassifier( interpolatedTrimmed( parser.nextText(), "classifier" ) );
1507 }
1508 else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
1509 {
1510 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1511 dependency.setLocation( "scope", _location );
1512 dependency.setScope( interpolatedTrimmed( parser.nextText(), "scope" ) );
1513 }
1514 else if ( checkFieldWithDuplicate( parser, "systemPath", null, parsed ) )
1515 {
1516 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1517 dependency.setLocation( "systemPath", _location );
1518 dependency.setSystemPath( interpolatedTrimmed( parser.nextText(), "systemPath" ) );
1519 }
1520 else if ( checkFieldWithDuplicate( parser, "exclusions", null, parsed ) )
1521 {
1522 java.util.List<Exclusion> exclusions = new java.util.ArrayList<Exclusion>();
1523 dependency.setExclusions( exclusions );
1524 while ( parser.nextTag() == XmlPullParser.START_TAG )
1525 {
1526 if ( "exclusion".equals( parser.getName() ) )
1527 {
1528 exclusions.add( parseExclusion( parser, strict, source ) );
1529 }
1530 else
1531 {
1532 checkUnknownElement( parser, strict );
1533 }
1534 }
1535 }
1536 else if ( checkFieldWithDuplicate( parser, "optional", null, parsed ) )
1537 {
1538 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1539 dependency.setLocation( "optional", _location );
1540 dependency.setOptional( interpolatedTrimmed( parser.nextText(), "optional" ) );
1541 }
1542 else
1543 {
1544 checkUnknownElement( parser, strict );
1545 }
1546 }
1547 return dependency;
1548 }
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561 private DependencyManagement parseDependencyManagement( XmlPullParser parser, boolean strict, InputSource source )
1562 throws IOException, XmlPullParserException
1563 {
1564 String tagName = parser.getName();
1565 DependencyManagement dependencyManagement = new DependencyManagement();
1566 InputLocation _location;
1567 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1568 dependencyManagement.setLocation( "", _location );
1569 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1570 {
1571 String name = parser.getAttributeName( i );
1572 String value = parser.getAttributeValue( i );
1573
1574 if ( name.indexOf( ':' ) >= 0 )
1575 {
1576
1577 }
1578 else
1579 {
1580 checkUnknownAttribute( parser, name, tagName, strict );
1581 }
1582 }
1583 java.util.Set parsed = new java.util.HashSet();
1584 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1585 {
1586 if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
1587 {
1588 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
1589 dependencyManagement.setDependencies( dependencies );
1590 while ( parser.nextTag() == XmlPullParser.START_TAG )
1591 {
1592 if ( "dependency".equals( parser.getName() ) )
1593 {
1594 dependencies.add( parseDependency( parser, strict, source ) );
1595 }
1596 else
1597 {
1598 checkUnknownElement( parser, strict );
1599 }
1600 }
1601 }
1602 else
1603 {
1604 checkUnknownElement( parser, strict );
1605 }
1606 }
1607 return dependencyManagement;
1608 }
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621 private DeploymentRepository parseDeploymentRepository( XmlPullParser parser, boolean strict, InputSource source )
1622 throws IOException, XmlPullParserException
1623 {
1624 String tagName = parser.getName();
1625 DeploymentRepository deploymentRepository = new DeploymentRepository();
1626 InputLocation _location;
1627 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1628 deploymentRepository.setLocation( "", _location );
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
1639 {
1640 checkUnknownAttribute( parser, name, tagName, strict );
1641 }
1642 }
1643 java.util.Set parsed = new java.util.HashSet();
1644 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1645 {
1646 if ( checkFieldWithDuplicate( parser, "uniqueVersion", null, parsed ) )
1647 {
1648 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1649 deploymentRepository.setLocation( "uniqueVersion", _location );
1650 deploymentRepository.setUniqueVersion( getBooleanValue( interpolatedTrimmed( parser.nextText(), "uniqueVersion" ), "uniqueVersion", parser, "true" ) );
1651 }
1652 else if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) )
1653 {
1654 deploymentRepository.setReleases( parseRepositoryPolicy( parser, strict, source ) );
1655 }
1656 else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) )
1657 {
1658 deploymentRepository.setSnapshots( parseRepositoryPolicy( parser, strict, source ) );
1659 }
1660 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1661 {
1662 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1663 deploymentRepository.setLocation( "id", _location );
1664 deploymentRepository.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
1665 }
1666 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1667 {
1668 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1669 deploymentRepository.setLocation( "name", _location );
1670 deploymentRepository.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
1671 }
1672 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1673 {
1674 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1675 deploymentRepository.setLocation( "url", _location );
1676 deploymentRepository.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
1677 }
1678 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
1679 {
1680 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1681 deploymentRepository.setLocation( "layout", _location );
1682 deploymentRepository.setLayout( interpolatedTrimmed( parser.nextText(), "layout" ) );
1683 }
1684 else
1685 {
1686 checkUnknownElement( parser, strict );
1687 }
1688 }
1689 return deploymentRepository;
1690 }
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703 private Developer parseDeveloper( XmlPullParser parser, boolean strict, InputSource source )
1704 throws IOException, XmlPullParserException
1705 {
1706 String tagName = parser.getName();
1707 Developer developer = new Developer();
1708 InputLocation _location;
1709 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1710 developer.setLocation( "", _location );
1711 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1712 {
1713 String name = parser.getAttributeName( i );
1714 String value = parser.getAttributeValue( i );
1715
1716 if ( name.indexOf( ':' ) >= 0 )
1717 {
1718
1719 }
1720 else
1721 {
1722 checkUnknownAttribute( parser, name, tagName, strict );
1723 }
1724 }
1725 java.util.Set parsed = new java.util.HashSet();
1726 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1727 {
1728 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1729 {
1730 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1731 developer.setLocation( "id", _location );
1732 developer.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
1733 }
1734 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1735 {
1736 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1737 developer.setLocation( "name", _location );
1738 developer.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
1739 }
1740 else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
1741 {
1742 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1743 developer.setLocation( "email", _location );
1744 developer.setEmail( interpolatedTrimmed( parser.nextText(), "email" ) );
1745 }
1746 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1747 {
1748 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1749 developer.setLocation( "url", _location );
1750 developer.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
1751 }
1752 else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
1753 {
1754 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1755 developer.setLocation( "organization", _location );
1756 developer.setOrganization( interpolatedTrimmed( parser.nextText(), "organization" ) );
1757 }
1758 else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
1759 {
1760 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1761 developer.setLocation( "organizationUrl", _location );
1762 developer.setOrganizationUrl( interpolatedTrimmed( parser.nextText(), "organizationUrl" ) );
1763 }
1764 else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
1765 {
1766 java.util.List<String> roles = new java.util.ArrayList<String>();
1767 developer.setRoles( roles );
1768 InputLocation _locations;
1769 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1770 developer.setLocation( "roles", _locations );
1771 while ( parser.nextTag() == XmlPullParser.START_TAG )
1772 {
1773 if ( "role".equals( parser.getName() ) )
1774 {
1775 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1776 _locations.setLocation( Integer.valueOf( roles.size() ), _location );
1777 roles.add( interpolatedTrimmed( parser.nextText(), "roles" ) );
1778 }
1779 else
1780 {
1781 checkUnknownElement( parser, strict );
1782 }
1783 }
1784 }
1785 else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
1786 {
1787 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1788 developer.setLocation( "timezone", _location );
1789 developer.setTimezone( interpolatedTrimmed( parser.nextText(), "timezone" ) );
1790 }
1791 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
1792 {
1793 InputLocation _locations;
1794 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1795 developer.setLocation( "properties", _locations );
1796 while ( parser.nextTag() == XmlPullParser.START_TAG )
1797 {
1798 String key = parser.getName();
1799 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1800 _locations.setLocation( key, _location );
1801 String value = parser.nextText().trim();
1802 developer.addProperty( key, value );
1803 }
1804 }
1805 else
1806 {
1807 checkUnknownElement( parser, strict );
1808 }
1809 }
1810 return developer;
1811 }
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824 private DistributionManagement parseDistributionManagement( XmlPullParser parser, boolean strict, InputSource source )
1825 throws IOException, XmlPullParserException
1826 {
1827 String tagName = parser.getName();
1828 DistributionManagement distributionManagement = new DistributionManagement();
1829 InputLocation _location;
1830 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1831 distributionManagement.setLocation( "", _location );
1832 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1833 {
1834 String name = parser.getAttributeName( i );
1835 String value = parser.getAttributeValue( i );
1836
1837 if ( name.indexOf( ':' ) >= 0 )
1838 {
1839
1840 }
1841 else
1842 {
1843 checkUnknownAttribute( parser, name, tagName, strict );
1844 }
1845 }
1846 java.util.Set parsed = new java.util.HashSet();
1847 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1848 {
1849 if ( checkFieldWithDuplicate( parser, "repository", null, parsed ) )
1850 {
1851 distributionManagement.setRepository( parseDeploymentRepository( parser, strict, source ) );
1852 }
1853 else if ( checkFieldWithDuplicate( parser, "snapshotRepository", null, parsed ) )
1854 {
1855 distributionManagement.setSnapshotRepository( parseDeploymentRepository( parser, strict, source ) );
1856 }
1857 else if ( checkFieldWithDuplicate( parser, "site", null, parsed ) )
1858 {
1859 distributionManagement.setSite( parseSite( parser, strict, source ) );
1860 }
1861 else if ( checkFieldWithDuplicate( parser, "downloadUrl", null, parsed ) )
1862 {
1863 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1864 distributionManagement.setLocation( "downloadUrl", _location );
1865 distributionManagement.setDownloadUrl( interpolatedTrimmed( parser.nextText(), "downloadUrl" ) );
1866 }
1867 else if ( checkFieldWithDuplicate( parser, "relocation", null, parsed ) )
1868 {
1869 distributionManagement.setRelocation( parseRelocation( parser, strict, source ) );
1870 }
1871 else if ( checkFieldWithDuplicate( parser, "status", null, parsed ) )
1872 {
1873 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1874 distributionManagement.setLocation( "status", _location );
1875 distributionManagement.setStatus( interpolatedTrimmed( parser.nextText(), "status" ) );
1876 }
1877 else
1878 {
1879 checkUnknownElement( parser, strict );
1880 }
1881 }
1882 return distributionManagement;
1883 }
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896 private Exclusion parseExclusion( XmlPullParser parser, boolean strict, InputSource source )
1897 throws IOException, XmlPullParserException
1898 {
1899 String tagName = parser.getName();
1900 Exclusion exclusion = new Exclusion();
1901 InputLocation _location;
1902 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1903 exclusion.setLocation( "", _location );
1904 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1905 {
1906 String name = parser.getAttributeName( i );
1907 String value = parser.getAttributeValue( i );
1908
1909 if ( name.indexOf( ':' ) >= 0 )
1910 {
1911
1912 }
1913 else
1914 {
1915 checkUnknownAttribute( parser, name, tagName, strict );
1916 }
1917 }
1918 java.util.Set parsed = new java.util.HashSet();
1919 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1920 {
1921 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1922 {
1923 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1924 exclusion.setLocation( "groupId", _location );
1925 exclusion.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
1926 }
1927 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
1928 {
1929 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1930 exclusion.setLocation( "artifactId", _location );
1931 exclusion.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
1932 }
1933 else
1934 {
1935 checkUnknownElement( parser, strict );
1936 }
1937 }
1938 return exclusion;
1939 }
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952 private Extension parseExtension( XmlPullParser parser, boolean strict, InputSource source )
1953 throws IOException, XmlPullParserException
1954 {
1955 String tagName = parser.getName();
1956 Extension extension = new Extension();
1957 InputLocation _location;
1958 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1959 extension.setLocation( "", _location );
1960 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1961 {
1962 String name = parser.getAttributeName( i );
1963 String value = parser.getAttributeValue( i );
1964
1965 if ( name.indexOf( ':' ) >= 0 )
1966 {
1967
1968 }
1969 else
1970 {
1971 checkUnknownAttribute( parser, name, tagName, strict );
1972 }
1973 }
1974 java.util.Set parsed = new java.util.HashSet();
1975 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1976 {
1977 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1978 {
1979 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1980 extension.setLocation( "groupId", _location );
1981 extension.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
1982 }
1983 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
1984 {
1985 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1986 extension.setLocation( "artifactId", _location );
1987 extension.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
1988 }
1989 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1990 {
1991 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1992 extension.setLocation( "version", _location );
1993 extension.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
1994 }
1995 else
1996 {
1997 checkUnknownElement( parser, strict );
1998 }
1999 }
2000 return extension;
2001 }
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014 private FileSet parseFileSet( XmlPullParser parser, boolean strict, InputSource source )
2015 throws IOException, XmlPullParserException
2016 {
2017 String tagName = parser.getName();
2018 FileSet fileSet = new FileSet();
2019 InputLocation _location;
2020 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2021 fileSet.setLocation( "", _location );
2022 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2023 {
2024 String name = parser.getAttributeName( i );
2025 String value = parser.getAttributeValue( i );
2026
2027 if ( name.indexOf( ':' ) >= 0 )
2028 {
2029
2030 }
2031 else
2032 {
2033 checkUnknownAttribute( parser, name, tagName, strict );
2034 }
2035 }
2036 java.util.Set parsed = new java.util.HashSet();
2037 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2038 {
2039 if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
2040 {
2041 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2042 fileSet.setLocation( "directory", _location );
2043 fileSet.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
2044 }
2045 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
2046 {
2047 java.util.List<String> includes = new java.util.ArrayList<String>();
2048 fileSet.setIncludes( includes );
2049 InputLocation _locations;
2050 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2051 fileSet.setLocation( "includes", _locations );
2052 while ( parser.nextTag() == XmlPullParser.START_TAG )
2053 {
2054 if ( "include".equals( parser.getName() ) )
2055 {
2056 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2057 _locations.setLocation( Integer.valueOf( includes.size() ), _location );
2058 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
2059 }
2060 else
2061 {
2062 checkUnknownElement( parser, strict );
2063 }
2064 }
2065 }
2066 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
2067 {
2068 java.util.List<String> excludes = new java.util.ArrayList<String>();
2069 fileSet.setExcludes( excludes );
2070 InputLocation _locations;
2071 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2072 fileSet.setLocation( "excludes", _locations );
2073 while ( parser.nextTag() == XmlPullParser.START_TAG )
2074 {
2075 if ( "exclude".equals( parser.getName() ) )
2076 {
2077 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2078 _locations.setLocation( Integer.valueOf( excludes.size() ), _location );
2079 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
2080 }
2081 else
2082 {
2083 checkUnknownElement( parser, strict );
2084 }
2085 }
2086 }
2087 else
2088 {
2089 checkUnknownElement( parser, strict );
2090 }
2091 }
2092 return fileSet;
2093 }
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106 private IssueManagement parseIssueManagement( XmlPullParser parser, boolean strict, InputSource source )
2107 throws IOException, XmlPullParserException
2108 {
2109 String tagName = parser.getName();
2110 IssueManagement issueManagement = new IssueManagement();
2111 InputLocation _location;
2112 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2113 issueManagement.setLocation( "", _location );
2114 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2115 {
2116 String name = parser.getAttributeName( i );
2117 String value = parser.getAttributeValue( i );
2118
2119 if ( name.indexOf( ':' ) >= 0 )
2120 {
2121
2122 }
2123 else
2124 {
2125 checkUnknownAttribute( parser, name, tagName, strict );
2126 }
2127 }
2128 java.util.Set parsed = new java.util.HashSet();
2129 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2130 {
2131 if ( checkFieldWithDuplicate( parser, "system", null, parsed ) )
2132 {
2133 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2134 issueManagement.setLocation( "system", _location );
2135 issueManagement.setSystem( interpolatedTrimmed( parser.nextText(), "system" ) );
2136 }
2137 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2138 {
2139 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2140 issueManagement.setLocation( "url", _location );
2141 issueManagement.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
2142 }
2143 else
2144 {
2145 checkUnknownElement( parser, strict );
2146 }
2147 }
2148 return issueManagement;
2149 }
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162 private License parseLicense( XmlPullParser parser, boolean strict, InputSource source )
2163 throws IOException, XmlPullParserException
2164 {
2165 String tagName = parser.getName();
2166 License license = new License();
2167 InputLocation _location;
2168 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2169 license.setLocation( "", _location );
2170 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2171 {
2172 String name = parser.getAttributeName( i );
2173 String value = parser.getAttributeValue( i );
2174
2175 if ( name.indexOf( ':' ) >= 0 )
2176 {
2177
2178 }
2179 else
2180 {
2181 checkUnknownAttribute( parser, name, tagName, strict );
2182 }
2183 }
2184 java.util.Set parsed = new java.util.HashSet();
2185 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2186 {
2187 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2188 {
2189 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2190 license.setLocation( "name", _location );
2191 license.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
2192 }
2193 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2194 {
2195 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2196 license.setLocation( "url", _location );
2197 license.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
2198 }
2199 else if ( checkFieldWithDuplicate( parser, "distribution", null, parsed ) )
2200 {
2201 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2202 license.setLocation( "distribution", _location );
2203 license.setDistribution( interpolatedTrimmed( parser.nextText(), "distribution" ) );
2204 }
2205 else if ( checkFieldWithDuplicate( parser, "comments", null, parsed ) )
2206 {
2207 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2208 license.setLocation( "comments", _location );
2209 license.setComments( interpolatedTrimmed( parser.nextText(), "comments" ) );
2210 }
2211 else
2212 {
2213 checkUnknownElement( parser, strict );
2214 }
2215 }
2216 return license;
2217 }
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230 private MailingList parseMailingList( XmlPullParser parser, boolean strict, InputSource source )
2231 throws IOException, XmlPullParserException
2232 {
2233 String tagName = parser.getName();
2234 MailingList mailingList = new MailingList();
2235 InputLocation _location;
2236 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2237 mailingList.setLocation( "", _location );
2238 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2239 {
2240 String name = parser.getAttributeName( i );
2241 String value = parser.getAttributeValue( i );
2242
2243 if ( name.indexOf( ':' ) >= 0 )
2244 {
2245
2246 }
2247 else
2248 {
2249 checkUnknownAttribute( parser, name, tagName, strict );
2250 }
2251 }
2252 java.util.Set parsed = new java.util.HashSet();
2253 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2254 {
2255 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2256 {
2257 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2258 mailingList.setLocation( "name", _location );
2259 mailingList.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
2260 }
2261 else if ( checkFieldWithDuplicate( parser, "subscribe", null, parsed ) )
2262 {
2263 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2264 mailingList.setLocation( "subscribe", _location );
2265 mailingList.setSubscribe( interpolatedTrimmed( parser.nextText(), "subscribe" ) );
2266 }
2267 else if ( checkFieldWithDuplicate( parser, "unsubscribe", null, parsed ) )
2268 {
2269 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2270 mailingList.setLocation( "unsubscribe", _location );
2271 mailingList.setUnsubscribe( interpolatedTrimmed( parser.nextText(), "unsubscribe" ) );
2272 }
2273 else if ( checkFieldWithDuplicate( parser, "post", null, parsed ) )
2274 {
2275 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2276 mailingList.setLocation( "post", _location );
2277 mailingList.setPost( interpolatedTrimmed( parser.nextText(), "post" ) );
2278 }
2279 else if ( checkFieldWithDuplicate( parser, "archive", null, parsed ) )
2280 {
2281 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2282 mailingList.setLocation( "archive", _location );
2283 mailingList.setArchive( interpolatedTrimmed( parser.nextText(), "archive" ) );
2284 }
2285 else if ( checkFieldWithDuplicate( parser, "otherArchives", null, parsed ) )
2286 {
2287 java.util.List<String> otherArchives = new java.util.ArrayList<String>();
2288 mailingList.setOtherArchives( otherArchives );
2289 InputLocation _locations;
2290 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2291 mailingList.setLocation( "otherArchives", _locations );
2292 while ( parser.nextTag() == XmlPullParser.START_TAG )
2293 {
2294 if ( "otherArchive".equals( parser.getName() ) )
2295 {
2296 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2297 _locations.setLocation( Integer.valueOf( otherArchives.size() ), _location );
2298 otherArchives.add( interpolatedTrimmed( parser.nextText(), "otherArchives" ) );
2299 }
2300 else
2301 {
2302 checkUnknownElement( parser, strict );
2303 }
2304 }
2305 }
2306 else
2307 {
2308 checkUnknownElement( parser, strict );
2309 }
2310 }
2311 return mailingList;
2312 }
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325 private Model parseModel( XmlPullParser parser, boolean strict, InputSource source )
2326 throws IOException, XmlPullParserException
2327 {
2328 String tagName = parser.getName();
2329 Model model = new Model();
2330 InputLocation _location;
2331 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2332 model.setLocation( "", _location );
2333 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2334 {
2335 String name = parser.getAttributeName( i );
2336 String value = parser.getAttributeValue( i );
2337
2338 if ( name.indexOf( ':' ) >= 0 )
2339 {
2340
2341 }
2342 else if ( "xmlns".equals( name ) )
2343 {
2344
2345 }
2346 else if ( "child.project.url.inherit.append.path".equals( name ) )
2347 {
2348 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2349 model.setLocation( "childProjectUrlInheritAppendPath", _location );
2350 model.setChildProjectUrlInheritAppendPath( interpolatedTrimmed( value, "child.project.url.inherit.append.path" ) );
2351 }
2352 else
2353 {
2354 checkUnknownAttribute( parser, name, tagName, strict );
2355 }
2356 }
2357 java.util.Set parsed = new java.util.HashSet();
2358 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2359 {
2360 if ( checkFieldWithDuplicate( parser, "modelVersion", null, parsed ) )
2361 {
2362 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2363 model.setLocation( "modelVersion", _location );
2364 model.setModelVersion( interpolatedTrimmed( parser.nextText(), "modelVersion" ) );
2365 }
2366 else if ( checkFieldWithDuplicate( parser, "parent", null, parsed ) )
2367 {
2368 model.setParent( parseParent( parser, strict, source ) );
2369 }
2370 else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2371 {
2372 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2373 model.setLocation( "groupId", _location );
2374 model.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
2375 }
2376 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2377 {
2378 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2379 model.setLocation( "artifactId", _location );
2380 model.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
2381 }
2382 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2383 {
2384 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2385 model.setLocation( "version", _location );
2386 model.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
2387 }
2388 else if ( checkFieldWithDuplicate( parser, "packaging", null, parsed ) )
2389 {
2390 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2391 model.setLocation( "packaging", _location );
2392 model.setPackaging( interpolatedTrimmed( parser.nextText(), "packaging" ) );
2393 }
2394 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2395 {
2396 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2397 model.setLocation( "name", _location );
2398 model.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
2399 }
2400 else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) )
2401 {
2402 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2403 model.setLocation( "description", _location );
2404 model.setDescription( interpolatedTrimmed( parser.nextText(), "description" ) );
2405 }
2406 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2407 {
2408 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2409 model.setLocation( "url", _location );
2410 model.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
2411 }
2412 else if ( checkFieldWithDuplicate( parser, "inceptionYear", null, parsed ) )
2413 {
2414 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2415 model.setLocation( "inceptionYear", _location );
2416 model.setInceptionYear( interpolatedTrimmed( parser.nextText(), "inceptionYear" ) );
2417 }
2418 else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
2419 {
2420 model.setOrganization( parseOrganization( parser, strict, source ) );
2421 }
2422 else if ( checkFieldWithDuplicate( parser, "licenses", null, parsed ) )
2423 {
2424 java.util.List<License> licenses = new java.util.ArrayList<License>();
2425 model.setLicenses( licenses );
2426 while ( parser.nextTag() == XmlPullParser.START_TAG )
2427 {
2428 if ( "license".equals( parser.getName() ) )
2429 {
2430 licenses.add( parseLicense( parser, strict, source ) );
2431 }
2432 else
2433 {
2434 checkUnknownElement( parser, strict );
2435 }
2436 }
2437 }
2438 else if ( checkFieldWithDuplicate( parser, "developers", null, parsed ) )
2439 {
2440 java.util.List<Developer> developers = new java.util.ArrayList<Developer>();
2441 model.setDevelopers( developers );
2442 while ( parser.nextTag() == XmlPullParser.START_TAG )
2443 {
2444 if ( "developer".equals( parser.getName() ) )
2445 {
2446 developers.add( parseDeveloper( parser, strict, source ) );
2447 }
2448 else
2449 {
2450 checkUnknownElement( parser, strict );
2451 }
2452 }
2453 }
2454 else if ( checkFieldWithDuplicate( parser, "contributors", null, parsed ) )
2455 {
2456 java.util.List<Contributor> contributors = new java.util.ArrayList<Contributor>();
2457 model.setContributors( contributors );
2458 while ( parser.nextTag() == XmlPullParser.START_TAG )
2459 {
2460 if ( "contributor".equals( parser.getName() ) )
2461 {
2462 contributors.add( parseContributor( parser, strict, source ) );
2463 }
2464 else
2465 {
2466 checkUnknownElement( parser, strict );
2467 }
2468 }
2469 }
2470 else if ( checkFieldWithDuplicate( parser, "mailingLists", null, parsed ) )
2471 {
2472 java.util.List<MailingList> mailingLists = new java.util.ArrayList<MailingList>();
2473 model.setMailingLists( mailingLists );
2474 while ( parser.nextTag() == XmlPullParser.START_TAG )
2475 {
2476 if ( "mailingList".equals( parser.getName() ) )
2477 {
2478 mailingLists.add( parseMailingList( parser, strict, source ) );
2479 }
2480 else
2481 {
2482 checkUnknownElement( parser, strict );
2483 }
2484 }
2485 }
2486 else if ( checkFieldWithDuplicate( parser, "prerequisites", null, parsed ) )
2487 {
2488 model.setPrerequisites( parsePrerequisites( parser, strict, source ) );
2489 }
2490 else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
2491 {
2492 java.util.List<String> modules = new java.util.ArrayList<String>();
2493 model.setModules( modules );
2494 InputLocation _locations;
2495 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2496 model.setLocation( "modules", _locations );
2497 while ( parser.nextTag() == XmlPullParser.START_TAG )
2498 {
2499 if ( "module".equals( parser.getName() ) )
2500 {
2501 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2502 _locations.setLocation( Integer.valueOf( modules.size() ), _location );
2503 modules.add( interpolatedTrimmed( parser.nextText(), "modules" ) );
2504 }
2505 else
2506 {
2507 checkUnknownElement( parser, strict );
2508 }
2509 }
2510 }
2511 else if ( checkFieldWithDuplicate( parser, "scm", null, parsed ) )
2512 {
2513 model.setScm( parseScm( parser, strict, source ) );
2514 }
2515 else if ( checkFieldWithDuplicate( parser, "issueManagement", null, parsed ) )
2516 {
2517 model.setIssueManagement( parseIssueManagement( parser, strict, source ) );
2518 }
2519 else if ( checkFieldWithDuplicate( parser, "ciManagement", null, parsed ) )
2520 {
2521 model.setCiManagement( parseCiManagement( parser, strict, source ) );
2522 }
2523 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
2524 {
2525 model.setDistributionManagement( parseDistributionManagement( parser, strict, source ) );
2526 }
2527 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
2528 {
2529 InputLocation _locations;
2530 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2531 model.setLocation( "properties", _locations );
2532 while ( parser.nextTag() == XmlPullParser.START_TAG )
2533 {
2534 String key = parser.getName();
2535 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2536 _locations.setLocation( key, _location );
2537 String value = parser.nextText().trim();
2538 model.addProperty( key, value );
2539 }
2540 }
2541 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
2542 {
2543 model.setDependencyManagement( parseDependencyManagement( parser, strict, source ) );
2544 }
2545 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2546 {
2547 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
2548 model.setDependencies( dependencies );
2549 while ( parser.nextTag() == XmlPullParser.START_TAG )
2550 {
2551 if ( "dependency".equals( parser.getName() ) )
2552 {
2553 dependencies.add( parseDependency( parser, strict, source ) );
2554 }
2555 else
2556 {
2557 checkUnknownElement( parser, strict );
2558 }
2559 }
2560 }
2561 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
2562 {
2563 java.util.List<Repository> repositories = new java.util.ArrayList<Repository>();
2564 model.setRepositories( repositories );
2565 while ( parser.nextTag() == XmlPullParser.START_TAG )
2566 {
2567 if ( "repository".equals( parser.getName() ) )
2568 {
2569 repositories.add( parseRepository( parser, strict, source ) );
2570 }
2571 else
2572 {
2573 checkUnknownElement( parser, strict );
2574 }
2575 }
2576 }
2577 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
2578 {
2579 java.util.List<Repository> pluginRepositories = new java.util.ArrayList<Repository>();
2580 model.setPluginRepositories( pluginRepositories );
2581 while ( parser.nextTag() == XmlPullParser.START_TAG )
2582 {
2583 if ( "pluginRepository".equals( parser.getName() ) )
2584 {
2585 pluginRepositories.add( parseRepository( parser, strict, source ) );
2586 }
2587 else
2588 {
2589 checkUnknownElement( parser, strict );
2590 }
2591 }
2592 }
2593 else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
2594 {
2595 model.setBuild( parseBuild( parser, strict, source ) );
2596 }
2597 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
2598 {
2599 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2600 model.setLocation( "reports", _location );
2601 model.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
2602 }
2603 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
2604 {
2605 model.setReporting( parseReporting( parser, strict, source ) );
2606 }
2607 else if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) )
2608 {
2609 java.util.List<Profile> profiles = new java.util.ArrayList<Profile>();
2610 model.setProfiles( profiles );
2611 while ( parser.nextTag() == XmlPullParser.START_TAG )
2612 {
2613 if ( "profile".equals( parser.getName() ) )
2614 {
2615 profiles.add( parseProfile( parser, strict, source ) );
2616 }
2617 else
2618 {
2619 checkUnknownElement( parser, strict );
2620 }
2621 }
2622 }
2623 else
2624 {
2625 checkUnknownElement( parser, strict );
2626 }
2627 }
2628 return model;
2629 }
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642 private ModelBase parseModelBase( XmlPullParser parser, boolean strict, InputSource source )
2643 throws IOException, XmlPullParserException
2644 {
2645 String tagName = parser.getName();
2646 ModelBase modelBase = new ModelBase();
2647 InputLocation _location;
2648 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2649 modelBase.setLocation( "", _location );
2650 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2651 {
2652 String name = parser.getAttributeName( i );
2653 String value = parser.getAttributeValue( i );
2654
2655 if ( name.indexOf( ':' ) >= 0 )
2656 {
2657
2658 }
2659 else
2660 {
2661 checkUnknownAttribute( parser, name, tagName, strict );
2662 }
2663 }
2664 java.util.Set parsed = new java.util.HashSet();
2665 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2666 {
2667 if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
2668 {
2669 java.util.List<String> modules = new java.util.ArrayList<String>();
2670 modelBase.setModules( modules );
2671 InputLocation _locations;
2672 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2673 modelBase.setLocation( "modules", _locations );
2674 while ( parser.nextTag() == XmlPullParser.START_TAG )
2675 {
2676 if ( "module".equals( parser.getName() ) )
2677 {
2678 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2679 _locations.setLocation( Integer.valueOf( modules.size() ), _location );
2680 modules.add( interpolatedTrimmed( parser.nextText(), "modules" ) );
2681 }
2682 else
2683 {
2684 checkUnknownElement( parser, strict );
2685 }
2686 }
2687 }
2688 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
2689 {
2690 modelBase.setDistributionManagement( parseDistributionManagement( parser, strict, source ) );
2691 }
2692 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
2693 {
2694 InputLocation _locations;
2695 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2696 modelBase.setLocation( "properties", _locations );
2697 while ( parser.nextTag() == XmlPullParser.START_TAG )
2698 {
2699 String key = parser.getName();
2700 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2701 _locations.setLocation( key, _location );
2702 String value = parser.nextText().trim();
2703 modelBase.addProperty( key, value );
2704 }
2705 }
2706 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
2707 {
2708 modelBase.setDependencyManagement( parseDependencyManagement( parser, strict, source ) );
2709 }
2710 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2711 {
2712 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
2713 modelBase.setDependencies( dependencies );
2714 while ( parser.nextTag() == XmlPullParser.START_TAG )
2715 {
2716 if ( "dependency".equals( parser.getName() ) )
2717 {
2718 dependencies.add( parseDependency( parser, strict, source ) );
2719 }
2720 else
2721 {
2722 checkUnknownElement( parser, strict );
2723 }
2724 }
2725 }
2726 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
2727 {
2728 java.util.List<Repository> repositories = new java.util.ArrayList<Repository>();
2729 modelBase.setRepositories( repositories );
2730 while ( parser.nextTag() == XmlPullParser.START_TAG )
2731 {
2732 if ( "repository".equals( parser.getName() ) )
2733 {
2734 repositories.add( parseRepository( parser, strict, source ) );
2735 }
2736 else
2737 {
2738 checkUnknownElement( parser, strict );
2739 }
2740 }
2741 }
2742 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
2743 {
2744 java.util.List<Repository> pluginRepositories = new java.util.ArrayList<Repository>();
2745 modelBase.setPluginRepositories( pluginRepositories );
2746 while ( parser.nextTag() == XmlPullParser.START_TAG )
2747 {
2748 if ( "pluginRepository".equals( parser.getName() ) )
2749 {
2750 pluginRepositories.add( parseRepository( parser, strict, source ) );
2751 }
2752 else
2753 {
2754 checkUnknownElement( parser, strict );
2755 }
2756 }
2757 }
2758 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
2759 {
2760 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2761 modelBase.setLocation( "reports", _location );
2762 modelBase.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
2763 }
2764 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
2765 {
2766 modelBase.setReporting( parseReporting( parser, strict, source ) );
2767 }
2768 else
2769 {
2770 checkUnknownElement( parser, strict );
2771 }
2772 }
2773 return modelBase;
2774 }
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787 private Notifier parseNotifier( XmlPullParser parser, boolean strict, InputSource source )
2788 throws IOException, XmlPullParserException
2789 {
2790 String tagName = parser.getName();
2791 Notifier notifier = new Notifier();
2792 InputLocation _location;
2793 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2794 notifier.setLocation( "", _location );
2795 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2796 {
2797 String name = parser.getAttributeName( i );
2798 String value = parser.getAttributeValue( i );
2799
2800 if ( name.indexOf( ':' ) >= 0 )
2801 {
2802
2803 }
2804 else
2805 {
2806 checkUnknownAttribute( parser, name, tagName, strict );
2807 }
2808 }
2809 java.util.Set parsed = new java.util.HashSet();
2810 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2811 {
2812 if ( checkFieldWithDuplicate( parser, "type", null, parsed ) )
2813 {
2814 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2815 notifier.setLocation( "type", _location );
2816 notifier.setType( interpolatedTrimmed( parser.nextText(), "type" ) );
2817 }
2818 else if ( checkFieldWithDuplicate( parser, "sendOnError", null, parsed ) )
2819 {
2820 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2821 notifier.setLocation( "sendOnError", _location );
2822 notifier.setSendOnError( getBooleanValue( interpolatedTrimmed( parser.nextText(), "sendOnError" ), "sendOnError", parser, "true" ) );
2823 }
2824 else if ( checkFieldWithDuplicate( parser, "sendOnFailure", null, parsed ) )
2825 {
2826 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2827 notifier.setLocation( "sendOnFailure", _location );
2828 notifier.setSendOnFailure( getBooleanValue( interpolatedTrimmed( parser.nextText(), "sendOnFailure" ), "sendOnFailure", parser, "true" ) );
2829 }
2830 else if ( checkFieldWithDuplicate( parser, "sendOnSuccess", null, parsed ) )
2831 {
2832 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2833 notifier.setLocation( "sendOnSuccess", _location );
2834 notifier.setSendOnSuccess( getBooleanValue( interpolatedTrimmed( parser.nextText(), "sendOnSuccess" ), "sendOnSuccess", parser, "true" ) );
2835 }
2836 else if ( checkFieldWithDuplicate( parser, "sendOnWarning", null, parsed ) )
2837 {
2838 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2839 notifier.setLocation( "sendOnWarning", _location );
2840 notifier.setSendOnWarning( getBooleanValue( interpolatedTrimmed( parser.nextText(), "sendOnWarning" ), "sendOnWarning", parser, "true" ) );
2841 }
2842 else if ( checkFieldWithDuplicate( parser, "address", null, parsed ) )
2843 {
2844 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2845 notifier.setLocation( "address", _location );
2846 notifier.setAddress( interpolatedTrimmed( parser.nextText(), "address" ) );
2847 }
2848 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
2849 {
2850 InputLocation _locations;
2851 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2852 notifier.setLocation( "configuration", _locations );
2853 while ( parser.nextTag() == XmlPullParser.START_TAG )
2854 {
2855 String key = parser.getName();
2856 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2857 _locations.setLocation( key, _location );
2858 String value = parser.nextText().trim();
2859 notifier.addConfiguration( key, value );
2860 }
2861 }
2862 else
2863 {
2864 checkUnknownElement( parser, strict );
2865 }
2866 }
2867 return notifier;
2868 }
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881 private Organization parseOrganization( XmlPullParser parser, boolean strict, InputSource source )
2882 throws IOException, XmlPullParserException
2883 {
2884 String tagName = parser.getName();
2885 Organization organization = new Organization();
2886 InputLocation _location;
2887 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2888 organization.setLocation( "", _location );
2889 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2890 {
2891 String name = parser.getAttributeName( i );
2892 String value = parser.getAttributeValue( i );
2893
2894 if ( name.indexOf( ':' ) >= 0 )
2895 {
2896
2897 }
2898 else
2899 {
2900 checkUnknownAttribute( parser, name, tagName, strict );
2901 }
2902 }
2903 java.util.Set parsed = new java.util.HashSet();
2904 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2905 {
2906 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2907 {
2908 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2909 organization.setLocation( "name", _location );
2910 organization.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
2911 }
2912 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2913 {
2914 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2915 organization.setLocation( "url", _location );
2916 organization.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
2917 }
2918 else
2919 {
2920 checkUnknownElement( parser, strict );
2921 }
2922 }
2923 return organization;
2924 }
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937 private Parent parseParent( XmlPullParser parser, boolean strict, InputSource source )
2938 throws IOException, XmlPullParserException
2939 {
2940 String tagName = parser.getName();
2941 Parent parent = new Parent();
2942 InputLocation _location;
2943 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2944 parent.setLocation( "", _location );
2945 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2946 {
2947 String name = parser.getAttributeName( i );
2948 String value = parser.getAttributeValue( i );
2949
2950 if ( name.indexOf( ':' ) >= 0 )
2951 {
2952
2953 }
2954 else
2955 {
2956 checkUnknownAttribute( parser, name, tagName, strict );
2957 }
2958 }
2959 java.util.Set parsed = new java.util.HashSet();
2960 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2961 {
2962 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2963 {
2964 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2965 parent.setLocation( "groupId", _location );
2966 parent.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
2967 }
2968 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2969 {
2970 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2971 parent.setLocation( "artifactId", _location );
2972 parent.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
2973 }
2974 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2975 {
2976 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2977 parent.setLocation( "version", _location );
2978 parent.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
2979 }
2980 else if ( checkFieldWithDuplicate( parser, "relativePath", null, parsed ) )
2981 {
2982 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2983 parent.setLocation( "relativePath", _location );
2984 parent.setRelativePath( interpolatedTrimmed( parser.nextText(), "relativePath" ) );
2985 }
2986 else
2987 {
2988 checkUnknownElement( parser, strict );
2989 }
2990 }
2991 return parent;
2992 }
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005 private PatternSet parsePatternSet( XmlPullParser parser, boolean strict, InputSource source )
3006 throws IOException, XmlPullParserException
3007 {
3008 String tagName = parser.getName();
3009 PatternSet patternSet = new PatternSet();
3010 InputLocation _location;
3011 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3012 patternSet.setLocation( "", _location );
3013 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3014 {
3015 String name = parser.getAttributeName( i );
3016 String value = parser.getAttributeValue( i );
3017
3018 if ( name.indexOf( ':' ) >= 0 )
3019 {
3020
3021 }
3022 else
3023 {
3024 checkUnknownAttribute( parser, name, tagName, strict );
3025 }
3026 }
3027 java.util.Set parsed = new java.util.HashSet();
3028 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3029 {
3030 if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
3031 {
3032 java.util.List<String> includes = new java.util.ArrayList<String>();
3033 patternSet.setIncludes( includes );
3034 InputLocation _locations;
3035 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3036 patternSet.setLocation( "includes", _locations );
3037 while ( parser.nextTag() == XmlPullParser.START_TAG )
3038 {
3039 if ( "include".equals( parser.getName() ) )
3040 {
3041 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3042 _locations.setLocation( Integer.valueOf( includes.size() ), _location );
3043 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
3044 }
3045 else
3046 {
3047 checkUnknownElement( parser, strict );
3048 }
3049 }
3050 }
3051 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
3052 {
3053 java.util.List<String> excludes = new java.util.ArrayList<String>();
3054 patternSet.setExcludes( excludes );
3055 InputLocation _locations;
3056 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3057 patternSet.setLocation( "excludes", _locations );
3058 while ( parser.nextTag() == XmlPullParser.START_TAG )
3059 {
3060 if ( "exclude".equals( parser.getName() ) )
3061 {
3062 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3063 _locations.setLocation( Integer.valueOf( excludes.size() ), _location );
3064 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
3065 }
3066 else
3067 {
3068 checkUnknownElement( parser, strict );
3069 }
3070 }
3071 }
3072 else
3073 {
3074 checkUnknownElement( parser, strict );
3075 }
3076 }
3077 return patternSet;
3078 }
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091 private Plugin parsePlugin( XmlPullParser parser, boolean strict, InputSource source )
3092 throws IOException, XmlPullParserException
3093 {
3094 String tagName = parser.getName();
3095 Plugin plugin = new Plugin();
3096 InputLocation _location;
3097 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3098 plugin.setLocation( "", _location );
3099 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3100 {
3101 String name = parser.getAttributeName( i );
3102 String value = parser.getAttributeValue( i );
3103
3104 if ( name.indexOf( ':' ) >= 0 )
3105 {
3106
3107 }
3108 else
3109 {
3110 checkUnknownAttribute( parser, name, tagName, strict );
3111 }
3112 }
3113 java.util.Set parsed = new java.util.HashSet();
3114 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3115 {
3116 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3117 {
3118 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3119 plugin.setLocation( "groupId", _location );
3120 plugin.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
3121 }
3122 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3123 {
3124 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3125 plugin.setLocation( "artifactId", _location );
3126 plugin.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
3127 }
3128 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3129 {
3130 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3131 plugin.setLocation( "version", _location );
3132 plugin.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
3133 }
3134 else if ( checkFieldWithDuplicate( parser, "extensions", null, parsed ) )
3135 {
3136 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3137 plugin.setLocation( "extensions", _location );
3138 plugin.setExtensions( interpolatedTrimmed( parser.nextText(), "extensions" ) );
3139 }
3140 else if ( checkFieldWithDuplicate( parser, "executions", null, parsed ) )
3141 {
3142 java.util.List<PluginExecution> executions = new java.util.ArrayList<PluginExecution>();
3143 plugin.setExecutions( executions );
3144 while ( parser.nextTag() == XmlPullParser.START_TAG )
3145 {
3146 if ( "execution".equals( parser.getName() ) )
3147 {
3148 executions.add( parsePluginExecution( parser, strict, source ) );
3149 }
3150 else
3151 {
3152 checkUnknownElement( parser, strict );
3153 }
3154 }
3155 }
3156 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
3157 {
3158 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
3159 plugin.setDependencies( dependencies );
3160 while ( parser.nextTag() == XmlPullParser.START_TAG )
3161 {
3162 if ( "dependency".equals( parser.getName() ) )
3163 {
3164 dependencies.add( parseDependency( parser, strict, source ) );
3165 }
3166 else
3167 {
3168 checkUnknownElement( parser, strict );
3169 }
3170 }
3171 }
3172 else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
3173 {
3174 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3175 plugin.setLocation( "goals", _location );
3176 plugin.setGoals( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
3177 }
3178 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3179 {
3180 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3181 plugin.setLocation( "inherited", _location );
3182 plugin.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
3183 }
3184 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3185 {
3186 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3187 plugin.setLocation( "configuration", _location );
3188 plugin.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
3189 }
3190 else
3191 {
3192 checkUnknownElement( parser, strict );
3193 }
3194 }
3195 return plugin;
3196 }
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209 private PluginConfiguration parsePluginConfiguration( XmlPullParser parser, boolean strict, InputSource source )
3210 throws IOException, XmlPullParserException
3211 {
3212 String tagName = parser.getName();
3213 PluginConfiguration pluginConfiguration = new PluginConfiguration();
3214 InputLocation _location;
3215 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3216 pluginConfiguration.setLocation( "", _location );
3217 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3218 {
3219 String name = parser.getAttributeName( i );
3220 String value = parser.getAttributeValue( i );
3221
3222 if ( name.indexOf( ':' ) >= 0 )
3223 {
3224
3225 }
3226 else
3227 {
3228 checkUnknownAttribute( parser, name, tagName, strict );
3229 }
3230 }
3231 java.util.Set parsed = new java.util.HashSet();
3232 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3233 {
3234 if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
3235 {
3236 pluginConfiguration.setPluginManagement( parsePluginManagement( parser, strict, source ) );
3237 }
3238 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3239 {
3240 java.util.List<Plugin> plugins = new java.util.ArrayList<Plugin>();
3241 pluginConfiguration.setPlugins( plugins );
3242 while ( parser.nextTag() == XmlPullParser.START_TAG )
3243 {
3244 if ( "plugin".equals( parser.getName() ) )
3245 {
3246 plugins.add( parsePlugin( parser, strict, source ) );
3247 }
3248 else
3249 {
3250 checkUnknownElement( parser, strict );
3251 }
3252 }
3253 }
3254 else
3255 {
3256 checkUnknownElement( parser, strict );
3257 }
3258 }
3259 return pluginConfiguration;
3260 }
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273 private PluginContainer parsePluginContainer( XmlPullParser parser, boolean strict, InputSource source )
3274 throws IOException, XmlPullParserException
3275 {
3276 String tagName = parser.getName();
3277 PluginContainer pluginContainer = new PluginContainer();
3278 InputLocation _location;
3279 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3280 pluginContainer.setLocation( "", _location );
3281 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3282 {
3283 String name = parser.getAttributeName( i );
3284 String value = parser.getAttributeValue( i );
3285
3286 if ( name.indexOf( ':' ) >= 0 )
3287 {
3288
3289 }
3290 else
3291 {
3292 checkUnknownAttribute( parser, name, tagName, strict );
3293 }
3294 }
3295 java.util.Set parsed = new java.util.HashSet();
3296 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3297 {
3298 if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3299 {
3300 java.util.List<Plugin> plugins = new java.util.ArrayList<Plugin>();
3301 pluginContainer.setPlugins( plugins );
3302 while ( parser.nextTag() == XmlPullParser.START_TAG )
3303 {
3304 if ( "plugin".equals( parser.getName() ) )
3305 {
3306 plugins.add( parsePlugin( parser, strict, source ) );
3307 }
3308 else
3309 {
3310 checkUnknownElement( parser, strict );
3311 }
3312 }
3313 }
3314 else
3315 {
3316 checkUnknownElement( parser, strict );
3317 }
3318 }
3319 return pluginContainer;
3320 }
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333 private PluginExecution parsePluginExecution( XmlPullParser parser, boolean strict, InputSource source )
3334 throws IOException, XmlPullParserException
3335 {
3336 String tagName = parser.getName();
3337 PluginExecution pluginExecution = new PluginExecution();
3338 InputLocation _location;
3339 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3340 pluginExecution.setLocation( "", _location );
3341 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3342 {
3343 String name = parser.getAttributeName( i );
3344 String value = parser.getAttributeValue( i );
3345
3346 if ( name.indexOf( ':' ) >= 0 )
3347 {
3348
3349 }
3350 else
3351 {
3352 checkUnknownAttribute( parser, name, tagName, strict );
3353 }
3354 }
3355 java.util.Set parsed = new java.util.HashSet();
3356 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3357 {
3358 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3359 {
3360 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3361 pluginExecution.setLocation( "id", _location );
3362 pluginExecution.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
3363 }
3364 else if ( checkFieldWithDuplicate( parser, "phase", null, parsed ) )
3365 {
3366 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3367 pluginExecution.setLocation( "phase", _location );
3368 pluginExecution.setPhase( interpolatedTrimmed( parser.nextText(), "phase" ) );
3369 }
3370 else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
3371 {
3372 java.util.List<String> goals = new java.util.ArrayList<String>();
3373 pluginExecution.setGoals( goals );
3374 InputLocation _locations;
3375 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3376 pluginExecution.setLocation( "goals", _locations );
3377 while ( parser.nextTag() == XmlPullParser.START_TAG )
3378 {
3379 if ( "goal".equals( parser.getName() ) )
3380 {
3381 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3382 _locations.setLocation( Integer.valueOf( goals.size() ), _location );
3383 goals.add( interpolatedTrimmed( parser.nextText(), "goals" ) );
3384 }
3385 else
3386 {
3387 checkUnknownElement( parser, strict );
3388 }
3389 }
3390 }
3391 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3392 {
3393 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3394 pluginExecution.setLocation( "inherited", _location );
3395 pluginExecution.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
3396 }
3397 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3398 {
3399 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3400 pluginExecution.setLocation( "configuration", _location );
3401 pluginExecution.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
3402 }
3403 else
3404 {
3405 checkUnknownElement( parser, strict );
3406 }
3407 }
3408 return pluginExecution;
3409 }
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422 private PluginManagement parsePluginManagement( XmlPullParser parser, boolean strict, InputSource source )
3423 throws IOException, XmlPullParserException
3424 {
3425 String tagName = parser.getName();
3426 PluginManagement pluginManagement = new PluginManagement();
3427 InputLocation _location;
3428 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3429 pluginManagement.setLocation( "", _location );
3430 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3431 {
3432 String name = parser.getAttributeName( i );
3433 String value = parser.getAttributeValue( i );
3434
3435 if ( name.indexOf( ':' ) >= 0 )
3436 {
3437
3438 }
3439 else
3440 {
3441 checkUnknownAttribute( parser, name, tagName, strict );
3442 }
3443 }
3444 java.util.Set parsed = new java.util.HashSet();
3445 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3446 {
3447 if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3448 {
3449 java.util.List<Plugin> plugins = new java.util.ArrayList<Plugin>();
3450 pluginManagement.setPlugins( plugins );
3451 while ( parser.nextTag() == XmlPullParser.START_TAG )
3452 {
3453 if ( "plugin".equals( parser.getName() ) )
3454 {
3455 plugins.add( parsePlugin( parser, strict, source ) );
3456 }
3457 else
3458 {
3459 checkUnknownElement( parser, strict );
3460 }
3461 }
3462 }
3463 else
3464 {
3465 checkUnknownElement( parser, strict );
3466 }
3467 }
3468 return pluginManagement;
3469 }
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482 private Prerequisites parsePrerequisites( XmlPullParser parser, boolean strict, InputSource source )
3483 throws IOException, XmlPullParserException
3484 {
3485 String tagName = parser.getName();
3486 Prerequisites prerequisites = new Prerequisites();
3487 InputLocation _location;
3488 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3489 prerequisites.setLocation( "", _location );
3490 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3491 {
3492 String name = parser.getAttributeName( i );
3493 String value = parser.getAttributeValue( i );
3494
3495 if ( name.indexOf( ':' ) >= 0 )
3496 {
3497
3498 }
3499 else
3500 {
3501 checkUnknownAttribute( parser, name, tagName, strict );
3502 }
3503 }
3504 java.util.Set parsed = new java.util.HashSet();
3505 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3506 {
3507 if ( checkFieldWithDuplicate( parser, "maven", null, parsed ) )
3508 {
3509 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3510 prerequisites.setLocation( "maven", _location );
3511 prerequisites.setMaven( interpolatedTrimmed( parser.nextText(), "maven" ) );
3512 }
3513 else
3514 {
3515 checkUnknownElement( parser, strict );
3516 }
3517 }
3518 return prerequisites;
3519 }
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532 private Profile parseProfile( XmlPullParser parser, boolean strict, InputSource source )
3533 throws IOException, XmlPullParserException
3534 {
3535 String tagName = parser.getName();
3536 Profile profile = new Profile();
3537 InputLocation _location;
3538 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3539 profile.setLocation( "", _location );
3540 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3541 {
3542 String name = parser.getAttributeName( i );
3543 String value = parser.getAttributeValue( i );
3544
3545 if ( name.indexOf( ':' ) >= 0 )
3546 {
3547
3548 }
3549 else
3550 {
3551 checkUnknownAttribute( parser, name, tagName, strict );
3552 }
3553 }
3554 java.util.Set parsed = new java.util.HashSet();
3555 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3556 {
3557 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3558 {
3559 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3560 profile.setLocation( "id", _location );
3561 profile.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
3562 }
3563 else if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) )
3564 {
3565 profile.setActivation( parseActivation( parser, strict, source ) );
3566 }
3567 else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
3568 {
3569 profile.setBuild( parseBuildBase( parser, strict, source ) );
3570 }
3571 else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
3572 {
3573 java.util.List<String> modules = new java.util.ArrayList<String>();
3574 profile.setModules( modules );
3575 InputLocation _locations;
3576 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3577 profile.setLocation( "modules", _locations );
3578 while ( parser.nextTag() == XmlPullParser.START_TAG )
3579 {
3580 if ( "module".equals( parser.getName() ) )
3581 {
3582 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3583 _locations.setLocation( Integer.valueOf( modules.size() ), _location );
3584 modules.add( interpolatedTrimmed( parser.nextText(), "modules" ) );
3585 }
3586 else
3587 {
3588 checkUnknownElement( parser, strict );
3589 }
3590 }
3591 }
3592 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
3593 {
3594 profile.setDistributionManagement( parseDistributionManagement( parser, strict, source ) );
3595 }
3596 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
3597 {
3598 InputLocation _locations;
3599 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3600 profile.setLocation( "properties", _locations );
3601 while ( parser.nextTag() == XmlPullParser.START_TAG )
3602 {
3603 String key = parser.getName();
3604 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3605 _locations.setLocation( key, _location );
3606 String value = parser.nextText().trim();
3607 profile.addProperty( key, value );
3608 }
3609 }
3610 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
3611 {
3612 profile.setDependencyManagement( parseDependencyManagement( parser, strict, source ) );
3613 }
3614 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
3615 {
3616 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
3617 profile.setDependencies( dependencies );
3618 while ( parser.nextTag() == XmlPullParser.START_TAG )
3619 {
3620 if ( "dependency".equals( parser.getName() ) )
3621 {
3622 dependencies.add( parseDependency( parser, strict, source ) );
3623 }
3624 else
3625 {
3626 checkUnknownElement( parser, strict );
3627 }
3628 }
3629 }
3630 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
3631 {
3632 java.util.List<Repository> repositories = new java.util.ArrayList<Repository>();
3633 profile.setRepositories( repositories );
3634 while ( parser.nextTag() == XmlPullParser.START_TAG )
3635 {
3636 if ( "repository".equals( parser.getName() ) )
3637 {
3638 repositories.add( parseRepository( parser, strict, source ) );
3639 }
3640 else
3641 {
3642 checkUnknownElement( parser, strict );
3643 }
3644 }
3645 }
3646 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
3647 {
3648 java.util.List<Repository> pluginRepositories = new java.util.ArrayList<Repository>();
3649 profile.setPluginRepositories( pluginRepositories );
3650 while ( parser.nextTag() == XmlPullParser.START_TAG )
3651 {
3652 if ( "pluginRepository".equals( parser.getName() ) )
3653 {
3654 pluginRepositories.add( parseRepository( parser, strict, source ) );
3655 }
3656 else
3657 {
3658 checkUnknownElement( parser, strict );
3659 }
3660 }
3661 }
3662 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
3663 {
3664 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3665 profile.setLocation( "reports", _location );
3666 profile.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
3667 }
3668 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
3669 {
3670 profile.setReporting( parseReporting( parser, strict, source ) );
3671 }
3672 else
3673 {
3674 checkUnknownElement( parser, strict );
3675 }
3676 }
3677 return profile;
3678 }
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691 private Relocation parseRelocation( XmlPullParser parser, boolean strict, InputSource source )
3692 throws IOException, XmlPullParserException
3693 {
3694 String tagName = parser.getName();
3695 Relocation relocation = new Relocation();
3696 InputLocation _location;
3697 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3698 relocation.setLocation( "", _location );
3699 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3700 {
3701 String name = parser.getAttributeName( i );
3702 String value = parser.getAttributeValue( i );
3703
3704 if ( name.indexOf( ':' ) >= 0 )
3705 {
3706
3707 }
3708 else
3709 {
3710 checkUnknownAttribute( parser, name, tagName, strict );
3711 }
3712 }
3713 java.util.Set parsed = new java.util.HashSet();
3714 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3715 {
3716 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3717 {
3718 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3719 relocation.setLocation( "groupId", _location );
3720 relocation.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
3721 }
3722 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3723 {
3724 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3725 relocation.setLocation( "artifactId", _location );
3726 relocation.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
3727 }
3728 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3729 {
3730 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3731 relocation.setLocation( "version", _location );
3732 relocation.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
3733 }
3734 else if ( checkFieldWithDuplicate( parser, "message", null, parsed ) )
3735 {
3736 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3737 relocation.setLocation( "message", _location );
3738 relocation.setMessage( interpolatedTrimmed( parser.nextText(), "message" ) );
3739 }
3740 else
3741 {
3742 checkUnknownElement( parser, strict );
3743 }
3744 }
3745 return relocation;
3746 }
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759 private ReportPlugin parseReportPlugin( XmlPullParser parser, boolean strict, InputSource source )
3760 throws IOException, XmlPullParserException
3761 {
3762 String tagName = parser.getName();
3763 ReportPlugin reportPlugin = new ReportPlugin();
3764 InputLocation _location;
3765 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3766 reportPlugin.setLocation( "", _location );
3767 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3768 {
3769 String name = parser.getAttributeName( i );
3770 String value = parser.getAttributeValue( i );
3771
3772 if ( name.indexOf( ':' ) >= 0 )
3773 {
3774
3775 }
3776 else
3777 {
3778 checkUnknownAttribute( parser, name, tagName, strict );
3779 }
3780 }
3781 java.util.Set parsed = new java.util.HashSet();
3782 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3783 {
3784 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3785 {
3786 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3787 reportPlugin.setLocation( "groupId", _location );
3788 reportPlugin.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
3789 }
3790 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3791 {
3792 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3793 reportPlugin.setLocation( "artifactId", _location );
3794 reportPlugin.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
3795 }
3796 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3797 {
3798 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3799 reportPlugin.setLocation( "version", _location );
3800 reportPlugin.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
3801 }
3802 else if ( checkFieldWithDuplicate( parser, "reportSets", null, parsed ) )
3803 {
3804 java.util.List<ReportSet> reportSets = new java.util.ArrayList<ReportSet>();
3805 reportPlugin.setReportSets( reportSets );
3806 while ( parser.nextTag() == XmlPullParser.START_TAG )
3807 {
3808 if ( "reportSet".equals( parser.getName() ) )
3809 {
3810 reportSets.add( parseReportSet( parser, strict, source ) );
3811 }
3812 else
3813 {
3814 checkUnknownElement( parser, strict );
3815 }
3816 }
3817 }
3818 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3819 {
3820 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3821 reportPlugin.setLocation( "inherited", _location );
3822 reportPlugin.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
3823 }
3824 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3825 {
3826 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3827 reportPlugin.setLocation( "configuration", _location );
3828 reportPlugin.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
3829 }
3830 else
3831 {
3832 checkUnknownElement( parser, strict );
3833 }
3834 }
3835 return reportPlugin;
3836 }
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849 private ReportSet parseReportSet( XmlPullParser parser, boolean strict, InputSource source )
3850 throws IOException, XmlPullParserException
3851 {
3852 String tagName = parser.getName();
3853 ReportSet reportSet = new ReportSet();
3854 InputLocation _location;
3855 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3856 reportSet.setLocation( "", _location );
3857 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3858 {
3859 String name = parser.getAttributeName( i );
3860 String value = parser.getAttributeValue( i );
3861
3862 if ( name.indexOf( ':' ) >= 0 )
3863 {
3864
3865 }
3866 else
3867 {
3868 checkUnknownAttribute( parser, name, tagName, strict );
3869 }
3870 }
3871 java.util.Set parsed = new java.util.HashSet();
3872 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3873 {
3874 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3875 {
3876 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3877 reportSet.setLocation( "id", _location );
3878 reportSet.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
3879 }
3880 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
3881 {
3882 java.util.List<String> reports = new java.util.ArrayList<String>();
3883 reportSet.setReports( reports );
3884 InputLocation _locations;
3885 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3886 reportSet.setLocation( "reports", _locations );
3887 while ( parser.nextTag() == XmlPullParser.START_TAG )
3888 {
3889 if ( "report".equals( parser.getName() ) )
3890 {
3891 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3892 _locations.setLocation( Integer.valueOf( reports.size() ), _location );
3893 reports.add( interpolatedTrimmed( parser.nextText(), "reports" ) );
3894 }
3895 else
3896 {
3897 checkUnknownElement( parser, strict );
3898 }
3899 }
3900 }
3901 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3902 {
3903 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3904 reportSet.setLocation( "inherited", _location );
3905 reportSet.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
3906 }
3907 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3908 {
3909 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3910 reportSet.setLocation( "configuration", _location );
3911 reportSet.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true, new Xpp3DomBuilderInputLocationBuilder( _location ) ) );
3912 }
3913 else
3914 {
3915 checkUnknownElement( parser, strict );
3916 }
3917 }
3918 return reportSet;
3919 }
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932 private Reporting parseReporting( XmlPullParser parser, boolean strict, InputSource source )
3933 throws IOException, XmlPullParserException
3934 {
3935 String tagName = parser.getName();
3936 Reporting reporting = new Reporting();
3937 InputLocation _location;
3938 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3939 reporting.setLocation( "", _location );
3940 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3941 {
3942 String name = parser.getAttributeName( i );
3943 String value = parser.getAttributeValue( i );
3944
3945 if ( name.indexOf( ':' ) >= 0 )
3946 {
3947
3948 }
3949 else
3950 {
3951 checkUnknownAttribute( parser, name, tagName, strict );
3952 }
3953 }
3954 java.util.Set parsed = new java.util.HashSet();
3955 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3956 {
3957 if ( checkFieldWithDuplicate( parser, "excludeDefaults", null, parsed ) )
3958 {
3959 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3960 reporting.setLocation( "excludeDefaults", _location );
3961 reporting.setExcludeDefaults( interpolatedTrimmed( parser.nextText(), "excludeDefaults" ) );
3962 }
3963 else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
3964 {
3965 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3966 reporting.setLocation( "outputDirectory", _location );
3967 reporting.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
3968 }
3969 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3970 {
3971 java.util.List<ReportPlugin> plugins = new java.util.ArrayList<ReportPlugin>();
3972 reporting.setPlugins( plugins );
3973 while ( parser.nextTag() == XmlPullParser.START_TAG )
3974 {
3975 if ( "plugin".equals( parser.getName() ) )
3976 {
3977 plugins.add( parseReportPlugin( parser, strict, source ) );
3978 }
3979 else
3980 {
3981 checkUnknownElement( parser, strict );
3982 }
3983 }
3984 }
3985 else
3986 {
3987 checkUnknownElement( parser, strict );
3988 }
3989 }
3990 return reporting;
3991 }
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004 private Repository parseRepository( XmlPullParser parser, boolean strict, InputSource source )
4005 throws IOException, XmlPullParserException
4006 {
4007 String tagName = parser.getName();
4008 Repository repository = new Repository();
4009 InputLocation _location;
4010 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4011 repository.setLocation( "", _location );
4012 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4013 {
4014 String name = parser.getAttributeName( i );
4015 String value = parser.getAttributeValue( i );
4016
4017 if ( name.indexOf( ':' ) >= 0 )
4018 {
4019
4020 }
4021 else
4022 {
4023 checkUnknownAttribute( parser, name, tagName, strict );
4024 }
4025 }
4026 java.util.Set parsed = new java.util.HashSet();
4027 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4028 {
4029 if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) )
4030 {
4031 repository.setReleases( parseRepositoryPolicy( parser, strict, source ) );
4032 }
4033 else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) )
4034 {
4035 repository.setSnapshots( parseRepositoryPolicy( parser, strict, source ) );
4036 }
4037 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
4038 {
4039 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4040 repository.setLocation( "id", _location );
4041 repository.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
4042 }
4043 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
4044 {
4045 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4046 repository.setLocation( "name", _location );
4047 repository.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
4048 }
4049 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4050 {
4051 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4052 repository.setLocation( "url", _location );
4053 repository.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
4054 }
4055 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
4056 {
4057 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4058 repository.setLocation( "layout", _location );
4059 repository.setLayout( interpolatedTrimmed( parser.nextText(), "layout" ) );
4060 }
4061 else
4062 {
4063 checkUnknownElement( parser, strict );
4064 }
4065 }
4066 return repository;
4067 }
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080 private RepositoryBase parseRepositoryBase( XmlPullParser parser, boolean strict, InputSource source )
4081 throws IOException, XmlPullParserException
4082 {
4083 String tagName = parser.getName();
4084 RepositoryBase repositoryBase = new RepositoryBase();
4085 InputLocation _location;
4086 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4087 repositoryBase.setLocation( "", _location );
4088 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4089 {
4090 String name = parser.getAttributeName( i );
4091 String value = parser.getAttributeValue( i );
4092
4093 if ( name.indexOf( ':' ) >= 0 )
4094 {
4095
4096 }
4097 else
4098 {
4099 checkUnknownAttribute( parser, name, tagName, strict );
4100 }
4101 }
4102 java.util.Set parsed = new java.util.HashSet();
4103 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4104 {
4105 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
4106 {
4107 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4108 repositoryBase.setLocation( "id", _location );
4109 repositoryBase.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
4110 }
4111 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
4112 {
4113 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4114 repositoryBase.setLocation( "name", _location );
4115 repositoryBase.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
4116 }
4117 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4118 {
4119 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4120 repositoryBase.setLocation( "url", _location );
4121 repositoryBase.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
4122 }
4123 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
4124 {
4125 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4126 repositoryBase.setLocation( "layout", _location );
4127 repositoryBase.setLayout( interpolatedTrimmed( parser.nextText(), "layout" ) );
4128 }
4129 else
4130 {
4131 checkUnknownElement( parser, strict );
4132 }
4133 }
4134 return repositoryBase;
4135 }
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148 private RepositoryPolicy parseRepositoryPolicy( XmlPullParser parser, boolean strict, InputSource source )
4149 throws IOException, XmlPullParserException
4150 {
4151 String tagName = parser.getName();
4152 RepositoryPolicy repositoryPolicy = new RepositoryPolicy();
4153 InputLocation _location;
4154 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4155 repositoryPolicy.setLocation( "", _location );
4156 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4157 {
4158 String name = parser.getAttributeName( i );
4159 String value = parser.getAttributeValue( i );
4160
4161 if ( name.indexOf( ':' ) >= 0 )
4162 {
4163
4164 }
4165 else
4166 {
4167 checkUnknownAttribute( parser, name, tagName, strict );
4168 }
4169 }
4170 java.util.Set parsed = new java.util.HashSet();
4171 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4172 {
4173 if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) )
4174 {
4175 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4176 repositoryPolicy.setLocation( "enabled", _location );
4177 repositoryPolicy.setEnabled( interpolatedTrimmed( parser.nextText(), "enabled" ) );
4178 }
4179 else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) )
4180 {
4181 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4182 repositoryPolicy.setLocation( "updatePolicy", _location );
4183 repositoryPolicy.setUpdatePolicy( interpolatedTrimmed( parser.nextText(), "updatePolicy" ) );
4184 }
4185 else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) )
4186 {
4187 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4188 repositoryPolicy.setLocation( "checksumPolicy", _location );
4189 repositoryPolicy.setChecksumPolicy( interpolatedTrimmed( parser.nextText(), "checksumPolicy" ) );
4190 }
4191 else
4192 {
4193 checkUnknownElement( parser, strict );
4194 }
4195 }
4196 return repositoryPolicy;
4197 }
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210 private Resource parseResource( XmlPullParser parser, boolean strict, InputSource source )
4211 throws IOException, XmlPullParserException
4212 {
4213 String tagName = parser.getName();
4214 Resource resource = new Resource();
4215 InputLocation _location;
4216 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4217 resource.setLocation( "", _location );
4218 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4219 {
4220 String name = parser.getAttributeName( i );
4221 String value = parser.getAttributeValue( i );
4222
4223 if ( name.indexOf( ':' ) >= 0 )
4224 {
4225
4226 }
4227 else
4228 {
4229 checkUnknownAttribute( parser, name, tagName, strict );
4230 }
4231 }
4232 java.util.Set parsed = new java.util.HashSet();
4233 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4234 {
4235 if ( checkFieldWithDuplicate( parser, "targetPath", null, parsed ) )
4236 {
4237 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4238 resource.setLocation( "targetPath", _location );
4239 resource.setTargetPath( interpolatedTrimmed( parser.nextText(), "targetPath" ) );
4240 }
4241 else if ( checkFieldWithDuplicate( parser, "filtering", null, parsed ) )
4242 {
4243 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4244 resource.setLocation( "filtering", _location );
4245 resource.setFiltering( interpolatedTrimmed( parser.nextText(), "filtering" ) );
4246 }
4247 else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
4248 {
4249 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4250 resource.setLocation( "directory", _location );
4251 resource.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
4252 }
4253 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
4254 {
4255 java.util.List<String> includes = new java.util.ArrayList<String>();
4256 resource.setIncludes( includes );
4257 InputLocation _locations;
4258 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4259 resource.setLocation( "includes", _locations );
4260 while ( parser.nextTag() == XmlPullParser.START_TAG )
4261 {
4262 if ( "include".equals( parser.getName() ) )
4263 {
4264 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4265 _locations.setLocation( Integer.valueOf( includes.size() ), _location );
4266 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
4267 }
4268 else
4269 {
4270 checkUnknownElement( parser, strict );
4271 }
4272 }
4273 }
4274 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
4275 {
4276 java.util.List<String> excludes = new java.util.ArrayList<String>();
4277 resource.setExcludes( excludes );
4278 InputLocation _locations;
4279 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4280 resource.setLocation( "excludes", _locations );
4281 while ( parser.nextTag() == XmlPullParser.START_TAG )
4282 {
4283 if ( "exclude".equals( parser.getName() ) )
4284 {
4285 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4286 _locations.setLocation( Integer.valueOf( excludes.size() ), _location );
4287 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
4288 }
4289 else
4290 {
4291 checkUnknownElement( parser, strict );
4292 }
4293 }
4294 }
4295 else
4296 {
4297 checkUnknownElement( parser, strict );
4298 }
4299 }
4300 return resource;
4301 }
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314 private Scm parseScm( XmlPullParser parser, boolean strict, InputSource source )
4315 throws IOException, XmlPullParserException
4316 {
4317 String tagName = parser.getName();
4318 Scm scm = new Scm();
4319 InputLocation _location;
4320 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4321 scm.setLocation( "", _location );
4322 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4323 {
4324 String name = parser.getAttributeName( i );
4325 String value = parser.getAttributeValue( i );
4326
4327 if ( name.indexOf( ':' ) >= 0 )
4328 {
4329
4330 }
4331 else if ( "child.scm.connection.inherit.append.path".equals( name ) )
4332 {
4333 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4334 scm.setLocation( "childScmConnectionInheritAppendPath", _location );
4335 scm.setChildScmConnectionInheritAppendPath( interpolatedTrimmed( value, "child.scm.connection.inherit.append.path" ) );
4336 }
4337 else if ( "child.scm.developerConnection.inherit.append.path".equals( name ) )
4338 {
4339 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4340 scm.setLocation( "childScmDeveloperConnectionInheritAppendPath", _location );
4341 scm.setChildScmDeveloperConnectionInheritAppendPath( interpolatedTrimmed( value, "child.scm.developerConnection.inherit.append.path" ) );
4342 }
4343 else if ( "child.scm.url.inherit.append.path".equals( name ) )
4344 {
4345 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4346 scm.setLocation( "childScmUrlInheritAppendPath", _location );
4347 scm.setChildScmUrlInheritAppendPath( interpolatedTrimmed( value, "child.scm.url.inherit.append.path" ) );
4348 }
4349 else
4350 {
4351 checkUnknownAttribute( parser, name, tagName, strict );
4352 }
4353 }
4354 java.util.Set parsed = new java.util.HashSet();
4355 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4356 {
4357 if ( checkFieldWithDuplicate( parser, "connection", null, parsed ) )
4358 {
4359 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4360 scm.setLocation( "connection", _location );
4361 scm.setConnection( interpolatedTrimmed( parser.nextText(), "connection" ) );
4362 }
4363 else if ( checkFieldWithDuplicate( parser, "developerConnection", null, parsed ) )
4364 {
4365 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4366 scm.setLocation( "developerConnection", _location );
4367 scm.setDeveloperConnection( interpolatedTrimmed( parser.nextText(), "developerConnection" ) );
4368 }
4369 else if ( checkFieldWithDuplicate( parser, "tag", null, parsed ) )
4370 {
4371 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4372 scm.setLocation( "tag", _location );
4373 scm.setTag( interpolatedTrimmed( parser.nextText(), "tag" ) );
4374 }
4375 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4376 {
4377 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4378 scm.setLocation( "url", _location );
4379 scm.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
4380 }
4381 else
4382 {
4383 checkUnknownElement( parser, strict );
4384 }
4385 }
4386 return scm;
4387 }
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400 private Site parseSite( XmlPullParser parser, boolean strict, InputSource source )
4401 throws IOException, XmlPullParserException
4402 {
4403 String tagName = parser.getName();
4404 Site site = new Site();
4405 InputLocation _location;
4406 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4407 site.setLocation( "", _location );
4408 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4409 {
4410 String name = parser.getAttributeName( i );
4411 String value = parser.getAttributeValue( i );
4412
4413 if ( name.indexOf( ':' ) >= 0 )
4414 {
4415
4416 }
4417 else if ( "child.site.url.inherit.append.path".equals( name ) )
4418 {
4419 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4420 site.setLocation( "childSiteUrlInheritAppendPath", _location );
4421 site.setChildSiteUrlInheritAppendPath( interpolatedTrimmed( value, "child.site.url.inherit.append.path" ) );
4422 }
4423 else
4424 {
4425 checkUnknownAttribute( parser, name, tagName, strict );
4426 }
4427 }
4428 java.util.Set parsed = new java.util.HashSet();
4429 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4430 {
4431 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
4432 {
4433 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4434 site.setLocation( "id", _location );
4435 site.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
4436 }
4437 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
4438 {
4439 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4440 site.setLocation( "name", _location );
4441 site.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
4442 }
4443 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4444 {
4445 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4446 site.setLocation( "url", _location );
4447 site.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
4448 }
4449 else
4450 {
4451 checkUnknownElement( parser, strict );
4452 }
4453 }
4454 return site;
4455 }
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468 private Model read( XmlPullParser parser, boolean strict, InputSource source )
4469 throws IOException, XmlPullParserException
4470 {
4471 Model model = null;
4472 int eventType = parser.getEventType();
4473 boolean parsed = false;
4474 while ( eventType != XmlPullParser.END_DOCUMENT )
4475 {
4476 if ( eventType == XmlPullParser.START_TAG )
4477 {
4478 if ( strict && ! "project".equals( parser.getName() ) )
4479 {
4480 throw new XmlPullParserException( "Expected root element 'project' but found '" + parser.getName() + "'", parser, null );
4481 }
4482 else if ( parsed )
4483 {
4484
4485 throw new XmlPullParserException( "Duplicated tag: 'project'", parser, null );
4486 }
4487 model = parseModel( parser, strict, source );
4488 model.setModelEncoding( parser.getInputEncoding() );
4489 parsed = true;
4490 }
4491 eventType = parser.next();
4492 }
4493 if ( parsed )
4494 {
4495 return model;
4496 }
4497 throw new XmlPullParserException( "Expected root element 'project' but found no element at all: invalid XML document", parser, null );
4498 }
4499
4500
4501
4502
4503
4504
4505 public void setAddDefaultEntities( boolean addDefaultEntities )
4506 {
4507 this.addDefaultEntities = addDefaultEntities;
4508 }
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520 private static class Xpp3DomBuilderInputLocationBuilder
4521 implements org.codehaus.plexus.util.xml.Xpp3DomBuilder.InputLocationBuilder
4522 {
4523
4524
4525
4526
4527
4528
4529
4530
4531 private final InputLocation rootLocation;
4532
4533
4534
4535
4536
4537
4538 public Xpp3DomBuilderInputLocationBuilder(InputLocation rootLocation)
4539 {
4540 this.rootLocation = rootLocation;
4541 }
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554 public Object toInputLocation( XmlPullParser parser )
4555 {
4556 return new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), rootLocation.getSource() );
4557 }
4558
4559 }
4560
4561 public static interface ContentTransformer
4562 {
4563
4564
4565
4566
4567
4568
4569
4570 String transform( String source, String fieldName );
4571 }
4572
4573 }