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