1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
package org.apache.maven.plugin.assembly.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.plugin.assembly.model.Component; |
20 | |
import org.apache.maven.plugin.assembly.model.ContainerDescriptorHandlerConfig; |
21 | |
import org.apache.maven.plugin.assembly.model.DependencySet; |
22 | |
import org.apache.maven.plugin.assembly.model.FileItem; |
23 | |
import org.apache.maven.plugin.assembly.model.FileSet; |
24 | |
import org.apache.maven.plugin.assembly.model.GroupVersionAlignment; |
25 | |
import org.apache.maven.plugin.assembly.model.ModuleBinaries; |
26 | |
import org.apache.maven.plugin.assembly.model.ModuleSet; |
27 | |
import org.apache.maven.plugin.assembly.model.ModuleSources; |
28 | |
import org.apache.maven.plugin.assembly.model.Repository; |
29 | |
import org.apache.maven.plugin.assembly.model.UnpackOptions; |
30 | |
import org.codehaus.plexus.util.ReaderFactory; |
31 | |
import org.codehaus.plexus.util.xml.Xpp3DomBuilder; |
32 | |
import org.codehaus.plexus.util.xml.pull.MXParser; |
33 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParser; |
34 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
@SuppressWarnings( "all" ) |
42 | 3 | public class ComponentXpp3Reader |
43 | |
{ |
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | 3 | private boolean addDefaultEntities = true; |
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed ) |
77 | |
throws XmlPullParserException |
78 | |
{ |
79 | 27 | if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) ) |
80 | |
{ |
81 | 21 | return false; |
82 | |
} |
83 | 6 | if ( !parsed.add( tagName ) ) |
84 | |
{ |
85 | 0 | throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null ); |
86 | |
} |
87 | 6 | return true; |
88 | |
} |
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict ) |
101 | |
throws XmlPullParserException, IOException |
102 | |
{ |
103 | |
|
104 | 0 | if ( strict ) |
105 | |
{ |
106 | 0 | throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null ); |
107 | |
} |
108 | 0 | } |
109 | |
|
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
private void checkUnknownElement( XmlPullParser parser, boolean strict ) |
119 | |
throws XmlPullParserException, IOException |
120 | |
{ |
121 | 0 | if ( strict ) |
122 | |
{ |
123 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
124 | |
} |
125 | |
|
126 | 0 | for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; ) |
127 | |
{ |
128 | 0 | int eventType = parser.next(); |
129 | 0 | if ( eventType == XmlPullParser.START_TAG ) |
130 | |
{ |
131 | 0 | unrecognizedTagCount++; |
132 | |
} |
133 | 0 | else if ( eventType == XmlPullParser.END_TAG ) |
134 | |
{ |
135 | 0 | unrecognizedTagCount--; |
136 | |
} |
137 | 0 | } |
138 | 0 | } |
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
public boolean getAddDefaultEntities() |
146 | |
{ |
147 | 0 | return addDefaultEntities; |
148 | |
} |
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
|
157 | |
|
158 | |
|
159 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser ) |
160 | |
throws XmlPullParserException |
161 | |
{ |
162 | 0 | return getBooleanValue( s, attribute, parser, null ); |
163 | |
} |
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
|
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue ) |
176 | |
throws XmlPullParserException |
177 | |
{ |
178 | 0 | if ( s != null && s.length() != 0 ) |
179 | |
{ |
180 | 0 | return Boolean.valueOf( s ).booleanValue(); |
181 | |
} |
182 | 0 | if ( defaultValue != null ) |
183 | |
{ |
184 | 0 | return Boolean.valueOf( defaultValue ).booleanValue(); |
185 | |
} |
186 | 0 | return false; |
187 | |
} |
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
200 | |
throws XmlPullParserException |
201 | |
{ |
202 | 0 | if ( s != null ) |
203 | |
{ |
204 | |
try |
205 | |
{ |
206 | 0 | return Byte.valueOf( s ).byteValue(); |
207 | |
} |
208 | 0 | catch ( NumberFormatException nfe ) |
209 | |
{ |
210 | 0 | if ( strict ) |
211 | |
{ |
212 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe ); |
213 | |
} |
214 | |
} |
215 | |
} |
216 | 0 | return 0; |
217 | |
} |
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
|
225 | |
|
226 | |
|
227 | |
|
228 | |
private char getCharacterValue( String s, String attribute, XmlPullParser parser ) |
229 | |
throws XmlPullParserException |
230 | |
{ |
231 | 0 | if ( s != null ) |
232 | |
{ |
233 | 0 | return s.charAt( 0 ); |
234 | |
} |
235 | 0 | return 0; |
236 | |
} |
237 | |
|
238 | |
|
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
|
245 | |
|
246 | |
|
247 | |
private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser ) |
248 | |
throws XmlPullParserException |
249 | |
{ |
250 | 0 | return getDateValue( s, attribute, null, parser ); |
251 | |
} |
252 | |
|
253 | |
|
254 | |
|
255 | |
|
256 | |
|
257 | |
|
258 | |
|
259 | |
|
260 | |
|
261 | |
|
262 | |
|
263 | |
private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser ) |
264 | |
throws XmlPullParserException |
265 | |
{ |
266 | 0 | if ( s != null ) |
267 | |
{ |
268 | 0 | String effectiveDateFormat = dateFormat; |
269 | 0 | if ( dateFormat == null ) |
270 | |
{ |
271 | 0 | effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"; |
272 | |
} |
273 | 0 | if ( "long".equals( effectiveDateFormat ) ) |
274 | |
{ |
275 | |
try |
276 | |
{ |
277 | 0 | return new java.util.Date( Long.parseLong( s ) ); |
278 | |
} |
279 | 0 | catch ( NumberFormatException e ) |
280 | |
{ |
281 | 0 | throw new XmlPullParserException( e.getMessage(), parser, e ); |
282 | |
} |
283 | |
} |
284 | |
else |
285 | |
{ |
286 | |
try |
287 | |
{ |
288 | 0 | DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US ); |
289 | 0 | return dateParser.parse( s ); |
290 | |
} |
291 | 0 | catch ( java.text.ParseException e ) |
292 | |
{ |
293 | 0 | throw new XmlPullParserException( e.getMessage(), parser, e ); |
294 | |
} |
295 | |
} |
296 | |
} |
297 | 0 | return null; |
298 | |
} |
299 | |
|
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
311 | |
throws XmlPullParserException |
312 | |
{ |
313 | 0 | if ( s != null ) |
314 | |
{ |
315 | |
try |
316 | |
{ |
317 | 0 | return Double.valueOf( s ).doubleValue(); |
318 | |
} |
319 | 0 | catch ( NumberFormatException nfe ) |
320 | |
{ |
321 | 0 | if ( strict ) |
322 | |
{ |
323 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe ); |
324 | |
} |
325 | |
} |
326 | |
} |
327 | 0 | return 0; |
328 | |
} |
329 | |
|
330 | |
|
331 | |
|
332 | |
|
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
341 | |
throws XmlPullParserException |
342 | |
{ |
343 | 0 | if ( s != null ) |
344 | |
{ |
345 | |
try |
346 | |
{ |
347 | 0 | return Float.valueOf( s ).floatValue(); |
348 | |
} |
349 | 0 | catch ( NumberFormatException nfe ) |
350 | |
{ |
351 | 0 | if ( strict ) |
352 | |
{ |
353 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe ); |
354 | |
} |
355 | |
} |
356 | |
} |
357 | 0 | return 0; |
358 | |
} |
359 | |
|
360 | |
|
361 | |
|
362 | |
|
363 | |
|
364 | |
|
365 | |
|
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
371 | |
throws XmlPullParserException |
372 | |
{ |
373 | 0 | if ( s != null ) |
374 | |
{ |
375 | |
try |
376 | |
{ |
377 | 0 | return Integer.valueOf( s ).intValue(); |
378 | |
} |
379 | 0 | catch ( NumberFormatException nfe ) |
380 | |
{ |
381 | 0 | if ( strict ) |
382 | |
{ |
383 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe ); |
384 | |
} |
385 | |
} |
386 | |
} |
387 | 0 | return 0; |
388 | |
} |
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
|
399 | |
|
400 | |
private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
401 | |
throws XmlPullParserException |
402 | |
{ |
403 | 0 | if ( s != null ) |
404 | |
{ |
405 | |
try |
406 | |
{ |
407 | 0 | return Long.valueOf( s ).longValue(); |
408 | |
} |
409 | 0 | catch ( NumberFormatException nfe ) |
410 | |
{ |
411 | 0 | if ( strict ) |
412 | |
{ |
413 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe ); |
414 | |
} |
415 | |
} |
416 | |
} |
417 | 0 | return 0; |
418 | |
} |
419 | |
|
420 | |
|
421 | |
|
422 | |
|
423 | |
|
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
|
429 | |
|
430 | |
private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
431 | |
throws XmlPullParserException |
432 | |
{ |
433 | 0 | if ( s == null ) |
434 | |
{ |
435 | 0 | if ( strict ) |
436 | |
{ |
437 | 0 | throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null ); |
438 | |
} |
439 | |
} |
440 | 0 | return s; |
441 | |
} |
442 | |
|
443 | |
|
444 | |
|
445 | |
|
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
454 | |
throws XmlPullParserException |
455 | |
{ |
456 | 0 | if ( s != null ) |
457 | |
{ |
458 | |
try |
459 | |
{ |
460 | 0 | return Short.valueOf( s ).shortValue(); |
461 | |
} |
462 | 0 | catch ( NumberFormatException nfe ) |
463 | |
{ |
464 | 0 | if ( strict ) |
465 | |
{ |
466 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe ); |
467 | |
} |
468 | |
} |
469 | |
} |
470 | 0 | return 0; |
471 | |
} |
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
|
477 | |
|
478 | |
|
479 | |
private String getTrimmedValue( String s ) |
480 | |
{ |
481 | 3 | if ( s != null ) |
482 | |
{ |
483 | 3 | s = s.trim(); |
484 | |
} |
485 | 3 | return s; |
486 | |
} |
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | |
private void initParser( XmlPullParser parser ) |
495 | |
throws XmlPullParserException |
496 | |
{ |
497 | 3 | if ( addDefaultEntities ) |
498 | |
{ |
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | 3 | parser.defineEntityReplacementText( "nbsp", "\u00a0" ); |
504 | 3 | parser.defineEntityReplacementText( "iexcl", "\u00a1" ); |
505 | 3 | parser.defineEntityReplacementText( "cent", "\u00a2" ); |
506 | 3 | parser.defineEntityReplacementText( "pound", "\u00a3" ); |
507 | 3 | parser.defineEntityReplacementText( "curren", "\u00a4" ); |
508 | 3 | parser.defineEntityReplacementText( "yen", "\u00a5" ); |
509 | 3 | parser.defineEntityReplacementText( "brvbar", "\u00a6" ); |
510 | 3 | parser.defineEntityReplacementText( "sect", "\u00a7" ); |
511 | 3 | parser.defineEntityReplacementText( "uml", "\u00a8" ); |
512 | 3 | parser.defineEntityReplacementText( "copy", "\u00a9" ); |
513 | 3 | parser.defineEntityReplacementText( "ordf", "\u00aa" ); |
514 | 3 | parser.defineEntityReplacementText( "laquo", "\u00ab" ); |
515 | 3 | parser.defineEntityReplacementText( "not", "\u00ac" ); |
516 | 3 | parser.defineEntityReplacementText( "shy", "\u00ad" ); |
517 | 3 | parser.defineEntityReplacementText( "reg", "\u00ae" ); |
518 | 3 | parser.defineEntityReplacementText( "macr", "\u00af" ); |
519 | 3 | parser.defineEntityReplacementText( "deg", "\u00b0" ); |
520 | 3 | parser.defineEntityReplacementText( "plusmn", "\u00b1" ); |
521 | 3 | parser.defineEntityReplacementText( "sup2", "\u00b2" ); |
522 | 3 | parser.defineEntityReplacementText( "sup3", "\u00b3" ); |
523 | 3 | parser.defineEntityReplacementText( "acute", "\u00b4" ); |
524 | 3 | parser.defineEntityReplacementText( "micro", "\u00b5" ); |
525 | 3 | parser.defineEntityReplacementText( "para", "\u00b6" ); |
526 | 3 | parser.defineEntityReplacementText( "middot", "\u00b7" ); |
527 | 3 | parser.defineEntityReplacementText( "cedil", "\u00b8" ); |
528 | 3 | parser.defineEntityReplacementText( "sup1", "\u00b9" ); |
529 | 3 | parser.defineEntityReplacementText( "ordm", "\u00ba" ); |
530 | 3 | parser.defineEntityReplacementText( "raquo", "\u00bb" ); |
531 | 3 | parser.defineEntityReplacementText( "frac14", "\u00bc" ); |
532 | 3 | parser.defineEntityReplacementText( "frac12", "\u00bd" ); |
533 | 3 | parser.defineEntityReplacementText( "frac34", "\u00be" ); |
534 | 3 | parser.defineEntityReplacementText( "iquest", "\u00bf" ); |
535 | 3 | parser.defineEntityReplacementText( "Agrave", "\u00c0" ); |
536 | 3 | parser.defineEntityReplacementText( "Aacute", "\u00c1" ); |
537 | 3 | parser.defineEntityReplacementText( "Acirc", "\u00c2" ); |
538 | 3 | parser.defineEntityReplacementText( "Atilde", "\u00c3" ); |
539 | 3 | parser.defineEntityReplacementText( "Auml", "\u00c4" ); |
540 | 3 | parser.defineEntityReplacementText( "Aring", "\u00c5" ); |
541 | 3 | parser.defineEntityReplacementText( "AElig", "\u00c6" ); |
542 | 3 | parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); |
543 | 3 | parser.defineEntityReplacementText( "Egrave", "\u00c8" ); |
544 | 3 | parser.defineEntityReplacementText( "Eacute", "\u00c9" ); |
545 | 3 | parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); |
546 | 3 | parser.defineEntityReplacementText( "Euml", "\u00cb" ); |
547 | 3 | parser.defineEntityReplacementText( "Igrave", "\u00cc" ); |
548 | 3 | parser.defineEntityReplacementText( "Iacute", "\u00cd" ); |
549 | 3 | parser.defineEntityReplacementText( "Icirc", "\u00ce" ); |
550 | 3 | parser.defineEntityReplacementText( "Iuml", "\u00cf" ); |
551 | 3 | parser.defineEntityReplacementText( "ETH", "\u00d0" ); |
552 | 3 | parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); |
553 | 3 | parser.defineEntityReplacementText( "Ograve", "\u00d2" ); |
554 | 3 | parser.defineEntityReplacementText( "Oacute", "\u00d3" ); |
555 | 3 | parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); |
556 | 3 | parser.defineEntityReplacementText( "Otilde", "\u00d5" ); |
557 | 3 | parser.defineEntityReplacementText( "Ouml", "\u00d6" ); |
558 | 3 | parser.defineEntityReplacementText( "times", "\u00d7" ); |
559 | 3 | parser.defineEntityReplacementText( "Oslash", "\u00d8" ); |
560 | 3 | parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); |
561 | 3 | parser.defineEntityReplacementText( "Uacute", "\u00da" ); |
562 | 3 | parser.defineEntityReplacementText( "Ucirc", "\u00db" ); |
563 | 3 | parser.defineEntityReplacementText( "Uuml", "\u00dc" ); |
564 | 3 | parser.defineEntityReplacementText( "Yacute", "\u00dd" ); |
565 | 3 | parser.defineEntityReplacementText( "THORN", "\u00de" ); |
566 | 3 | parser.defineEntityReplacementText( "szlig", "\u00df" ); |
567 | 3 | parser.defineEntityReplacementText( "agrave", "\u00e0" ); |
568 | 3 | parser.defineEntityReplacementText( "aacute", "\u00e1" ); |
569 | 3 | parser.defineEntityReplacementText( "acirc", "\u00e2" ); |
570 | 3 | parser.defineEntityReplacementText( "atilde", "\u00e3" ); |
571 | 3 | parser.defineEntityReplacementText( "auml", "\u00e4" ); |
572 | 3 | parser.defineEntityReplacementText( "aring", "\u00e5" ); |
573 | 3 | parser.defineEntityReplacementText( "aelig", "\u00e6" ); |
574 | 3 | parser.defineEntityReplacementText( "ccedil", "\u00e7" ); |
575 | 3 | parser.defineEntityReplacementText( "egrave", "\u00e8" ); |
576 | 3 | parser.defineEntityReplacementText( "eacute", "\u00e9" ); |
577 | 3 | parser.defineEntityReplacementText( "ecirc", "\u00ea" ); |
578 | 3 | parser.defineEntityReplacementText( "euml", "\u00eb" ); |
579 | 3 | parser.defineEntityReplacementText( "igrave", "\u00ec" ); |
580 | 3 | parser.defineEntityReplacementText( "iacute", "\u00ed" ); |
581 | 3 | parser.defineEntityReplacementText( "icirc", "\u00ee" ); |
582 | 3 | parser.defineEntityReplacementText( "iuml", "\u00ef" ); |
583 | 3 | parser.defineEntityReplacementText( "eth", "\u00f0" ); |
584 | 3 | parser.defineEntityReplacementText( "ntilde", "\u00f1" ); |
585 | 3 | parser.defineEntityReplacementText( "ograve", "\u00f2" ); |
586 | 3 | parser.defineEntityReplacementText( "oacute", "\u00f3" ); |
587 | 3 | parser.defineEntityReplacementText( "ocirc", "\u00f4" ); |
588 | 3 | parser.defineEntityReplacementText( "otilde", "\u00f5" ); |
589 | 3 | parser.defineEntityReplacementText( "ouml", "\u00f6" ); |
590 | 3 | parser.defineEntityReplacementText( "divide", "\u00f7" ); |
591 | 3 | parser.defineEntityReplacementText( "oslash", "\u00f8" ); |
592 | 3 | parser.defineEntityReplacementText( "ugrave", "\u00f9" ); |
593 | 3 | parser.defineEntityReplacementText( "uacute", "\u00fa" ); |
594 | 3 | parser.defineEntityReplacementText( "ucirc", "\u00fb" ); |
595 | 3 | parser.defineEntityReplacementText( "uuml", "\u00fc" ); |
596 | 3 | parser.defineEntityReplacementText( "yacute", "\u00fd" ); |
597 | 3 | parser.defineEntityReplacementText( "thorn", "\u00fe" ); |
598 | 3 | parser.defineEntityReplacementText( "yuml", "\u00ff" ); |
599 | |
|
600 | |
|
601 | |
|
602 | |
|
603 | |
|
604 | 3 | parser.defineEntityReplacementText( "OElig", "\u0152" ); |
605 | 3 | parser.defineEntityReplacementText( "oelig", "\u0153" ); |
606 | 3 | parser.defineEntityReplacementText( "Scaron", "\u0160" ); |
607 | 3 | parser.defineEntityReplacementText( "scaron", "\u0161" ); |
608 | 3 | parser.defineEntityReplacementText( "Yuml", "\u0178" ); |
609 | 3 | parser.defineEntityReplacementText( "circ", "\u02c6" ); |
610 | 3 | parser.defineEntityReplacementText( "tilde", "\u02dc" ); |
611 | 3 | parser.defineEntityReplacementText( "ensp", "\u2002" ); |
612 | 3 | parser.defineEntityReplacementText( "emsp", "\u2003" ); |
613 | 3 | parser.defineEntityReplacementText( "thinsp", "\u2009" ); |
614 | 3 | parser.defineEntityReplacementText( "zwnj", "\u200c" ); |
615 | 3 | parser.defineEntityReplacementText( "zwj", "\u200d" ); |
616 | 3 | parser.defineEntityReplacementText( "lrm", "\u200e" ); |
617 | 3 | parser.defineEntityReplacementText( "rlm", "\u200f" ); |
618 | 3 | parser.defineEntityReplacementText( "ndash", "\u2013" ); |
619 | 3 | parser.defineEntityReplacementText( "mdash", "\u2014" ); |
620 | 3 | parser.defineEntityReplacementText( "lsquo", "\u2018" ); |
621 | 3 | parser.defineEntityReplacementText( "rsquo", "\u2019" ); |
622 | 3 | parser.defineEntityReplacementText( "sbquo", "\u201a" ); |
623 | 3 | parser.defineEntityReplacementText( "ldquo", "\u201c" ); |
624 | 3 | parser.defineEntityReplacementText( "rdquo", "\u201d" ); |
625 | 3 | parser.defineEntityReplacementText( "bdquo", "\u201e" ); |
626 | 3 | parser.defineEntityReplacementText( "dagger", "\u2020" ); |
627 | 3 | parser.defineEntityReplacementText( "Dagger", "\u2021" ); |
628 | 3 | parser.defineEntityReplacementText( "permil", "\u2030" ); |
629 | 3 | parser.defineEntityReplacementText( "lsaquo", "\u2039" ); |
630 | 3 | parser.defineEntityReplacementText( "rsaquo", "\u203a" ); |
631 | 3 | parser.defineEntityReplacementText( "euro", "\u20ac" ); |
632 | |
|
633 | |
|
634 | |
|
635 | |
|
636 | |
|
637 | 3 | parser.defineEntityReplacementText( "fnof", "\u0192" ); |
638 | 3 | parser.defineEntityReplacementText( "Alpha", "\u0391" ); |
639 | 3 | parser.defineEntityReplacementText( "Beta", "\u0392" ); |
640 | 3 | parser.defineEntityReplacementText( "Gamma", "\u0393" ); |
641 | 3 | parser.defineEntityReplacementText( "Delta", "\u0394" ); |
642 | 3 | parser.defineEntityReplacementText( "Epsilon", "\u0395" ); |
643 | 3 | parser.defineEntityReplacementText( "Zeta", "\u0396" ); |
644 | 3 | parser.defineEntityReplacementText( "Eta", "\u0397" ); |
645 | 3 | parser.defineEntityReplacementText( "Theta", "\u0398" ); |
646 | 3 | parser.defineEntityReplacementText( "Iota", "\u0399" ); |
647 | 3 | parser.defineEntityReplacementText( "Kappa", "\u039a" ); |
648 | 3 | parser.defineEntityReplacementText( "Lambda", "\u039b" ); |
649 | 3 | parser.defineEntityReplacementText( "Mu", "\u039c" ); |
650 | 3 | parser.defineEntityReplacementText( "Nu", "\u039d" ); |
651 | 3 | parser.defineEntityReplacementText( "Xi", "\u039e" ); |
652 | 3 | parser.defineEntityReplacementText( "Omicron", "\u039f" ); |
653 | 3 | parser.defineEntityReplacementText( "Pi", "\u03a0" ); |
654 | 3 | parser.defineEntityReplacementText( "Rho", "\u03a1" ); |
655 | 3 | parser.defineEntityReplacementText( "Sigma", "\u03a3" ); |
656 | 3 | parser.defineEntityReplacementText( "Tau", "\u03a4" ); |
657 | 3 | parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); |
658 | 3 | parser.defineEntityReplacementText( "Phi", "\u03a6" ); |
659 | 3 | parser.defineEntityReplacementText( "Chi", "\u03a7" ); |
660 | 3 | parser.defineEntityReplacementText( "Psi", "\u03a8" ); |
661 | 3 | parser.defineEntityReplacementText( "Omega", "\u03a9" ); |
662 | 3 | parser.defineEntityReplacementText( "alpha", "\u03b1" ); |
663 | 3 | parser.defineEntityReplacementText( "beta", "\u03b2" ); |
664 | 3 | parser.defineEntityReplacementText( "gamma", "\u03b3" ); |
665 | 3 | parser.defineEntityReplacementText( "delta", "\u03b4" ); |
666 | 3 | parser.defineEntityReplacementText( "epsilon", "\u03b5" ); |
667 | 3 | parser.defineEntityReplacementText( "zeta", "\u03b6" ); |
668 | 3 | parser.defineEntityReplacementText( "eta", "\u03b7" ); |
669 | 3 | parser.defineEntityReplacementText( "theta", "\u03b8" ); |
670 | 3 | parser.defineEntityReplacementText( "iota", "\u03b9" ); |
671 | 3 | parser.defineEntityReplacementText( "kappa", "\u03ba" ); |
672 | 3 | parser.defineEntityReplacementText( "lambda", "\u03bb" ); |
673 | 3 | parser.defineEntityReplacementText( "mu", "\u03bc" ); |
674 | 3 | parser.defineEntityReplacementText( "nu", "\u03bd" ); |
675 | 3 | parser.defineEntityReplacementText( "xi", "\u03be" ); |
676 | 3 | parser.defineEntityReplacementText( "omicron", "\u03bf" ); |
677 | 3 | parser.defineEntityReplacementText( "pi", "\u03c0" ); |
678 | 3 | parser.defineEntityReplacementText( "rho", "\u03c1" ); |
679 | 3 | parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); |
680 | 3 | parser.defineEntityReplacementText( "sigma", "\u03c3" ); |
681 | 3 | parser.defineEntityReplacementText( "tau", "\u03c4" ); |
682 | 3 | parser.defineEntityReplacementText( "upsilon", "\u03c5" ); |
683 | 3 | parser.defineEntityReplacementText( "phi", "\u03c6" ); |
684 | 3 | parser.defineEntityReplacementText( "chi", "\u03c7" ); |
685 | 3 | parser.defineEntityReplacementText( "psi", "\u03c8" ); |
686 | 3 | parser.defineEntityReplacementText( "omega", "\u03c9" ); |
687 | 3 | parser.defineEntityReplacementText( "thetasym", "\u03d1" ); |
688 | 3 | parser.defineEntityReplacementText( "upsih", "\u03d2" ); |
689 | 3 | parser.defineEntityReplacementText( "piv", "\u03d6" ); |
690 | 3 | parser.defineEntityReplacementText( "bull", "\u2022" ); |
691 | 3 | parser.defineEntityReplacementText( "hellip", "\u2026" ); |
692 | 3 | parser.defineEntityReplacementText( "prime", "\u2032" ); |
693 | 3 | parser.defineEntityReplacementText( "Prime", "\u2033" ); |
694 | 3 | parser.defineEntityReplacementText( "oline", "\u203e" ); |
695 | 3 | parser.defineEntityReplacementText( "frasl", "\u2044" ); |
696 | 3 | parser.defineEntityReplacementText( "weierp", "\u2118" ); |
697 | 3 | parser.defineEntityReplacementText( "image", "\u2111" ); |
698 | 3 | parser.defineEntityReplacementText( "real", "\u211c" ); |
699 | 3 | parser.defineEntityReplacementText( "trade", "\u2122" ); |
700 | 3 | parser.defineEntityReplacementText( "alefsym", "\u2135" ); |
701 | 3 | parser.defineEntityReplacementText( "larr", "\u2190" ); |
702 | 3 | parser.defineEntityReplacementText( "uarr", "\u2191" ); |
703 | 3 | parser.defineEntityReplacementText( "rarr", "\u2192" ); |
704 | 3 | parser.defineEntityReplacementText( "darr", "\u2193" ); |
705 | 3 | parser.defineEntityReplacementText( "harr", "\u2194" ); |
706 | 3 | parser.defineEntityReplacementText( "crarr", "\u21b5" ); |
707 | 3 | parser.defineEntityReplacementText( "lArr", "\u21d0" ); |
708 | 3 | parser.defineEntityReplacementText( "uArr", "\u21d1" ); |
709 | 3 | parser.defineEntityReplacementText( "rArr", "\u21d2" ); |
710 | 3 | parser.defineEntityReplacementText( "dArr", "\u21d3" ); |
711 | 3 | parser.defineEntityReplacementText( "hArr", "\u21d4" ); |
712 | 3 | parser.defineEntityReplacementText( "forall", "\u2200" ); |
713 | 3 | parser.defineEntityReplacementText( "part", "\u2202" ); |
714 | 3 | parser.defineEntityReplacementText( "exist", "\u2203" ); |
715 | 3 | parser.defineEntityReplacementText( "empty", "\u2205" ); |
716 | 3 | parser.defineEntityReplacementText( "nabla", "\u2207" ); |
717 | 3 | parser.defineEntityReplacementText( "isin", "\u2208" ); |
718 | 3 | parser.defineEntityReplacementText( "notin", "\u2209" ); |
719 | 3 | parser.defineEntityReplacementText( "ni", "\u220b" ); |
720 | 3 | parser.defineEntityReplacementText( "prod", "\u220f" ); |
721 | 3 | parser.defineEntityReplacementText( "sum", "\u2211" ); |
722 | 3 | parser.defineEntityReplacementText( "minus", "\u2212" ); |
723 | 3 | parser.defineEntityReplacementText( "lowast", "\u2217" ); |
724 | 3 | parser.defineEntityReplacementText( "radic", "\u221a" ); |
725 | 3 | parser.defineEntityReplacementText( "prop", "\u221d" ); |
726 | 3 | parser.defineEntityReplacementText( "infin", "\u221e" ); |
727 | 3 | parser.defineEntityReplacementText( "ang", "\u2220" ); |
728 | 3 | parser.defineEntityReplacementText( "and", "\u2227" ); |
729 | 3 | parser.defineEntityReplacementText( "or", "\u2228" ); |
730 | 3 | parser.defineEntityReplacementText( "cap", "\u2229" ); |
731 | 3 | parser.defineEntityReplacementText( "cup", "\u222a" ); |
732 | 3 | parser.defineEntityReplacementText( "int", "\u222b" ); |
733 | 3 | parser.defineEntityReplacementText( "there4", "\u2234" ); |
734 | 3 | parser.defineEntityReplacementText( "sim", "\u223c" ); |
735 | 3 | parser.defineEntityReplacementText( "cong", "\u2245" ); |
736 | 3 | parser.defineEntityReplacementText( "asymp", "\u2248" ); |
737 | 3 | parser.defineEntityReplacementText( "ne", "\u2260" ); |
738 | 3 | parser.defineEntityReplacementText( "equiv", "\u2261" ); |
739 | 3 | parser.defineEntityReplacementText( "le", "\u2264" ); |
740 | 3 | parser.defineEntityReplacementText( "ge", "\u2265" ); |
741 | 3 | parser.defineEntityReplacementText( "sub", "\u2282" ); |
742 | 3 | parser.defineEntityReplacementText( "sup", "\u2283" ); |
743 | 3 | parser.defineEntityReplacementText( "nsub", "\u2284" ); |
744 | 3 | parser.defineEntityReplacementText( "sube", "\u2286" ); |
745 | 3 | parser.defineEntityReplacementText( "supe", "\u2287" ); |
746 | 3 | parser.defineEntityReplacementText( "oplus", "\u2295" ); |
747 | 3 | parser.defineEntityReplacementText( "otimes", "\u2297" ); |
748 | 3 | parser.defineEntityReplacementText( "perp", "\u22a5" ); |
749 | 3 | parser.defineEntityReplacementText( "sdot", "\u22c5" ); |
750 | 3 | parser.defineEntityReplacementText( "lceil", "\u2308" ); |
751 | 3 | parser.defineEntityReplacementText( "rceil", "\u2309" ); |
752 | 3 | parser.defineEntityReplacementText( "lfloor", "\u230a" ); |
753 | 3 | parser.defineEntityReplacementText( "rfloor", "\u230b" ); |
754 | 3 | parser.defineEntityReplacementText( "lang", "\u2329" ); |
755 | 3 | parser.defineEntityReplacementText( "rang", "\u232a" ); |
756 | 3 | parser.defineEntityReplacementText( "loz", "\u25ca" ); |
757 | 3 | parser.defineEntityReplacementText( "spades", "\u2660" ); |
758 | 3 | parser.defineEntityReplacementText( "clubs", "\u2663" ); |
759 | 3 | parser.defineEntityReplacementText( "hearts", "\u2665" ); |
760 | 3 | parser.defineEntityReplacementText( "diams", "\u2666" ); |
761 | |
|
762 | |
} |
763 | 3 | } |
764 | |
|
765 | |
|
766 | |
|
767 | |
|
768 | |
|
769 | |
|
770 | |
|
771 | |
|
772 | |
|
773 | |
private int nextTag( XmlPullParser parser ) |
774 | |
throws IOException, XmlPullParserException |
775 | |
{ |
776 | 0 | int eventType = parser.next(); |
777 | 0 | if ( eventType == XmlPullParser.TEXT ) |
778 | |
{ |
779 | 0 | eventType = parser.next(); |
780 | |
} |
781 | 0 | if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG ) |
782 | |
{ |
783 | 0 | throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null ); |
784 | |
} |
785 | 0 | return eventType; |
786 | |
} |
787 | |
|
788 | |
|
789 | |
|
790 | |
|
791 | |
|
792 | |
|
793 | |
|
794 | |
|
795 | |
|
796 | |
|
797 | |
private Component parseComponent( XmlPullParser parser, boolean strict ) |
798 | |
throws IOException, XmlPullParserException |
799 | |
{ |
800 | 3 | String tagName = parser.getName(); |
801 | 3 | Component component = new Component(); |
802 | 3 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
803 | |
{ |
804 | 0 | String name = parser.getAttributeName( i ); |
805 | 0 | String value = parser.getAttributeValue( i ); |
806 | |
|
807 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
808 | |
{ |
809 | |
|
810 | |
} |
811 | 0 | else if ( "xmlns".equals( name ) ) |
812 | |
{ |
813 | |
|
814 | |
} |
815 | |
else |
816 | |
{ |
817 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
818 | |
} |
819 | |
} |
820 | 3 | java.util.Set parsed = new java.util.HashSet(); |
821 | 6 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
822 | |
{ |
823 | 3 | if ( checkFieldWithDuplicate( parser, "moduleSets", null, parsed ) ) |
824 | |
{ |
825 | 0 | java.util.List moduleSets = new java.util.ArrayList(); |
826 | 0 | component.setModuleSets( moduleSets ); |
827 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
828 | |
{ |
829 | 0 | if ( "moduleSet".equals( parser.getName() ) ) |
830 | |
{ |
831 | 0 | moduleSets.add( parseModuleSet( parser, strict ) ); |
832 | |
} |
833 | |
else |
834 | |
{ |
835 | 0 | checkUnknownElement( parser, strict ); |
836 | |
} |
837 | |
} |
838 | 0 | } |
839 | 3 | else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) ) |
840 | |
{ |
841 | 3 | java.util.List fileSets = new java.util.ArrayList(); |
842 | 3 | component.setFileSets( fileSets ); |
843 | 6 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
844 | |
{ |
845 | 3 | if ( "fileSet".equals( parser.getName() ) ) |
846 | |
{ |
847 | 3 | fileSets.add( parseFileSet( parser, strict ) ); |
848 | |
} |
849 | |
else |
850 | |
{ |
851 | 0 | checkUnknownElement( parser, strict ); |
852 | |
} |
853 | |
} |
854 | 3 | } |
855 | 0 | else if ( checkFieldWithDuplicate( parser, "files", null, parsed ) ) |
856 | |
{ |
857 | 0 | java.util.List files = new java.util.ArrayList(); |
858 | 0 | component.setFiles( files ); |
859 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
860 | |
{ |
861 | 0 | if ( "file".equals( parser.getName() ) ) |
862 | |
{ |
863 | 0 | files.add( parseFileItem( parser, strict ) ); |
864 | |
} |
865 | |
else |
866 | |
{ |
867 | 0 | checkUnknownElement( parser, strict ); |
868 | |
} |
869 | |
} |
870 | 0 | } |
871 | 0 | else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) ) |
872 | |
{ |
873 | 0 | java.util.List dependencySets = new java.util.ArrayList(); |
874 | 0 | component.setDependencySets( dependencySets ); |
875 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
876 | |
{ |
877 | 0 | if ( "dependencySet".equals( parser.getName() ) ) |
878 | |
{ |
879 | 0 | dependencySets.add( parseDependencySet( parser, strict ) ); |
880 | |
} |
881 | |
else |
882 | |
{ |
883 | 0 | checkUnknownElement( parser, strict ); |
884 | |
} |
885 | |
} |
886 | 0 | } |
887 | 0 | else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) ) |
888 | |
{ |
889 | 0 | java.util.List repositories = new java.util.ArrayList(); |
890 | 0 | component.setRepositories( repositories ); |
891 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
892 | |
{ |
893 | 0 | if ( "repository".equals( parser.getName() ) ) |
894 | |
{ |
895 | 0 | repositories.add( parseRepository( parser, strict ) ); |
896 | |
} |
897 | |
else |
898 | |
{ |
899 | 0 | checkUnknownElement( parser, strict ); |
900 | |
} |
901 | |
} |
902 | 0 | } |
903 | 0 | else if ( checkFieldWithDuplicate( parser, "containerDescriptorHandlers", null, parsed ) ) |
904 | |
{ |
905 | 0 | java.util.List containerDescriptorHandlers = new java.util.ArrayList(); |
906 | 0 | component.setContainerDescriptorHandlers( containerDescriptorHandlers ); |
907 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
908 | |
{ |
909 | 0 | if ( "containerDescriptorHandler".equals( parser.getName() ) ) |
910 | |
{ |
911 | 0 | containerDescriptorHandlers.add( parseContainerDescriptorHandlerConfig( parser, strict ) ); |
912 | |
} |
913 | |
else |
914 | |
{ |
915 | 0 | checkUnknownElement( parser, strict ); |
916 | |
} |
917 | |
} |
918 | 0 | } |
919 | |
else |
920 | |
{ |
921 | 0 | checkUnknownElement( parser, strict ); |
922 | |
} |
923 | |
} |
924 | 3 | return component; |
925 | |
} |
926 | |
|
927 | |
|
928 | |
|
929 | |
|
930 | |
|
931 | |
|
932 | |
|
933 | |
|
934 | |
|
935 | |
|
936 | |
private ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser parser, boolean strict ) |
937 | |
throws IOException, XmlPullParserException |
938 | |
{ |
939 | 0 | String tagName = parser.getName(); |
940 | 0 | ContainerDescriptorHandlerConfig containerDescriptorHandlerConfig = new ContainerDescriptorHandlerConfig(); |
941 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
942 | |
{ |
943 | 0 | String name = parser.getAttributeName( i ); |
944 | 0 | String value = parser.getAttributeValue( i ); |
945 | |
|
946 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
947 | |
{ |
948 | |
|
949 | |
} |
950 | |
else |
951 | |
{ |
952 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
953 | |
} |
954 | |
} |
955 | 0 | java.util.Set parsed = new java.util.HashSet(); |
956 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
957 | |
{ |
958 | 0 | if ( checkFieldWithDuplicate( parser, "handlerName", null, parsed ) ) |
959 | |
{ |
960 | 0 | containerDescriptorHandlerConfig.setHandlerName( getTrimmedValue( parser.nextText() ) ); |
961 | |
} |
962 | 0 | else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) ) |
963 | |
{ |
964 | 0 | containerDescriptorHandlerConfig.setConfiguration( Xpp3DomBuilder.build( parser ) ); |
965 | |
} |
966 | |
else |
967 | |
{ |
968 | 0 | checkUnknownElement( parser, strict ); |
969 | |
} |
970 | |
} |
971 | 0 | return containerDescriptorHandlerConfig; |
972 | |
} |
973 | |
|
974 | |
|
975 | |
|
976 | |
|
977 | |
|
978 | |
|
979 | |
|
980 | |
|
981 | |
|
982 | |
|
983 | |
private DependencySet parseDependencySet( XmlPullParser parser, boolean strict ) |
984 | |
throws IOException, XmlPullParserException |
985 | |
{ |
986 | 0 | String tagName = parser.getName(); |
987 | 0 | DependencySet dependencySet = new DependencySet(); |
988 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
989 | |
{ |
990 | 0 | String name = parser.getAttributeName( i ); |
991 | 0 | String value = parser.getAttributeValue( i ); |
992 | |
|
993 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
994 | |
{ |
995 | |
|
996 | |
} |
997 | |
else |
998 | |
{ |
999 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1000 | |
} |
1001 | |
} |
1002 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1003 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1004 | |
{ |
1005 | 0 | if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1006 | |
{ |
1007 | 0 | dependencySet.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1008 | |
} |
1009 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1010 | |
{ |
1011 | 0 | java.util.List includes = new java.util.ArrayList(); |
1012 | 0 | dependencySet.setIncludes( includes ); |
1013 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1014 | |
{ |
1015 | 0 | if ( "include".equals( parser.getName() ) ) |
1016 | |
{ |
1017 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1018 | |
} |
1019 | |
else |
1020 | |
{ |
1021 | 0 | checkUnknownElement( parser, strict ); |
1022 | |
} |
1023 | |
} |
1024 | 0 | } |
1025 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1026 | |
{ |
1027 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1028 | 0 | dependencySet.setExcludes( excludes ); |
1029 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1030 | |
{ |
1031 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1032 | |
{ |
1033 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1034 | |
} |
1035 | |
else |
1036 | |
{ |
1037 | 0 | checkUnknownElement( parser, strict ); |
1038 | |
} |
1039 | |
} |
1040 | 0 | } |
1041 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1042 | |
{ |
1043 | 0 | dependencySet.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1044 | |
} |
1045 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1046 | |
{ |
1047 | 0 | dependencySet.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1048 | |
} |
1049 | 0 | else if ( checkFieldWithDuplicate( parser, "useStrictFiltering", null, parsed ) ) |
1050 | |
{ |
1051 | 0 | dependencySet.setUseStrictFiltering( getBooleanValue( getTrimmedValue( parser.nextText() ), "useStrictFiltering", parser, "false" ) ); |
1052 | |
} |
1053 | 0 | else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) ) |
1054 | |
{ |
1055 | 0 | dependencySet.setOutputFileNameMapping( getTrimmedValue( parser.nextText() ) ); |
1056 | |
} |
1057 | 0 | else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) ) |
1058 | |
{ |
1059 | 0 | dependencySet.setUnpack( getBooleanValue( getTrimmedValue( parser.nextText() ), "unpack", parser, "false" ) ); |
1060 | |
} |
1061 | 0 | else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) ) |
1062 | |
{ |
1063 | 0 | dependencySet.setUnpackOptions( parseUnpackOptions( parser, strict ) ); |
1064 | |
} |
1065 | 0 | else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) ) |
1066 | |
{ |
1067 | 0 | dependencySet.setScope( getTrimmedValue( parser.nextText() ) ); |
1068 | |
} |
1069 | 0 | else if ( checkFieldWithDuplicate( parser, "useProjectArtifact", null, parsed ) ) |
1070 | |
{ |
1071 | 0 | dependencySet.setUseProjectArtifact( getBooleanValue( getTrimmedValue( parser.nextText() ), "useProjectArtifact", parser, "true" ) ); |
1072 | |
} |
1073 | 0 | else if ( checkFieldWithDuplicate( parser, "useProjectAttachments", null, parsed ) ) |
1074 | |
{ |
1075 | 0 | dependencySet.setUseProjectAttachments( getBooleanValue( getTrimmedValue( parser.nextText() ), "useProjectAttachments", parser, "false" ) ); |
1076 | |
} |
1077 | 0 | else if ( checkFieldWithDuplicate( parser, "useTransitiveDependencies", null, parsed ) ) |
1078 | |
{ |
1079 | 0 | dependencySet.setUseTransitiveDependencies( getBooleanValue( getTrimmedValue( parser.nextText() ), "useTransitiveDependencies", parser, "true" ) ); |
1080 | |
} |
1081 | 0 | else if ( checkFieldWithDuplicate( parser, "useTransitiveFiltering", null, parsed ) ) |
1082 | |
{ |
1083 | 0 | dependencySet.setUseTransitiveFiltering( getBooleanValue( getTrimmedValue( parser.nextText() ), "useTransitiveFiltering", parser, "false" ) ); |
1084 | |
} |
1085 | |
else |
1086 | |
{ |
1087 | 0 | checkUnknownElement( parser, strict ); |
1088 | |
} |
1089 | |
} |
1090 | 0 | return dependencySet; |
1091 | |
} |
1092 | |
|
1093 | |
|
1094 | |
|
1095 | |
|
1096 | |
|
1097 | |
|
1098 | |
|
1099 | |
|
1100 | |
|
1101 | |
|
1102 | |
private FileItem parseFileItem( XmlPullParser parser, boolean strict ) |
1103 | |
throws IOException, XmlPullParserException |
1104 | |
{ |
1105 | 0 | String tagName = parser.getName(); |
1106 | 0 | FileItem fileItem = new FileItem(); |
1107 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1108 | |
{ |
1109 | 0 | String name = parser.getAttributeName( i ); |
1110 | 0 | String value = parser.getAttributeValue( i ); |
1111 | |
|
1112 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1113 | |
{ |
1114 | |
|
1115 | |
} |
1116 | |
else |
1117 | |
{ |
1118 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1119 | |
} |
1120 | |
} |
1121 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1122 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1123 | |
{ |
1124 | 0 | if ( checkFieldWithDuplicate( parser, "source", null, parsed ) ) |
1125 | |
{ |
1126 | 0 | fileItem.setSource( getTrimmedValue( parser.nextText() ) ); |
1127 | |
} |
1128 | 0 | else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1129 | |
{ |
1130 | 0 | fileItem.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1131 | |
} |
1132 | 0 | else if ( checkFieldWithDuplicate( parser, "destName", null, parsed ) ) |
1133 | |
{ |
1134 | 0 | fileItem.setDestName( getTrimmedValue( parser.nextText() ) ); |
1135 | |
} |
1136 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1137 | |
{ |
1138 | 0 | fileItem.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1139 | |
} |
1140 | 0 | else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) ) |
1141 | |
{ |
1142 | 0 | fileItem.setLineEnding( getTrimmedValue( parser.nextText() ) ); |
1143 | |
} |
1144 | 0 | else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) ) |
1145 | |
{ |
1146 | 0 | fileItem.setFiltered( getBooleanValue( getTrimmedValue( parser.nextText() ), "filtered", parser, "false" ) ); |
1147 | |
} |
1148 | |
else |
1149 | |
{ |
1150 | 0 | checkUnknownElement( parser, strict ); |
1151 | |
} |
1152 | |
} |
1153 | 0 | return fileItem; |
1154 | |
} |
1155 | |
|
1156 | |
|
1157 | |
|
1158 | |
|
1159 | |
|
1160 | |
|
1161 | |
|
1162 | |
|
1163 | |
|
1164 | |
|
1165 | |
private FileSet parseFileSet( XmlPullParser parser, boolean strict ) |
1166 | |
throws IOException, XmlPullParserException |
1167 | |
{ |
1168 | 3 | String tagName = parser.getName(); |
1169 | 3 | FileSet fileSet = new FileSet(); |
1170 | 3 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1171 | |
{ |
1172 | 0 | String name = parser.getAttributeName( i ); |
1173 | 0 | String value = parser.getAttributeValue( i ); |
1174 | |
|
1175 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1176 | |
{ |
1177 | |
|
1178 | |
} |
1179 | |
else |
1180 | |
{ |
1181 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1182 | |
} |
1183 | |
} |
1184 | 3 | java.util.Set parsed = new java.util.HashSet(); |
1185 | 6 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1186 | |
{ |
1187 | 3 | if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) ) |
1188 | |
{ |
1189 | 0 | fileSet.setUseDefaultExcludes( getBooleanValue( getTrimmedValue( parser.nextText() ), "useDefaultExcludes", parser, "true" ) ); |
1190 | |
} |
1191 | 3 | else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1192 | |
{ |
1193 | 0 | fileSet.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1194 | |
} |
1195 | 3 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1196 | |
{ |
1197 | 0 | java.util.List includes = new java.util.ArrayList(); |
1198 | 0 | fileSet.setIncludes( includes ); |
1199 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1200 | |
{ |
1201 | 0 | if ( "include".equals( parser.getName() ) ) |
1202 | |
{ |
1203 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1204 | |
} |
1205 | |
else |
1206 | |
{ |
1207 | 0 | checkUnknownElement( parser, strict ); |
1208 | |
} |
1209 | |
} |
1210 | 0 | } |
1211 | 3 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1212 | |
{ |
1213 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1214 | 0 | fileSet.setExcludes( excludes ); |
1215 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1216 | |
{ |
1217 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1218 | |
{ |
1219 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1220 | |
} |
1221 | |
else |
1222 | |
{ |
1223 | 0 | checkUnknownElement( parser, strict ); |
1224 | |
} |
1225 | |
} |
1226 | 0 | } |
1227 | 3 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1228 | |
{ |
1229 | 0 | fileSet.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1230 | |
} |
1231 | 3 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1232 | |
{ |
1233 | 0 | fileSet.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1234 | |
} |
1235 | 3 | else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) ) |
1236 | |
{ |
1237 | 3 | fileSet.setDirectory( getTrimmedValue( parser.nextText() ) ); |
1238 | |
} |
1239 | 0 | else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) ) |
1240 | |
{ |
1241 | 0 | fileSet.setLineEnding( getTrimmedValue( parser.nextText() ) ); |
1242 | |
} |
1243 | 0 | else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) ) |
1244 | |
{ |
1245 | 0 | fileSet.setFiltered( getBooleanValue( getTrimmedValue( parser.nextText() ), "filtered", parser, "false" ) ); |
1246 | |
} |
1247 | |
else |
1248 | |
{ |
1249 | 0 | checkUnknownElement( parser, strict ); |
1250 | |
} |
1251 | |
} |
1252 | 3 | return fileSet; |
1253 | |
} |
1254 | |
|
1255 | |
|
1256 | |
|
1257 | |
|
1258 | |
|
1259 | |
|
1260 | |
|
1261 | |
|
1262 | |
|
1263 | |
|
1264 | |
private GroupVersionAlignment parseGroupVersionAlignment( XmlPullParser parser, boolean strict ) |
1265 | |
throws IOException, XmlPullParserException |
1266 | |
{ |
1267 | 0 | String tagName = parser.getName(); |
1268 | 0 | GroupVersionAlignment groupVersionAlignment = new GroupVersionAlignment(); |
1269 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1270 | |
{ |
1271 | 0 | String name = parser.getAttributeName( i ); |
1272 | 0 | String value = parser.getAttributeValue( i ); |
1273 | |
|
1274 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1275 | |
{ |
1276 | |
|
1277 | |
} |
1278 | |
else |
1279 | |
{ |
1280 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1281 | |
} |
1282 | |
} |
1283 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1284 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1285 | |
{ |
1286 | 0 | if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
1287 | |
{ |
1288 | 0 | groupVersionAlignment.setId( getTrimmedValue( parser.nextText() ) ); |
1289 | |
} |
1290 | 0 | else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) ) |
1291 | |
{ |
1292 | 0 | groupVersionAlignment.setVersion( getTrimmedValue( parser.nextText() ) ); |
1293 | |
} |
1294 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1295 | |
{ |
1296 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1297 | 0 | groupVersionAlignment.setExcludes( excludes ); |
1298 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1299 | |
{ |
1300 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1301 | |
{ |
1302 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1303 | |
} |
1304 | |
else |
1305 | |
{ |
1306 | 0 | checkUnknownElement( parser, strict ); |
1307 | |
} |
1308 | |
} |
1309 | 0 | } |
1310 | |
else |
1311 | |
{ |
1312 | 0 | checkUnknownElement( parser, strict ); |
1313 | |
} |
1314 | |
} |
1315 | 0 | return groupVersionAlignment; |
1316 | |
} |
1317 | |
|
1318 | |
|
1319 | |
|
1320 | |
|
1321 | |
|
1322 | |
|
1323 | |
|
1324 | |
|
1325 | |
|
1326 | |
|
1327 | |
private ModuleBinaries parseModuleBinaries( XmlPullParser parser, boolean strict ) |
1328 | |
throws IOException, XmlPullParserException |
1329 | |
{ |
1330 | 0 | String tagName = parser.getName(); |
1331 | 0 | ModuleBinaries moduleBinaries = new ModuleBinaries(); |
1332 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1333 | |
{ |
1334 | 0 | String name = parser.getAttributeName( i ); |
1335 | 0 | String value = parser.getAttributeValue( i ); |
1336 | |
|
1337 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1338 | |
{ |
1339 | |
|
1340 | |
} |
1341 | |
else |
1342 | |
{ |
1343 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1344 | |
} |
1345 | |
} |
1346 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1347 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1348 | |
{ |
1349 | 0 | if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1350 | |
{ |
1351 | 0 | moduleBinaries.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1352 | |
} |
1353 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1354 | |
{ |
1355 | 0 | java.util.List includes = new java.util.ArrayList(); |
1356 | 0 | moduleBinaries.setIncludes( includes ); |
1357 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1358 | |
{ |
1359 | 0 | if ( "include".equals( parser.getName() ) ) |
1360 | |
{ |
1361 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1362 | |
} |
1363 | |
else |
1364 | |
{ |
1365 | 0 | checkUnknownElement( parser, strict ); |
1366 | |
} |
1367 | |
} |
1368 | 0 | } |
1369 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1370 | |
{ |
1371 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1372 | 0 | moduleBinaries.setExcludes( excludes ); |
1373 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1374 | |
{ |
1375 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1376 | |
{ |
1377 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1378 | |
} |
1379 | |
else |
1380 | |
{ |
1381 | 0 | checkUnknownElement( parser, strict ); |
1382 | |
} |
1383 | |
} |
1384 | 0 | } |
1385 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1386 | |
{ |
1387 | 0 | moduleBinaries.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1388 | |
} |
1389 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1390 | |
{ |
1391 | 0 | moduleBinaries.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1392 | |
} |
1393 | 0 | else if ( checkFieldWithDuplicate( parser, "attachmentClassifier", null, parsed ) ) |
1394 | |
{ |
1395 | 0 | moduleBinaries.setAttachmentClassifier( getTrimmedValue( parser.nextText() ) ); |
1396 | |
} |
1397 | 0 | else if ( checkFieldWithDuplicate( parser, "includeDependencies", null, parsed ) ) |
1398 | |
{ |
1399 | 0 | moduleBinaries.setIncludeDependencies( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeDependencies", parser, "true" ) ); |
1400 | |
} |
1401 | 0 | else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) ) |
1402 | |
{ |
1403 | 0 | java.util.List dependencySets = new java.util.ArrayList(); |
1404 | 0 | moduleBinaries.setDependencySets( dependencySets ); |
1405 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1406 | |
{ |
1407 | 0 | if ( "dependencySet".equals( parser.getName() ) ) |
1408 | |
{ |
1409 | 0 | dependencySets.add( parseDependencySet( parser, strict ) ); |
1410 | |
} |
1411 | |
else |
1412 | |
{ |
1413 | 0 | checkUnknownElement( parser, strict ); |
1414 | |
} |
1415 | |
} |
1416 | 0 | } |
1417 | 0 | else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) ) |
1418 | |
{ |
1419 | 0 | moduleBinaries.setUnpack( getBooleanValue( getTrimmedValue( parser.nextText() ), "unpack", parser, "true" ) ); |
1420 | |
} |
1421 | 0 | else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) ) |
1422 | |
{ |
1423 | 0 | moduleBinaries.setUnpackOptions( parseUnpackOptions( parser, strict ) ); |
1424 | |
} |
1425 | 0 | else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) ) |
1426 | |
{ |
1427 | 0 | moduleBinaries.setOutputFileNameMapping( getTrimmedValue( parser.nextText() ) ); |
1428 | |
} |
1429 | |
else |
1430 | |
{ |
1431 | 0 | checkUnknownElement( parser, strict ); |
1432 | |
} |
1433 | |
} |
1434 | 0 | return moduleBinaries; |
1435 | |
} |
1436 | |
|
1437 | |
|
1438 | |
|
1439 | |
|
1440 | |
|
1441 | |
|
1442 | |
|
1443 | |
|
1444 | |
|
1445 | |
|
1446 | |
private ModuleSet parseModuleSet( XmlPullParser parser, boolean strict ) |
1447 | |
throws IOException, XmlPullParserException |
1448 | |
{ |
1449 | 0 | String tagName = parser.getName(); |
1450 | 0 | ModuleSet moduleSet = new ModuleSet(); |
1451 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1452 | |
{ |
1453 | 0 | String name = parser.getAttributeName( i ); |
1454 | 0 | String value = parser.getAttributeValue( i ); |
1455 | |
|
1456 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1457 | |
{ |
1458 | |
|
1459 | |
} |
1460 | |
else |
1461 | |
{ |
1462 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1463 | |
} |
1464 | |
} |
1465 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1466 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1467 | |
{ |
1468 | 0 | if ( checkFieldWithDuplicate( parser, "useAllReactorProjects", null, parsed ) ) |
1469 | |
{ |
1470 | 0 | moduleSet.setUseAllReactorProjects( getBooleanValue( getTrimmedValue( parser.nextText() ), "useAllReactorProjects", parser, "false" ) ); |
1471 | |
} |
1472 | 0 | else if ( checkFieldWithDuplicate( parser, "includeSubModules", null, parsed ) ) |
1473 | |
{ |
1474 | 0 | moduleSet.setIncludeSubModules( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeSubModules", parser, "true" ) ); |
1475 | |
} |
1476 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1477 | |
{ |
1478 | 0 | java.util.List includes = new java.util.ArrayList(); |
1479 | 0 | moduleSet.setIncludes( includes ); |
1480 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1481 | |
{ |
1482 | 0 | if ( "include".equals( parser.getName() ) ) |
1483 | |
{ |
1484 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1485 | |
} |
1486 | |
else |
1487 | |
{ |
1488 | 0 | checkUnknownElement( parser, strict ); |
1489 | |
} |
1490 | |
} |
1491 | 0 | } |
1492 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1493 | |
{ |
1494 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1495 | 0 | moduleSet.setExcludes( excludes ); |
1496 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1497 | |
{ |
1498 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1499 | |
{ |
1500 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1501 | |
} |
1502 | |
else |
1503 | |
{ |
1504 | 0 | checkUnknownElement( parser, strict ); |
1505 | |
} |
1506 | |
} |
1507 | 0 | } |
1508 | 0 | else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) ) |
1509 | |
{ |
1510 | 0 | moduleSet.setSources( parseModuleSources( parser, strict ) ); |
1511 | |
} |
1512 | 0 | else if ( checkFieldWithDuplicate( parser, "binaries", null, parsed ) ) |
1513 | |
{ |
1514 | 0 | moduleSet.setBinaries( parseModuleBinaries( parser, strict ) ); |
1515 | |
} |
1516 | |
else |
1517 | |
{ |
1518 | 0 | checkUnknownElement( parser, strict ); |
1519 | |
} |
1520 | |
} |
1521 | 0 | return moduleSet; |
1522 | |
} |
1523 | |
|
1524 | |
|
1525 | |
|
1526 | |
|
1527 | |
|
1528 | |
|
1529 | |
|
1530 | |
|
1531 | |
|
1532 | |
|
1533 | |
private ModuleSources parseModuleSources( XmlPullParser parser, boolean strict ) |
1534 | |
throws IOException, XmlPullParserException |
1535 | |
{ |
1536 | 0 | String tagName = parser.getName(); |
1537 | 0 | ModuleSources moduleSources = new ModuleSources(); |
1538 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1539 | |
{ |
1540 | 0 | String name = parser.getAttributeName( i ); |
1541 | 0 | String value = parser.getAttributeValue( i ); |
1542 | |
|
1543 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1544 | |
{ |
1545 | |
|
1546 | |
} |
1547 | |
else |
1548 | |
{ |
1549 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1550 | |
} |
1551 | |
} |
1552 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1553 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1554 | |
{ |
1555 | 0 | if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) ) |
1556 | |
{ |
1557 | 0 | moduleSources.setUseDefaultExcludes( getBooleanValue( getTrimmedValue( parser.nextText() ), "useDefaultExcludes", parser, "true" ) ); |
1558 | |
} |
1559 | 0 | else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1560 | |
{ |
1561 | 0 | moduleSources.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1562 | |
} |
1563 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1564 | |
{ |
1565 | 0 | java.util.List includes = new java.util.ArrayList(); |
1566 | 0 | moduleSources.setIncludes( includes ); |
1567 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1568 | |
{ |
1569 | 0 | if ( "include".equals( parser.getName() ) ) |
1570 | |
{ |
1571 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1572 | |
} |
1573 | |
else |
1574 | |
{ |
1575 | 0 | checkUnknownElement( parser, strict ); |
1576 | |
} |
1577 | |
} |
1578 | 0 | } |
1579 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1580 | |
{ |
1581 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1582 | 0 | moduleSources.setExcludes( excludes ); |
1583 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1584 | |
{ |
1585 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1586 | |
{ |
1587 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1588 | |
} |
1589 | |
else |
1590 | |
{ |
1591 | 0 | checkUnknownElement( parser, strict ); |
1592 | |
} |
1593 | |
} |
1594 | 0 | } |
1595 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1596 | |
{ |
1597 | 0 | moduleSources.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1598 | |
} |
1599 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1600 | |
{ |
1601 | 0 | moduleSources.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1602 | |
} |
1603 | 0 | else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) ) |
1604 | |
{ |
1605 | 0 | java.util.List fileSets = new java.util.ArrayList(); |
1606 | 0 | moduleSources.setFileSets( fileSets ); |
1607 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1608 | |
{ |
1609 | 0 | if ( "fileSet".equals( parser.getName() ) ) |
1610 | |
{ |
1611 | 0 | fileSets.add( parseFileSet( parser, strict ) ); |
1612 | |
} |
1613 | |
else |
1614 | |
{ |
1615 | 0 | checkUnknownElement( parser, strict ); |
1616 | |
} |
1617 | |
} |
1618 | 0 | } |
1619 | 0 | else if ( checkFieldWithDuplicate( parser, "includeModuleDirectory", null, parsed ) ) |
1620 | |
{ |
1621 | 0 | moduleSources.setIncludeModuleDirectory( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeModuleDirectory", parser, "true" ) ); |
1622 | |
} |
1623 | 0 | else if ( checkFieldWithDuplicate( parser, "excludeSubModuleDirectories", null, parsed ) ) |
1624 | |
{ |
1625 | 0 | moduleSources.setExcludeSubModuleDirectories( getBooleanValue( getTrimmedValue( parser.nextText() ), "excludeSubModuleDirectories", parser, "true" ) ); |
1626 | |
} |
1627 | 0 | else if ( checkFieldWithDuplicate( parser, "outputDirectoryMapping", null, parsed ) ) |
1628 | |
{ |
1629 | 0 | moduleSources.setOutputDirectoryMapping( getTrimmedValue( parser.nextText() ) ); |
1630 | |
} |
1631 | |
else |
1632 | |
{ |
1633 | 0 | checkUnknownElement( parser, strict ); |
1634 | |
} |
1635 | |
} |
1636 | 0 | return moduleSources; |
1637 | |
} |
1638 | |
|
1639 | |
|
1640 | |
|
1641 | |
|
1642 | |
|
1643 | |
|
1644 | |
|
1645 | |
|
1646 | |
|
1647 | |
|
1648 | |
private Repository parseRepository( XmlPullParser parser, boolean strict ) |
1649 | |
throws IOException, XmlPullParserException |
1650 | |
{ |
1651 | 0 | String tagName = parser.getName(); |
1652 | 0 | Repository repository = new Repository(); |
1653 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1654 | |
{ |
1655 | 0 | String name = parser.getAttributeName( i ); |
1656 | 0 | String value = parser.getAttributeValue( i ); |
1657 | |
|
1658 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1659 | |
{ |
1660 | |
|
1661 | |
} |
1662 | |
else |
1663 | |
{ |
1664 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1665 | |
} |
1666 | |
} |
1667 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1668 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1669 | |
{ |
1670 | 0 | if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1671 | |
{ |
1672 | 0 | repository.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1673 | |
} |
1674 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1675 | |
{ |
1676 | 0 | java.util.List includes = new java.util.ArrayList(); |
1677 | 0 | repository.setIncludes( includes ); |
1678 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1679 | |
{ |
1680 | 0 | if ( "include".equals( parser.getName() ) ) |
1681 | |
{ |
1682 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1683 | |
} |
1684 | |
else |
1685 | |
{ |
1686 | 0 | checkUnknownElement( parser, strict ); |
1687 | |
} |
1688 | |
} |
1689 | 0 | } |
1690 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1691 | |
{ |
1692 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1693 | 0 | repository.setExcludes( excludes ); |
1694 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1695 | |
{ |
1696 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1697 | |
{ |
1698 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1699 | |
} |
1700 | |
else |
1701 | |
{ |
1702 | 0 | checkUnknownElement( parser, strict ); |
1703 | |
} |
1704 | |
} |
1705 | 0 | } |
1706 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1707 | |
{ |
1708 | 0 | repository.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1709 | |
} |
1710 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1711 | |
{ |
1712 | 0 | repository.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1713 | |
} |
1714 | 0 | else if ( checkFieldWithDuplicate( parser, "includeMetadata", null, parsed ) ) |
1715 | |
{ |
1716 | 0 | repository.setIncludeMetadata( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeMetadata", parser, "false" ) ); |
1717 | |
} |
1718 | 0 | else if ( checkFieldWithDuplicate( parser, "groupVersionAlignments", null, parsed ) ) |
1719 | |
{ |
1720 | 0 | java.util.List groupVersionAlignments = new java.util.ArrayList(); |
1721 | 0 | repository.setGroupVersionAlignments( groupVersionAlignments ); |
1722 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1723 | |
{ |
1724 | 0 | if ( "groupVersionAlignment".equals( parser.getName() ) ) |
1725 | |
{ |
1726 | 0 | groupVersionAlignments.add( parseGroupVersionAlignment( parser, strict ) ); |
1727 | |
} |
1728 | |
else |
1729 | |
{ |
1730 | 0 | checkUnknownElement( parser, strict ); |
1731 | |
} |
1732 | |
} |
1733 | 0 | } |
1734 | 0 | else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) ) |
1735 | |
{ |
1736 | 0 | repository.setScope( getTrimmedValue( parser.nextText() ) ); |
1737 | |
} |
1738 | |
else |
1739 | |
{ |
1740 | 0 | checkUnknownElement( parser, strict ); |
1741 | |
} |
1742 | |
} |
1743 | 0 | return repository; |
1744 | |
} |
1745 | |
|
1746 | |
|
1747 | |
|
1748 | |
|
1749 | |
|
1750 | |
|
1751 | |
|
1752 | |
|
1753 | |
|
1754 | |
|
1755 | |
private UnpackOptions parseUnpackOptions( XmlPullParser parser, boolean strict ) |
1756 | |
throws IOException, XmlPullParserException |
1757 | |
{ |
1758 | 0 | String tagName = parser.getName(); |
1759 | 0 | UnpackOptions unpackOptions = new UnpackOptions(); |
1760 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1761 | |
{ |
1762 | 0 | String name = parser.getAttributeName( i ); |
1763 | 0 | String value = parser.getAttributeValue( i ); |
1764 | |
|
1765 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1766 | |
{ |
1767 | |
|
1768 | |
} |
1769 | |
else |
1770 | |
{ |
1771 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1772 | |
} |
1773 | |
} |
1774 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1775 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1776 | |
{ |
1777 | 0 | if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1778 | |
{ |
1779 | 0 | java.util.List includes = new java.util.ArrayList(); |
1780 | 0 | unpackOptions.setIncludes( includes ); |
1781 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1782 | |
{ |
1783 | 0 | if ( "include".equals( parser.getName() ) ) |
1784 | |
{ |
1785 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1786 | |
} |
1787 | |
else |
1788 | |
{ |
1789 | 0 | checkUnknownElement( parser, strict ); |
1790 | |
} |
1791 | |
} |
1792 | 0 | } |
1793 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1794 | |
{ |
1795 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1796 | 0 | unpackOptions.setExcludes( excludes ); |
1797 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1798 | |
{ |
1799 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1800 | |
{ |
1801 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1802 | |
} |
1803 | |
else |
1804 | |
{ |
1805 | 0 | checkUnknownElement( parser, strict ); |
1806 | |
} |
1807 | |
} |
1808 | 0 | } |
1809 | 0 | else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) ) |
1810 | |
{ |
1811 | 0 | unpackOptions.setFiltered( getBooleanValue( getTrimmedValue( parser.nextText() ), "filtered", parser, "false" ) ); |
1812 | |
} |
1813 | 0 | else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) ) |
1814 | |
{ |
1815 | 0 | unpackOptions.setLineEnding( getTrimmedValue( parser.nextText() ) ); |
1816 | |
} |
1817 | 0 | else if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) ) |
1818 | |
{ |
1819 | 0 | unpackOptions.setUseDefaultExcludes( getBooleanValue( getTrimmedValue( parser.nextText() ), "useDefaultExcludes", parser, "true" ) ); |
1820 | |
} |
1821 | |
else |
1822 | |
{ |
1823 | 0 | checkUnknownElement( parser, strict ); |
1824 | |
} |
1825 | |
} |
1826 | 0 | return unpackOptions; |
1827 | |
} |
1828 | |
|
1829 | |
|
1830 | |
|
1831 | |
|
1832 | |
|
1833 | |
|
1834 | |
|
1835 | |
|
1836 | |
|
1837 | |
|
1838 | |
public Component read( Reader reader, boolean strict ) |
1839 | |
throws IOException, XmlPullParserException |
1840 | |
{ |
1841 | 3 | XmlPullParser parser = new MXParser(); |
1842 | |
|
1843 | 3 | parser.setInput( reader ); |
1844 | |
|
1845 | 3 | initParser( parser ); |
1846 | |
|
1847 | 3 | return read( parser, strict ); |
1848 | |
} |
1849 | |
|
1850 | |
|
1851 | |
|
1852 | |
|
1853 | |
|
1854 | |
|
1855 | |
|
1856 | |
|
1857 | |
|
1858 | |
public Component read( Reader reader ) |
1859 | |
throws IOException, XmlPullParserException |
1860 | |
{ |
1861 | 3 | return read( reader, true ); |
1862 | |
} |
1863 | |
|
1864 | |
|
1865 | |
|
1866 | |
|
1867 | |
|
1868 | |
|
1869 | |
|
1870 | |
|
1871 | |
|
1872 | |
|
1873 | |
public Component read( InputStream in, boolean strict ) |
1874 | |
throws IOException, XmlPullParserException |
1875 | |
{ |
1876 | 0 | return read( ReaderFactory.newXmlReader( in ), strict ); |
1877 | |
} |
1878 | |
|
1879 | |
|
1880 | |
|
1881 | |
|
1882 | |
|
1883 | |
|
1884 | |
|
1885 | |
|
1886 | |
|
1887 | |
public Component read( InputStream in ) |
1888 | |
throws IOException, XmlPullParserException |
1889 | |
{ |
1890 | 0 | return read( ReaderFactory.newXmlReader( in ) ); |
1891 | |
} |
1892 | |
|
1893 | |
|
1894 | |
|
1895 | |
|
1896 | |
|
1897 | |
|
1898 | |
|
1899 | |
|
1900 | |
|
1901 | |
|
1902 | |
private Component read( XmlPullParser parser, boolean strict ) |
1903 | |
throws IOException, XmlPullParserException |
1904 | |
{ |
1905 | 3 | int eventType = parser.getEventType(); |
1906 | 6 | while ( eventType != XmlPullParser.END_DOCUMENT ) |
1907 | |
{ |
1908 | 6 | if ( eventType == XmlPullParser.START_TAG ) |
1909 | |
{ |
1910 | 3 | if ( strict && ! "component".equals( parser.getName() ) ) |
1911 | |
{ |
1912 | 0 | throw new XmlPullParserException( "Expected root element 'component' but found '" + parser.getName() + "'", parser, null ); |
1913 | |
} |
1914 | 3 | Component component = parseComponent( parser, strict ); |
1915 | 3 | component.setModelEncoding( parser.getInputEncoding() ); |
1916 | 3 | return component; |
1917 | |
} |
1918 | 3 | eventType = parser.next(); |
1919 | |
} |
1920 | 0 | throw new XmlPullParserException( "Expected root element 'component' but found no element at all: invalid XML document", parser, null ); |
1921 | |
} |
1922 | |
|
1923 | |
|
1924 | |
|
1925 | |
|
1926 | |
|
1927 | |
|
1928 | |
public void setAddDefaultEntities( boolean addDefaultEntities ) |
1929 | |
{ |
1930 | 0 | this.addDefaultEntities = addDefaultEntities; |
1931 | 0 | } |
1932 | |
|
1933 | |
} |