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