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