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 ) );
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, "artifactId", null, parsed ) )
1889 {
1890 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1891 exclusion.setLocation( "artifactId", _location );
1892 exclusion.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
1893 }
1894 else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1895 {
1896 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
1897 exclusion.setLocation( "groupId", _location );
1898 exclusion.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
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
2308 {
2309 checkUnknownAttribute( parser, name, tagName, strict );
2310 }
2311 }
2312 java.util.Set parsed = new java.util.HashSet();
2313 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2314 {
2315 if ( checkFieldWithDuplicate( parser, "modelVersion", null, parsed ) )
2316 {
2317 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2318 model.setLocation( "modelVersion", _location );
2319 model.setModelVersion( interpolatedTrimmed( parser.nextText(), "modelVersion" ) );
2320 }
2321 else if ( checkFieldWithDuplicate( parser, "parent", null, parsed ) )
2322 {
2323 model.setParent( parseParent( parser, strict, source ) );
2324 }
2325 else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2326 {
2327 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2328 model.setLocation( "groupId", _location );
2329 model.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
2330 }
2331 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2332 {
2333 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2334 model.setLocation( "artifactId", _location );
2335 model.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
2336 }
2337 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2338 {
2339 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2340 model.setLocation( "version", _location );
2341 model.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
2342 }
2343 else if ( checkFieldWithDuplicate( parser, "packaging", null, parsed ) )
2344 {
2345 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2346 model.setLocation( "packaging", _location );
2347 model.setPackaging( interpolatedTrimmed( parser.nextText(), "packaging" ) );
2348 }
2349 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2350 {
2351 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2352 model.setLocation( "name", _location );
2353 model.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
2354 }
2355 else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) )
2356 {
2357 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2358 model.setLocation( "description", _location );
2359 model.setDescription( interpolatedTrimmed( parser.nextText(), "description" ) );
2360 }
2361 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2362 {
2363 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2364 model.setLocation( "url", _location );
2365 model.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
2366 }
2367 else if ( checkFieldWithDuplicate( parser, "inceptionYear", null, parsed ) )
2368 {
2369 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2370 model.setLocation( "inceptionYear", _location );
2371 model.setInceptionYear( interpolatedTrimmed( parser.nextText(), "inceptionYear" ) );
2372 }
2373 else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
2374 {
2375 model.setOrganization( parseOrganization( parser, strict, source ) );
2376 }
2377 else if ( checkFieldWithDuplicate( parser, "licenses", null, parsed ) )
2378 {
2379 java.util.List<License> licenses = new java.util.ArrayList<License>();
2380 model.setLicenses( licenses );
2381 while ( parser.nextTag() == XmlPullParser.START_TAG )
2382 {
2383 if ( "license".equals( parser.getName() ) )
2384 {
2385 licenses.add( parseLicense( parser, strict, source ) );
2386 }
2387 else
2388 {
2389 checkUnknownElement( parser, strict );
2390 }
2391 }
2392 }
2393 else if ( checkFieldWithDuplicate( parser, "developers", null, parsed ) )
2394 {
2395 java.util.List<Developer> developers = new java.util.ArrayList<Developer>();
2396 model.setDevelopers( developers );
2397 while ( parser.nextTag() == XmlPullParser.START_TAG )
2398 {
2399 if ( "developer".equals( parser.getName() ) )
2400 {
2401 developers.add( parseDeveloper( parser, strict, source ) );
2402 }
2403 else
2404 {
2405 checkUnknownElement( parser, strict );
2406 }
2407 }
2408 }
2409 else if ( checkFieldWithDuplicate( parser, "contributors", null, parsed ) )
2410 {
2411 java.util.List<Contributor> contributors = new java.util.ArrayList<Contributor>();
2412 model.setContributors( contributors );
2413 while ( parser.nextTag() == XmlPullParser.START_TAG )
2414 {
2415 if ( "contributor".equals( parser.getName() ) )
2416 {
2417 contributors.add( parseContributor( parser, strict, source ) );
2418 }
2419 else
2420 {
2421 checkUnknownElement( parser, strict );
2422 }
2423 }
2424 }
2425 else if ( checkFieldWithDuplicate( parser, "mailingLists", null, parsed ) )
2426 {
2427 java.util.List<MailingList> mailingLists = new java.util.ArrayList<MailingList>();
2428 model.setMailingLists( mailingLists );
2429 while ( parser.nextTag() == XmlPullParser.START_TAG )
2430 {
2431 if ( "mailingList".equals( parser.getName() ) )
2432 {
2433 mailingLists.add( parseMailingList( parser, strict, source ) );
2434 }
2435 else
2436 {
2437 checkUnknownElement( parser, strict );
2438 }
2439 }
2440 }
2441 else if ( checkFieldWithDuplicate( parser, "prerequisites", null, parsed ) )
2442 {
2443 model.setPrerequisites( parsePrerequisites( parser, strict, source ) );
2444 }
2445 else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
2446 {
2447 java.util.List<String> modules = new java.util.ArrayList<String>();
2448 model.setModules( modules );
2449 InputLocation _locations;
2450 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2451 model.setLocation( "modules", _locations );
2452 while ( parser.nextTag() == XmlPullParser.START_TAG )
2453 {
2454 if ( "module".equals( parser.getName() ) )
2455 {
2456 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2457 _locations.setLocation( Integer.valueOf( modules.size() ), _location );
2458 modules.add( interpolatedTrimmed( parser.nextText(), "modules" ) );
2459 }
2460 else
2461 {
2462 checkUnknownElement( parser, strict );
2463 }
2464 }
2465 }
2466 else if ( checkFieldWithDuplicate( parser, "scm", null, parsed ) )
2467 {
2468 model.setScm( parseScm( parser, strict, source ) );
2469 }
2470 else if ( checkFieldWithDuplicate( parser, "issueManagement", null, parsed ) )
2471 {
2472 model.setIssueManagement( parseIssueManagement( parser, strict, source ) );
2473 }
2474 else if ( checkFieldWithDuplicate( parser, "ciManagement", null, parsed ) )
2475 {
2476 model.setCiManagement( parseCiManagement( parser, strict, source ) );
2477 }
2478 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
2479 {
2480 model.setDistributionManagement( parseDistributionManagement( parser, strict, source ) );
2481 }
2482 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
2483 {
2484 InputLocation _locations;
2485 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2486 model.setLocation( "properties", _locations );
2487 while ( parser.nextTag() == XmlPullParser.START_TAG )
2488 {
2489 String key = parser.getName();
2490 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2491 _locations.setLocation( key, _location );
2492 String value = parser.nextText().trim();
2493 model.addProperty( key, value );
2494 }
2495 }
2496 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
2497 {
2498 model.setDependencyManagement( parseDependencyManagement( parser, strict, source ) );
2499 }
2500 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2501 {
2502 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
2503 model.setDependencies( dependencies );
2504 while ( parser.nextTag() == XmlPullParser.START_TAG )
2505 {
2506 if ( "dependency".equals( parser.getName() ) )
2507 {
2508 dependencies.add( parseDependency( parser, strict, source ) );
2509 }
2510 else
2511 {
2512 checkUnknownElement( parser, strict );
2513 }
2514 }
2515 }
2516 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
2517 {
2518 java.util.List<Repository> repositories = new java.util.ArrayList<Repository>();
2519 model.setRepositories( repositories );
2520 while ( parser.nextTag() == XmlPullParser.START_TAG )
2521 {
2522 if ( "repository".equals( parser.getName() ) )
2523 {
2524 repositories.add( parseRepository( parser, strict, source ) );
2525 }
2526 else
2527 {
2528 checkUnknownElement( parser, strict );
2529 }
2530 }
2531 }
2532 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
2533 {
2534 java.util.List<Repository> pluginRepositories = new java.util.ArrayList<Repository>();
2535 model.setPluginRepositories( pluginRepositories );
2536 while ( parser.nextTag() == XmlPullParser.START_TAG )
2537 {
2538 if ( "pluginRepository".equals( parser.getName() ) )
2539 {
2540 pluginRepositories.add( parseRepository( parser, strict, source ) );
2541 }
2542 else
2543 {
2544 checkUnknownElement( parser, strict );
2545 }
2546 }
2547 }
2548 else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
2549 {
2550 model.setBuild( parseBuild( parser, strict, source ) );
2551 }
2552 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
2553 {
2554 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2555 model.setLocation( "reports", _location );
2556 model.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
2557 }
2558 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
2559 {
2560 model.setReporting( parseReporting( parser, strict, source ) );
2561 }
2562 else if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) )
2563 {
2564 java.util.List<Profile> profiles = new java.util.ArrayList<Profile>();
2565 model.setProfiles( profiles );
2566 while ( parser.nextTag() == XmlPullParser.START_TAG )
2567 {
2568 if ( "profile".equals( parser.getName() ) )
2569 {
2570 profiles.add( parseProfile( parser, strict, source ) );
2571 }
2572 else
2573 {
2574 checkUnknownElement( parser, strict );
2575 }
2576 }
2577 }
2578 else
2579 {
2580 checkUnknownElement( parser, strict );
2581 }
2582 }
2583 return model;
2584 }
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596 private ModelBase parseModelBase( XmlPullParser parser, boolean strict, InputSource source )
2597 throws IOException, XmlPullParserException
2598 {
2599 String tagName = parser.getName();
2600 ModelBase modelBase = new ModelBase();
2601 InputLocation _location;
2602 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2603 modelBase.setLocation( "", _location );
2604 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2605 {
2606 String name = parser.getAttributeName( i );
2607 String value = parser.getAttributeValue( i );
2608
2609 if ( name.indexOf( ':' ) >= 0 )
2610 {
2611
2612 }
2613 else
2614 {
2615 checkUnknownAttribute( parser, name, tagName, strict );
2616 }
2617 }
2618 java.util.Set parsed = new java.util.HashSet();
2619 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2620 {
2621 if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
2622 {
2623 java.util.List<String> modules = new java.util.ArrayList<String>();
2624 modelBase.setModules( modules );
2625 InputLocation _locations;
2626 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2627 modelBase.setLocation( "modules", _locations );
2628 while ( parser.nextTag() == XmlPullParser.START_TAG )
2629 {
2630 if ( "module".equals( parser.getName() ) )
2631 {
2632 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2633 _locations.setLocation( Integer.valueOf( modules.size() ), _location );
2634 modules.add( interpolatedTrimmed( parser.nextText(), "modules" ) );
2635 }
2636 else
2637 {
2638 checkUnknownElement( parser, strict );
2639 }
2640 }
2641 }
2642 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
2643 {
2644 modelBase.setDistributionManagement( parseDistributionManagement( parser, strict, source ) );
2645 }
2646 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
2647 {
2648 InputLocation _locations;
2649 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2650 modelBase.setLocation( "properties", _locations );
2651 while ( parser.nextTag() == XmlPullParser.START_TAG )
2652 {
2653 String key = parser.getName();
2654 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2655 _locations.setLocation( key, _location );
2656 String value = parser.nextText().trim();
2657 modelBase.addProperty( key, value );
2658 }
2659 }
2660 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
2661 {
2662 modelBase.setDependencyManagement( parseDependencyManagement( parser, strict, source ) );
2663 }
2664 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2665 {
2666 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
2667 modelBase.setDependencies( dependencies );
2668 while ( parser.nextTag() == XmlPullParser.START_TAG )
2669 {
2670 if ( "dependency".equals( parser.getName() ) )
2671 {
2672 dependencies.add( parseDependency( parser, strict, source ) );
2673 }
2674 else
2675 {
2676 checkUnknownElement( parser, strict );
2677 }
2678 }
2679 }
2680 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
2681 {
2682 java.util.List<Repository> repositories = new java.util.ArrayList<Repository>();
2683 modelBase.setRepositories( repositories );
2684 while ( parser.nextTag() == XmlPullParser.START_TAG )
2685 {
2686 if ( "repository".equals( parser.getName() ) )
2687 {
2688 repositories.add( parseRepository( parser, strict, source ) );
2689 }
2690 else
2691 {
2692 checkUnknownElement( parser, strict );
2693 }
2694 }
2695 }
2696 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
2697 {
2698 java.util.List<Repository> pluginRepositories = new java.util.ArrayList<Repository>();
2699 modelBase.setPluginRepositories( pluginRepositories );
2700 while ( parser.nextTag() == XmlPullParser.START_TAG )
2701 {
2702 if ( "pluginRepository".equals( parser.getName() ) )
2703 {
2704 pluginRepositories.add( parseRepository( parser, strict, source ) );
2705 }
2706 else
2707 {
2708 checkUnknownElement( parser, strict );
2709 }
2710 }
2711 }
2712 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
2713 {
2714 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2715 modelBase.setLocation( "reports", _location );
2716 modelBase.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
2717 }
2718 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
2719 {
2720 modelBase.setReporting( parseReporting( parser, strict, source ) );
2721 }
2722 else
2723 {
2724 checkUnknownElement( parser, strict );
2725 }
2726 }
2727 return modelBase;
2728 }
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740 private Notifier parseNotifier( XmlPullParser parser, boolean strict, InputSource source )
2741 throws IOException, XmlPullParserException
2742 {
2743 String tagName = parser.getName();
2744 Notifier notifier = new Notifier();
2745 InputLocation _location;
2746 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2747 notifier.setLocation( "", _location );
2748 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2749 {
2750 String name = parser.getAttributeName( i );
2751 String value = parser.getAttributeValue( i );
2752
2753 if ( name.indexOf( ':' ) >= 0 )
2754 {
2755
2756 }
2757 else
2758 {
2759 checkUnknownAttribute( parser, name, tagName, strict );
2760 }
2761 }
2762 java.util.Set parsed = new java.util.HashSet();
2763 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2764 {
2765 if ( checkFieldWithDuplicate( parser, "type", null, parsed ) )
2766 {
2767 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2768 notifier.setLocation( "type", _location );
2769 notifier.setType( interpolatedTrimmed( parser.nextText(), "type" ) );
2770 }
2771 else if ( checkFieldWithDuplicate( parser, "sendOnError", null, parsed ) )
2772 {
2773 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2774 notifier.setLocation( "sendOnError", _location );
2775 notifier.setSendOnError( getBooleanValue( interpolatedTrimmed( parser.nextText(), "sendOnError" ), "sendOnError", parser, "true" ) );
2776 }
2777 else if ( checkFieldWithDuplicate( parser, "sendOnFailure", null, parsed ) )
2778 {
2779 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2780 notifier.setLocation( "sendOnFailure", _location );
2781 notifier.setSendOnFailure( getBooleanValue( interpolatedTrimmed( parser.nextText(), "sendOnFailure" ), "sendOnFailure", parser, "true" ) );
2782 }
2783 else if ( checkFieldWithDuplicate( parser, "sendOnSuccess", null, parsed ) )
2784 {
2785 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2786 notifier.setLocation( "sendOnSuccess", _location );
2787 notifier.setSendOnSuccess( getBooleanValue( interpolatedTrimmed( parser.nextText(), "sendOnSuccess" ), "sendOnSuccess", parser, "true" ) );
2788 }
2789 else if ( checkFieldWithDuplicate( parser, "sendOnWarning", null, parsed ) )
2790 {
2791 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2792 notifier.setLocation( "sendOnWarning", _location );
2793 notifier.setSendOnWarning( getBooleanValue( interpolatedTrimmed( parser.nextText(), "sendOnWarning" ), "sendOnWarning", parser, "true" ) );
2794 }
2795 else if ( checkFieldWithDuplicate( parser, "address", null, parsed ) )
2796 {
2797 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2798 notifier.setLocation( "address", _location );
2799 notifier.setAddress( interpolatedTrimmed( parser.nextText(), "address" ) );
2800 }
2801 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
2802 {
2803 InputLocation _locations;
2804 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2805 notifier.setLocation( "configuration", _locations );
2806 while ( parser.nextTag() == XmlPullParser.START_TAG )
2807 {
2808 String key = parser.getName();
2809 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2810 _locations.setLocation( key, _location );
2811 String value = parser.nextText().trim();
2812 notifier.addConfiguration( key, value );
2813 }
2814 }
2815 else
2816 {
2817 checkUnknownElement( parser, strict );
2818 }
2819 }
2820 return notifier;
2821 }
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833 private Organization parseOrganization( XmlPullParser parser, boolean strict, InputSource source )
2834 throws IOException, XmlPullParserException
2835 {
2836 String tagName = parser.getName();
2837 Organization organization = new Organization();
2838 InputLocation _location;
2839 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2840 organization.setLocation( "", _location );
2841 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2842 {
2843 String name = parser.getAttributeName( i );
2844 String value = parser.getAttributeValue( i );
2845
2846 if ( name.indexOf( ':' ) >= 0 )
2847 {
2848
2849 }
2850 else
2851 {
2852 checkUnknownAttribute( parser, name, tagName, strict );
2853 }
2854 }
2855 java.util.Set parsed = new java.util.HashSet();
2856 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2857 {
2858 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2859 {
2860 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2861 organization.setLocation( "name", _location );
2862 organization.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
2863 }
2864 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2865 {
2866 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2867 organization.setLocation( "url", _location );
2868 organization.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
2869 }
2870 else
2871 {
2872 checkUnknownElement( parser, strict );
2873 }
2874 }
2875 return organization;
2876 }
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888 private Parent parseParent( XmlPullParser parser, boolean strict, InputSource source )
2889 throws IOException, XmlPullParserException
2890 {
2891 String tagName = parser.getName();
2892 Parent parent = new Parent();
2893 InputLocation _location;
2894 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2895 parent.setLocation( "", _location );
2896 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2897 {
2898 String name = parser.getAttributeName( i );
2899 String value = parser.getAttributeValue( i );
2900
2901 if ( name.indexOf( ':' ) >= 0 )
2902 {
2903
2904 }
2905 else
2906 {
2907 checkUnknownAttribute( parser, name, tagName, strict );
2908 }
2909 }
2910 java.util.Set parsed = new java.util.HashSet();
2911 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2912 {
2913 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2914 {
2915 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2916 parent.setLocation( "groupId", _location );
2917 parent.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
2918 }
2919 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2920 {
2921 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2922 parent.setLocation( "artifactId", _location );
2923 parent.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
2924 }
2925 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2926 {
2927 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2928 parent.setLocation( "version", _location );
2929 parent.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
2930 }
2931 else if ( checkFieldWithDuplicate( parser, "relativePath", null, parsed ) )
2932 {
2933 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2934 parent.setLocation( "relativePath", _location );
2935 parent.setRelativePath( interpolatedTrimmed( parser.nextText(), "relativePath" ) );
2936 }
2937 else
2938 {
2939 checkUnknownElement( parser, strict );
2940 }
2941 }
2942 return parent;
2943 }
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955 private PatternSet parsePatternSet( XmlPullParser parser, boolean strict, InputSource source )
2956 throws IOException, XmlPullParserException
2957 {
2958 String tagName = parser.getName();
2959 PatternSet patternSet = new PatternSet();
2960 InputLocation _location;
2961 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2962 patternSet.setLocation( "", _location );
2963 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2964 {
2965 String name = parser.getAttributeName( i );
2966 String value = parser.getAttributeValue( i );
2967
2968 if ( name.indexOf( ':' ) >= 0 )
2969 {
2970
2971 }
2972 else
2973 {
2974 checkUnknownAttribute( parser, name, tagName, strict );
2975 }
2976 }
2977 java.util.Set parsed = new java.util.HashSet();
2978 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2979 {
2980 if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
2981 {
2982 java.util.List<String> includes = new java.util.ArrayList<String>();
2983 patternSet.setIncludes( includes );
2984 InputLocation _locations;
2985 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2986 patternSet.setLocation( "includes", _locations );
2987 while ( parser.nextTag() == XmlPullParser.START_TAG )
2988 {
2989 if ( "include".equals( parser.getName() ) )
2990 {
2991 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
2992 _locations.setLocation( Integer.valueOf( includes.size() ), _location );
2993 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
2994 }
2995 else
2996 {
2997 checkUnknownElement( parser, strict );
2998 }
2999 }
3000 }
3001 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
3002 {
3003 java.util.List<String> excludes = new java.util.ArrayList<String>();
3004 patternSet.setExcludes( excludes );
3005 InputLocation _locations;
3006 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3007 patternSet.setLocation( "excludes", _locations );
3008 while ( parser.nextTag() == XmlPullParser.START_TAG )
3009 {
3010 if ( "exclude".equals( parser.getName() ) )
3011 {
3012 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3013 _locations.setLocation( Integer.valueOf( excludes.size() ), _location );
3014 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
3015 }
3016 else
3017 {
3018 checkUnknownElement( parser, strict );
3019 }
3020 }
3021 }
3022 else
3023 {
3024 checkUnknownElement( parser, strict );
3025 }
3026 }
3027 return patternSet;
3028 }
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040 private Plugin parsePlugin( XmlPullParser parser, boolean strict, InputSource source )
3041 throws IOException, XmlPullParserException
3042 {
3043 String tagName = parser.getName();
3044 Plugin plugin = new Plugin();
3045 InputLocation _location;
3046 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3047 plugin.setLocation( "", _location );
3048 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3049 {
3050 String name = parser.getAttributeName( i );
3051 String value = parser.getAttributeValue( i );
3052
3053 if ( name.indexOf( ':' ) >= 0 )
3054 {
3055
3056 }
3057 else
3058 {
3059 checkUnknownAttribute( parser, name, tagName, strict );
3060 }
3061 }
3062 java.util.Set parsed = new java.util.HashSet();
3063 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3064 {
3065 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3066 {
3067 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3068 plugin.setLocation( "groupId", _location );
3069 plugin.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
3070 }
3071 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3072 {
3073 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3074 plugin.setLocation( "artifactId", _location );
3075 plugin.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
3076 }
3077 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3078 {
3079 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3080 plugin.setLocation( "version", _location );
3081 plugin.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
3082 }
3083 else if ( checkFieldWithDuplicate( parser, "extensions", null, parsed ) )
3084 {
3085 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3086 plugin.setLocation( "extensions", _location );
3087 plugin.setExtensions( interpolatedTrimmed( parser.nextText(), "extensions" ) );
3088 }
3089 else if ( checkFieldWithDuplicate( parser, "executions", null, parsed ) )
3090 {
3091 java.util.List<PluginExecution> executions = new java.util.ArrayList<PluginExecution>();
3092 plugin.setExecutions( executions );
3093 while ( parser.nextTag() == XmlPullParser.START_TAG )
3094 {
3095 if ( "execution".equals( parser.getName() ) )
3096 {
3097 executions.add( parsePluginExecution( parser, strict, source ) );
3098 }
3099 else
3100 {
3101 checkUnknownElement( parser, strict );
3102 }
3103 }
3104 }
3105 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
3106 {
3107 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
3108 plugin.setDependencies( dependencies );
3109 while ( parser.nextTag() == XmlPullParser.START_TAG )
3110 {
3111 if ( "dependency".equals( parser.getName() ) )
3112 {
3113 dependencies.add( parseDependency( parser, strict, source ) );
3114 }
3115 else
3116 {
3117 checkUnknownElement( parser, strict );
3118 }
3119 }
3120 }
3121 else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
3122 {
3123 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3124 plugin.setLocation( "goals", _location );
3125 plugin.setGoals( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3126 }
3127 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3128 {
3129 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3130 plugin.setLocation( "inherited", _location );
3131 plugin.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
3132 }
3133 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3134 {
3135 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3136 plugin.setLocation( "configuration", _location );
3137 plugin.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3138 }
3139 else
3140 {
3141 checkUnknownElement( parser, strict );
3142 }
3143 }
3144 return plugin;
3145 }
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157 private PluginConfiguration parsePluginConfiguration( XmlPullParser parser, boolean strict, InputSource source )
3158 throws IOException, XmlPullParserException
3159 {
3160 String tagName = parser.getName();
3161 PluginConfiguration pluginConfiguration = new PluginConfiguration();
3162 InputLocation _location;
3163 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3164 pluginConfiguration.setLocation( "", _location );
3165 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3166 {
3167 String name = parser.getAttributeName( i );
3168 String value = parser.getAttributeValue( i );
3169
3170 if ( name.indexOf( ':' ) >= 0 )
3171 {
3172
3173 }
3174 else
3175 {
3176 checkUnknownAttribute( parser, name, tagName, strict );
3177 }
3178 }
3179 java.util.Set parsed = new java.util.HashSet();
3180 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3181 {
3182 if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
3183 {
3184 pluginConfiguration.setPluginManagement( parsePluginManagement( parser, strict, source ) );
3185 }
3186 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3187 {
3188 java.util.List<Plugin> plugins = new java.util.ArrayList<Plugin>();
3189 pluginConfiguration.setPlugins( plugins );
3190 while ( parser.nextTag() == XmlPullParser.START_TAG )
3191 {
3192 if ( "plugin".equals( parser.getName() ) )
3193 {
3194 plugins.add( parsePlugin( parser, strict, source ) );
3195 }
3196 else
3197 {
3198 checkUnknownElement( parser, strict );
3199 }
3200 }
3201 }
3202 else
3203 {
3204 checkUnknownElement( parser, strict );
3205 }
3206 }
3207 return pluginConfiguration;
3208 }
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220 private PluginContainer parsePluginContainer( XmlPullParser parser, boolean strict, InputSource source )
3221 throws IOException, XmlPullParserException
3222 {
3223 String tagName = parser.getName();
3224 PluginContainer pluginContainer = new PluginContainer();
3225 InputLocation _location;
3226 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3227 pluginContainer.setLocation( "", _location );
3228 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3229 {
3230 String name = parser.getAttributeName( i );
3231 String value = parser.getAttributeValue( i );
3232
3233 if ( name.indexOf( ':' ) >= 0 )
3234 {
3235
3236 }
3237 else
3238 {
3239 checkUnknownAttribute( parser, name, tagName, strict );
3240 }
3241 }
3242 java.util.Set parsed = new java.util.HashSet();
3243 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3244 {
3245 if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3246 {
3247 java.util.List<Plugin> plugins = new java.util.ArrayList<Plugin>();
3248 pluginContainer.setPlugins( plugins );
3249 while ( parser.nextTag() == XmlPullParser.START_TAG )
3250 {
3251 if ( "plugin".equals( parser.getName() ) )
3252 {
3253 plugins.add( parsePlugin( parser, strict, source ) );
3254 }
3255 else
3256 {
3257 checkUnknownElement( parser, strict );
3258 }
3259 }
3260 }
3261 else
3262 {
3263 checkUnknownElement( parser, strict );
3264 }
3265 }
3266 return pluginContainer;
3267 }
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279 private PluginExecution parsePluginExecution( XmlPullParser parser, boolean strict, InputSource source )
3280 throws IOException, XmlPullParserException
3281 {
3282 String tagName = parser.getName();
3283 PluginExecution pluginExecution = new PluginExecution();
3284 InputLocation _location;
3285 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3286 pluginExecution.setLocation( "", _location );
3287 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3288 {
3289 String name = parser.getAttributeName( i );
3290 String value = parser.getAttributeValue( i );
3291
3292 if ( name.indexOf( ':' ) >= 0 )
3293 {
3294
3295 }
3296 else
3297 {
3298 checkUnknownAttribute( parser, name, tagName, strict );
3299 }
3300 }
3301 java.util.Set parsed = new java.util.HashSet();
3302 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3303 {
3304 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3305 {
3306 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3307 pluginExecution.setLocation( "id", _location );
3308 pluginExecution.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
3309 }
3310 else if ( checkFieldWithDuplicate( parser, "phase", null, parsed ) )
3311 {
3312 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3313 pluginExecution.setLocation( "phase", _location );
3314 pluginExecution.setPhase( interpolatedTrimmed( parser.nextText(), "phase" ) );
3315 }
3316 else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
3317 {
3318 java.util.List<String> goals = new java.util.ArrayList<String>();
3319 pluginExecution.setGoals( goals );
3320 InputLocation _locations;
3321 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3322 pluginExecution.setLocation( "goals", _locations );
3323 while ( parser.nextTag() == XmlPullParser.START_TAG )
3324 {
3325 if ( "goal".equals( parser.getName() ) )
3326 {
3327 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3328 _locations.setLocation( Integer.valueOf( goals.size() ), _location );
3329 goals.add( interpolatedTrimmed( parser.nextText(), "goals" ) );
3330 }
3331 else
3332 {
3333 checkUnknownElement( parser, strict );
3334 }
3335 }
3336 }
3337 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3338 {
3339 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3340 pluginExecution.setLocation( "inherited", _location );
3341 pluginExecution.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
3342 }
3343 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3344 {
3345 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3346 pluginExecution.setLocation( "configuration", _location );
3347 pluginExecution.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3348 }
3349 else
3350 {
3351 checkUnknownElement( parser, strict );
3352 }
3353 }
3354 return pluginExecution;
3355 }
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367 private PluginManagement parsePluginManagement( XmlPullParser parser, boolean strict, InputSource source )
3368 throws IOException, XmlPullParserException
3369 {
3370 String tagName = parser.getName();
3371 PluginManagement pluginManagement = new PluginManagement();
3372 InputLocation _location;
3373 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3374 pluginManagement.setLocation( "", _location );
3375 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3376 {
3377 String name = parser.getAttributeName( i );
3378 String value = parser.getAttributeValue( i );
3379
3380 if ( name.indexOf( ':' ) >= 0 )
3381 {
3382
3383 }
3384 else
3385 {
3386 checkUnknownAttribute( parser, name, tagName, strict );
3387 }
3388 }
3389 java.util.Set parsed = new java.util.HashSet();
3390 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3391 {
3392 if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3393 {
3394 java.util.List<Plugin> plugins = new java.util.ArrayList<Plugin>();
3395 pluginManagement.setPlugins( plugins );
3396 while ( parser.nextTag() == XmlPullParser.START_TAG )
3397 {
3398 if ( "plugin".equals( parser.getName() ) )
3399 {
3400 plugins.add( parsePlugin( parser, strict, source ) );
3401 }
3402 else
3403 {
3404 checkUnknownElement( parser, strict );
3405 }
3406 }
3407 }
3408 else
3409 {
3410 checkUnknownElement( parser, strict );
3411 }
3412 }
3413 return pluginManagement;
3414 }
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426 private Prerequisites parsePrerequisites( XmlPullParser parser, boolean strict, InputSource source )
3427 throws IOException, XmlPullParserException
3428 {
3429 String tagName = parser.getName();
3430 Prerequisites prerequisites = new Prerequisites();
3431 InputLocation _location;
3432 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3433 prerequisites.setLocation( "", _location );
3434 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3435 {
3436 String name = parser.getAttributeName( i );
3437 String value = parser.getAttributeValue( i );
3438
3439 if ( name.indexOf( ':' ) >= 0 )
3440 {
3441
3442 }
3443 else
3444 {
3445 checkUnknownAttribute( parser, name, tagName, strict );
3446 }
3447 }
3448 java.util.Set parsed = new java.util.HashSet();
3449 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3450 {
3451 if ( checkFieldWithDuplicate( parser, "maven", null, parsed ) )
3452 {
3453 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3454 prerequisites.setLocation( "maven", _location );
3455 prerequisites.setMaven( interpolatedTrimmed( parser.nextText(), "maven" ) );
3456 }
3457 else
3458 {
3459 checkUnknownElement( parser, strict );
3460 }
3461 }
3462 return prerequisites;
3463 }
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475 private Profile parseProfile( XmlPullParser parser, boolean strict, InputSource source )
3476 throws IOException, XmlPullParserException
3477 {
3478 String tagName = parser.getName();
3479 Profile profile = new Profile();
3480 InputLocation _location;
3481 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3482 profile.setLocation( "", _location );
3483 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3484 {
3485 String name = parser.getAttributeName( i );
3486 String value = parser.getAttributeValue( i );
3487
3488 if ( name.indexOf( ':' ) >= 0 )
3489 {
3490
3491 }
3492 else
3493 {
3494 checkUnknownAttribute( parser, name, tagName, strict );
3495 }
3496 }
3497 java.util.Set parsed = new java.util.HashSet();
3498 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3499 {
3500 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3501 {
3502 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3503 profile.setLocation( "id", _location );
3504 profile.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
3505 }
3506 else if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) )
3507 {
3508 profile.setActivation( parseActivation( parser, strict, source ) );
3509 }
3510 else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
3511 {
3512 profile.setBuild( parseBuildBase( parser, strict, source ) );
3513 }
3514 else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
3515 {
3516 java.util.List<String> modules = new java.util.ArrayList<String>();
3517 profile.setModules( modules );
3518 InputLocation _locations;
3519 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3520 profile.setLocation( "modules", _locations );
3521 while ( parser.nextTag() == XmlPullParser.START_TAG )
3522 {
3523 if ( "module".equals( parser.getName() ) )
3524 {
3525 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3526 _locations.setLocation( Integer.valueOf( modules.size() ), _location );
3527 modules.add( interpolatedTrimmed( parser.nextText(), "modules" ) );
3528 }
3529 else
3530 {
3531 checkUnknownElement( parser, strict );
3532 }
3533 }
3534 }
3535 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
3536 {
3537 profile.setDistributionManagement( parseDistributionManagement( parser, strict, source ) );
3538 }
3539 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
3540 {
3541 InputLocation _locations;
3542 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3543 profile.setLocation( "properties", _locations );
3544 while ( parser.nextTag() == XmlPullParser.START_TAG )
3545 {
3546 String key = parser.getName();
3547 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3548 _locations.setLocation( key, _location );
3549 String value = parser.nextText().trim();
3550 profile.addProperty( key, value );
3551 }
3552 }
3553 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
3554 {
3555 profile.setDependencyManagement( parseDependencyManagement( parser, strict, source ) );
3556 }
3557 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
3558 {
3559 java.util.List<Dependency> dependencies = new java.util.ArrayList<Dependency>();
3560 profile.setDependencies( dependencies );
3561 while ( parser.nextTag() == XmlPullParser.START_TAG )
3562 {
3563 if ( "dependency".equals( parser.getName() ) )
3564 {
3565 dependencies.add( parseDependency( parser, strict, source ) );
3566 }
3567 else
3568 {
3569 checkUnknownElement( parser, strict );
3570 }
3571 }
3572 }
3573 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
3574 {
3575 java.util.List<Repository> repositories = new java.util.ArrayList<Repository>();
3576 profile.setRepositories( repositories );
3577 while ( parser.nextTag() == XmlPullParser.START_TAG )
3578 {
3579 if ( "repository".equals( parser.getName() ) )
3580 {
3581 repositories.add( parseRepository( parser, strict, source ) );
3582 }
3583 else
3584 {
3585 checkUnknownElement( parser, strict );
3586 }
3587 }
3588 }
3589 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
3590 {
3591 java.util.List<Repository> pluginRepositories = new java.util.ArrayList<Repository>();
3592 profile.setPluginRepositories( pluginRepositories );
3593 while ( parser.nextTag() == XmlPullParser.START_TAG )
3594 {
3595 if ( "pluginRepository".equals( parser.getName() ) )
3596 {
3597 pluginRepositories.add( parseRepository( parser, strict, source ) );
3598 }
3599 else
3600 {
3601 checkUnknownElement( parser, strict );
3602 }
3603 }
3604 }
3605 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
3606 {
3607 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3608 profile.setLocation( "reports", _location );
3609 profile.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3610 }
3611 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
3612 {
3613 profile.setReporting( parseReporting( parser, strict, source ) );
3614 }
3615 else
3616 {
3617 checkUnknownElement( parser, strict );
3618 }
3619 }
3620 return profile;
3621 }
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633 private Relocation parseRelocation( XmlPullParser parser, boolean strict, InputSource source )
3634 throws IOException, XmlPullParserException
3635 {
3636 String tagName = parser.getName();
3637 Relocation relocation = new Relocation();
3638 InputLocation _location;
3639 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3640 relocation.setLocation( "", _location );
3641 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3642 {
3643 String name = parser.getAttributeName( i );
3644 String value = parser.getAttributeValue( i );
3645
3646 if ( name.indexOf( ':' ) >= 0 )
3647 {
3648
3649 }
3650 else
3651 {
3652 checkUnknownAttribute( parser, name, tagName, strict );
3653 }
3654 }
3655 java.util.Set parsed = new java.util.HashSet();
3656 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3657 {
3658 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3659 {
3660 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3661 relocation.setLocation( "groupId", _location );
3662 relocation.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
3663 }
3664 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3665 {
3666 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3667 relocation.setLocation( "artifactId", _location );
3668 relocation.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
3669 }
3670 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3671 {
3672 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3673 relocation.setLocation( "version", _location );
3674 relocation.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
3675 }
3676 else if ( checkFieldWithDuplicate( parser, "message", null, parsed ) )
3677 {
3678 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3679 relocation.setLocation( "message", _location );
3680 relocation.setMessage( interpolatedTrimmed( parser.nextText(), "message" ) );
3681 }
3682 else
3683 {
3684 checkUnknownElement( parser, strict );
3685 }
3686 }
3687 return relocation;
3688 }
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700 private ReportPlugin parseReportPlugin( XmlPullParser parser, boolean strict, InputSource source )
3701 throws IOException, XmlPullParserException
3702 {
3703 String tagName = parser.getName();
3704 ReportPlugin reportPlugin = new ReportPlugin();
3705 InputLocation _location;
3706 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3707 reportPlugin.setLocation( "", _location );
3708 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3709 {
3710 String name = parser.getAttributeName( i );
3711 String value = parser.getAttributeValue( i );
3712
3713 if ( name.indexOf( ':' ) >= 0 )
3714 {
3715
3716 }
3717 else
3718 {
3719 checkUnknownAttribute( parser, name, tagName, strict );
3720 }
3721 }
3722 java.util.Set parsed = new java.util.HashSet();
3723 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3724 {
3725 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3726 {
3727 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3728 reportPlugin.setLocation( "groupId", _location );
3729 reportPlugin.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
3730 }
3731 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3732 {
3733 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3734 reportPlugin.setLocation( "artifactId", _location );
3735 reportPlugin.setArtifactId( interpolatedTrimmed( parser.nextText(), "artifactId" ) );
3736 }
3737 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3738 {
3739 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3740 reportPlugin.setLocation( "version", _location );
3741 reportPlugin.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
3742 }
3743 else if ( checkFieldWithDuplicate( parser, "reportSets", null, parsed ) )
3744 {
3745 java.util.List<ReportSet> reportSets = new java.util.ArrayList<ReportSet>();
3746 reportPlugin.setReportSets( reportSets );
3747 while ( parser.nextTag() == XmlPullParser.START_TAG )
3748 {
3749 if ( "reportSet".equals( parser.getName() ) )
3750 {
3751 reportSets.add( parseReportSet( parser, strict, source ) );
3752 }
3753 else
3754 {
3755 checkUnknownElement( parser, strict );
3756 }
3757 }
3758 }
3759 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3760 {
3761 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3762 reportPlugin.setLocation( "inherited", _location );
3763 reportPlugin.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
3764 }
3765 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3766 {
3767 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3768 reportPlugin.setLocation( "configuration", _location );
3769 reportPlugin.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3770 }
3771 else
3772 {
3773 checkUnknownElement( parser, strict );
3774 }
3775 }
3776 return reportPlugin;
3777 }
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789 private ReportSet parseReportSet( XmlPullParser parser, boolean strict, InputSource source )
3790 throws IOException, XmlPullParserException
3791 {
3792 String tagName = parser.getName();
3793 ReportSet reportSet = new ReportSet();
3794 InputLocation _location;
3795 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3796 reportSet.setLocation( "", _location );
3797 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3798 {
3799 String name = parser.getAttributeName( i );
3800 String value = parser.getAttributeValue( i );
3801
3802 if ( name.indexOf( ':' ) >= 0 )
3803 {
3804
3805 }
3806 else
3807 {
3808 checkUnknownAttribute( parser, name, tagName, strict );
3809 }
3810 }
3811 java.util.Set parsed = new java.util.HashSet();
3812 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3813 {
3814 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3815 {
3816 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3817 reportSet.setLocation( "id", _location );
3818 reportSet.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
3819 }
3820 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
3821 {
3822 java.util.List<String> reports = new java.util.ArrayList<String>();
3823 reportSet.setReports( reports );
3824 InputLocation _locations;
3825 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3826 reportSet.setLocation( "reports", _locations );
3827 while ( parser.nextTag() == XmlPullParser.START_TAG )
3828 {
3829 if ( "report".equals( parser.getName() ) )
3830 {
3831 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3832 _locations.setLocation( Integer.valueOf( reports.size() ), _location );
3833 reports.add( interpolatedTrimmed( parser.nextText(), "reports" ) );
3834 }
3835 else
3836 {
3837 checkUnknownElement( parser, strict );
3838 }
3839 }
3840 }
3841 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3842 {
3843 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3844 reportSet.setLocation( "inherited", _location );
3845 reportSet.setInherited( interpolatedTrimmed( parser.nextText(), "inherited" ) );
3846 }
3847 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3848 {
3849 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3850 reportSet.setLocation( "configuration", _location );
3851 reportSet.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3852 }
3853 else
3854 {
3855 checkUnknownElement( parser, strict );
3856 }
3857 }
3858 return reportSet;
3859 }
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871 private Reporting parseReporting( XmlPullParser parser, boolean strict, InputSource source )
3872 throws IOException, XmlPullParserException
3873 {
3874 String tagName = parser.getName();
3875 Reporting reporting = new Reporting();
3876 InputLocation _location;
3877 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3878 reporting.setLocation( "", _location );
3879 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3880 {
3881 String name = parser.getAttributeName( i );
3882 String value = parser.getAttributeValue( i );
3883
3884 if ( name.indexOf( ':' ) >= 0 )
3885 {
3886
3887 }
3888 else
3889 {
3890 checkUnknownAttribute( parser, name, tagName, strict );
3891 }
3892 }
3893 java.util.Set parsed = new java.util.HashSet();
3894 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3895 {
3896 if ( checkFieldWithDuplicate( parser, "excludeDefaults", null, parsed ) )
3897 {
3898 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3899 reporting.setLocation( "excludeDefaults", _location );
3900 reporting.setExcludeDefaults( interpolatedTrimmed( parser.nextText(), "excludeDefaults" ) );
3901 }
3902 else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
3903 {
3904 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3905 reporting.setLocation( "outputDirectory", _location );
3906 reporting.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
3907 }
3908 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3909 {
3910 java.util.List<ReportPlugin> plugins = new java.util.ArrayList<ReportPlugin>();
3911 reporting.setPlugins( plugins );
3912 while ( parser.nextTag() == XmlPullParser.START_TAG )
3913 {
3914 if ( "plugin".equals( parser.getName() ) )
3915 {
3916 plugins.add( parseReportPlugin( parser, strict, source ) );
3917 }
3918 else
3919 {
3920 checkUnknownElement( parser, strict );
3921 }
3922 }
3923 }
3924 else
3925 {
3926 checkUnknownElement( parser, strict );
3927 }
3928 }
3929 return reporting;
3930 }
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942 private Repository parseRepository( XmlPullParser parser, boolean strict, InputSource source )
3943 throws IOException, XmlPullParserException
3944 {
3945 String tagName = parser.getName();
3946 Repository repository = new Repository();
3947 InputLocation _location;
3948 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3949 repository.setLocation( "", _location );
3950 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3951 {
3952 String name = parser.getAttributeName( i );
3953 String value = parser.getAttributeValue( i );
3954
3955 if ( name.indexOf( ':' ) >= 0 )
3956 {
3957
3958 }
3959 else
3960 {
3961 checkUnknownAttribute( parser, name, tagName, strict );
3962 }
3963 }
3964 java.util.Set parsed = new java.util.HashSet();
3965 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3966 {
3967 if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) )
3968 {
3969 repository.setReleases( parseRepositoryPolicy( parser, strict, source ) );
3970 }
3971 else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) )
3972 {
3973 repository.setSnapshots( parseRepositoryPolicy( parser, strict, source ) );
3974 }
3975 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3976 {
3977 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3978 repository.setLocation( "id", _location );
3979 repository.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
3980 }
3981 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
3982 {
3983 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3984 repository.setLocation( "name", _location );
3985 repository.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
3986 }
3987 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
3988 {
3989 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3990 repository.setLocation( "url", _location );
3991 repository.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
3992 }
3993 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
3994 {
3995 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
3996 repository.setLocation( "layout", _location );
3997 repository.setLayout( interpolatedTrimmed( parser.nextText(), "layout" ) );
3998 }
3999 else
4000 {
4001 checkUnknownElement( parser, strict );
4002 }
4003 }
4004 return repository;
4005 }
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017 private RepositoryBase parseRepositoryBase( XmlPullParser parser, boolean strict, InputSource source )
4018 throws IOException, XmlPullParserException
4019 {
4020 String tagName = parser.getName();
4021 RepositoryBase repositoryBase = new RepositoryBase();
4022 InputLocation _location;
4023 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4024 repositoryBase.setLocation( "", _location );
4025 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4026 {
4027 String name = parser.getAttributeName( i );
4028 String value = parser.getAttributeValue( i );
4029
4030 if ( name.indexOf( ':' ) >= 0 )
4031 {
4032
4033 }
4034 else
4035 {
4036 checkUnknownAttribute( parser, name, tagName, strict );
4037 }
4038 }
4039 java.util.Set parsed = new java.util.HashSet();
4040 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4041 {
4042 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
4043 {
4044 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4045 repositoryBase.setLocation( "id", _location );
4046 repositoryBase.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
4047 }
4048 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
4049 {
4050 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4051 repositoryBase.setLocation( "name", _location );
4052 repositoryBase.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
4053 }
4054 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4055 {
4056 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4057 repositoryBase.setLocation( "url", _location );
4058 repositoryBase.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
4059 }
4060 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
4061 {
4062 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4063 repositoryBase.setLocation( "layout", _location );
4064 repositoryBase.setLayout( interpolatedTrimmed( parser.nextText(), "layout" ) );
4065 }
4066 else
4067 {
4068 checkUnknownElement( parser, strict );
4069 }
4070 }
4071 return repositoryBase;
4072 }
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084 private RepositoryPolicy parseRepositoryPolicy( XmlPullParser parser, boolean strict, InputSource source )
4085 throws IOException, XmlPullParserException
4086 {
4087 String tagName = parser.getName();
4088 RepositoryPolicy repositoryPolicy = new RepositoryPolicy();
4089 InputLocation _location;
4090 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4091 repositoryPolicy.setLocation( "", _location );
4092 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4093 {
4094 String name = parser.getAttributeName( i );
4095 String value = parser.getAttributeValue( i );
4096
4097 if ( name.indexOf( ':' ) >= 0 )
4098 {
4099
4100 }
4101 else
4102 {
4103 checkUnknownAttribute( parser, name, tagName, strict );
4104 }
4105 }
4106 java.util.Set parsed = new java.util.HashSet();
4107 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4108 {
4109 if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) )
4110 {
4111 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4112 repositoryPolicy.setLocation( "enabled", _location );
4113 repositoryPolicy.setEnabled( interpolatedTrimmed( parser.nextText(), "enabled" ) );
4114 }
4115 else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) )
4116 {
4117 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4118 repositoryPolicy.setLocation( "updatePolicy", _location );
4119 repositoryPolicy.setUpdatePolicy( interpolatedTrimmed( parser.nextText(), "updatePolicy" ) );
4120 }
4121 else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) )
4122 {
4123 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4124 repositoryPolicy.setLocation( "checksumPolicy", _location );
4125 repositoryPolicy.setChecksumPolicy( interpolatedTrimmed( parser.nextText(), "checksumPolicy" ) );
4126 }
4127 else
4128 {
4129 checkUnknownElement( parser, strict );
4130 }
4131 }
4132 return repositoryPolicy;
4133 }
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145 private Resource parseResource( XmlPullParser parser, boolean strict, InputSource source )
4146 throws IOException, XmlPullParserException
4147 {
4148 String tagName = parser.getName();
4149 Resource resource = new Resource();
4150 InputLocation _location;
4151 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4152 resource.setLocation( "", _location );
4153 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4154 {
4155 String name = parser.getAttributeName( i );
4156 String value = parser.getAttributeValue( i );
4157
4158 if ( name.indexOf( ':' ) >= 0 )
4159 {
4160
4161 }
4162 else
4163 {
4164 checkUnknownAttribute( parser, name, tagName, strict );
4165 }
4166 }
4167 java.util.Set parsed = new java.util.HashSet();
4168 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4169 {
4170 if ( checkFieldWithDuplicate( parser, "targetPath", null, parsed ) )
4171 {
4172 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4173 resource.setLocation( "targetPath", _location );
4174 resource.setTargetPath( interpolatedTrimmed( parser.nextText(), "targetPath" ) );
4175 }
4176 else if ( checkFieldWithDuplicate( parser, "filtering", null, parsed ) )
4177 {
4178 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4179 resource.setLocation( "filtering", _location );
4180 resource.setFiltering( interpolatedTrimmed( parser.nextText(), "filtering" ) );
4181 }
4182 else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
4183 {
4184 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4185 resource.setLocation( "directory", _location );
4186 resource.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
4187 }
4188 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
4189 {
4190 java.util.List<String> includes = new java.util.ArrayList<String>();
4191 resource.setIncludes( includes );
4192 InputLocation _locations;
4193 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4194 resource.setLocation( "includes", _locations );
4195 while ( parser.nextTag() == XmlPullParser.START_TAG )
4196 {
4197 if ( "include".equals( parser.getName() ) )
4198 {
4199 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4200 _locations.setLocation( Integer.valueOf( includes.size() ), _location );
4201 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
4202 }
4203 else
4204 {
4205 checkUnknownElement( parser, strict );
4206 }
4207 }
4208 }
4209 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
4210 {
4211 java.util.List<String> excludes = new java.util.ArrayList<String>();
4212 resource.setExcludes( excludes );
4213 InputLocation _locations;
4214 _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4215 resource.setLocation( "excludes", _locations );
4216 while ( parser.nextTag() == XmlPullParser.START_TAG )
4217 {
4218 if ( "exclude".equals( parser.getName() ) )
4219 {
4220 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4221 _locations.setLocation( Integer.valueOf( excludes.size() ), _location );
4222 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
4223 }
4224 else
4225 {
4226 checkUnknownElement( parser, strict );
4227 }
4228 }
4229 }
4230 else
4231 {
4232 checkUnknownElement( parser, strict );
4233 }
4234 }
4235 return resource;
4236 }
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248 private Scm parseScm( XmlPullParser parser, boolean strict, InputSource source )
4249 throws IOException, XmlPullParserException
4250 {
4251 String tagName = parser.getName();
4252 Scm scm = new Scm();
4253 InputLocation _location;
4254 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4255 scm.setLocation( "", _location );
4256 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4257 {
4258 String name = parser.getAttributeName( i );
4259 String value = parser.getAttributeValue( i );
4260
4261 if ( name.indexOf( ':' ) >= 0 )
4262 {
4263
4264 }
4265 else
4266 {
4267 checkUnknownAttribute( parser, name, tagName, strict );
4268 }
4269 }
4270 java.util.Set parsed = new java.util.HashSet();
4271 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4272 {
4273 if ( checkFieldWithDuplicate( parser, "connection", null, parsed ) )
4274 {
4275 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4276 scm.setLocation( "connection", _location );
4277 scm.setConnection( interpolatedTrimmed( parser.nextText(), "connection" ) );
4278 }
4279 else if ( checkFieldWithDuplicate( parser, "developerConnection", null, parsed ) )
4280 {
4281 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4282 scm.setLocation( "developerConnection", _location );
4283 scm.setDeveloperConnection( interpolatedTrimmed( parser.nextText(), "developerConnection" ) );
4284 }
4285 else if ( checkFieldWithDuplicate( parser, "tag", null, parsed ) )
4286 {
4287 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4288 scm.setLocation( "tag", _location );
4289 scm.setTag( interpolatedTrimmed( parser.nextText(), "tag" ) );
4290 }
4291 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4292 {
4293 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4294 scm.setLocation( "url", _location );
4295 scm.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
4296 }
4297 else
4298 {
4299 checkUnknownElement( parser, strict );
4300 }
4301 }
4302 return scm;
4303 }
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315 private Site parseSite( XmlPullParser parser, boolean strict, InputSource source )
4316 throws IOException, XmlPullParserException
4317 {
4318 String tagName = parser.getName();
4319 Site site = new Site();
4320 InputLocation _location;
4321 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4322 site.setLocation( "", _location );
4323 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4324 {
4325 String name = parser.getAttributeName( i );
4326 String value = parser.getAttributeValue( i );
4327
4328 if ( name.indexOf( ':' ) >= 0 )
4329 {
4330
4331 }
4332 else
4333 {
4334 checkUnknownAttribute( parser, name, tagName, strict );
4335 }
4336 }
4337 java.util.Set parsed = new java.util.HashSet();
4338 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4339 {
4340 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
4341 {
4342 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4343 site.setLocation( "id", _location );
4344 site.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
4345 }
4346 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
4347 {
4348 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4349 site.setLocation( "name", _location );
4350 site.setName( interpolatedTrimmed( parser.nextText(), "name" ) );
4351 }
4352 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4353 {
4354 _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
4355 site.setLocation( "url", _location );
4356 site.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
4357 }
4358 else
4359 {
4360 checkUnknownElement( parser, strict );
4361 }
4362 }
4363 return site;
4364 }
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376 private Model read( XmlPullParser parser, boolean strict, InputSource source )
4377 throws IOException, XmlPullParserException
4378 {
4379 Model model = null;
4380 int eventType = parser.getEventType();
4381 boolean parsed = false;
4382 while ( eventType != XmlPullParser.END_DOCUMENT )
4383 {
4384 if ( eventType == XmlPullParser.START_TAG )
4385 {
4386 if ( strict && ! "project".equals( parser.getName() ) )
4387 {
4388 throw new XmlPullParserException( "Expected root element 'project' but found '" + parser.getName() + "'", parser, null );
4389 }
4390 else if ( parsed )
4391 {
4392
4393 throw new XmlPullParserException( "Duplicated tag: 'project'", parser, null );
4394 }
4395 model = parseModel( parser, strict, source );
4396 model.setModelEncoding( parser.getInputEncoding() );
4397 parsed = true;
4398 }
4399 eventType = parser.next();
4400 }
4401 if ( parsed )
4402 {
4403 return model;
4404 }
4405 throw new XmlPullParserException( "Expected root element 'project' but found no element at all: invalid XML document", parser, null );
4406 }
4407
4408
4409
4410
4411
4412
4413 public void setAddDefaultEntities( boolean addDefaultEntities )
4414 {
4415 this.addDefaultEntities = addDefaultEntities;
4416 }
4417
4418 public static interface ContentTransformer
4419 {
4420
4421
4422
4423
4424
4425
4426
4427 String transform( String source, String fieldName );
4428 }
4429
4430 }