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.Assembly; |
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 | 18 | public class AssemblyXpp3Reader |
43 | |
{ |
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | 18 | 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 | 235 | if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) ) |
80 | |
{ |
81 | 173 | return false; |
82 | |
} |
83 | 62 | if ( !parsed.add( tagName ) ) |
84 | |
{ |
85 | 0 | throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null ); |
86 | |
} |
87 | 62 | 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 | 3 | if ( s != null && s.length() != 0 ) |
179 | |
{ |
180 | 3 | 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 | 73 | if ( s != null ) |
482 | |
{ |
483 | 73 | s = s.trim(); |
484 | |
} |
485 | 73 | return s; |
486 | |
} |
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | |
private void initParser( XmlPullParser parser ) |
495 | |
throws XmlPullParserException |
496 | |
{ |
497 | 18 | if ( addDefaultEntities ) |
498 | |
{ |
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | 18 | parser.defineEntityReplacementText( "nbsp", "\u00a0" ); |
504 | 18 | parser.defineEntityReplacementText( "iexcl", "\u00a1" ); |
505 | 18 | parser.defineEntityReplacementText( "cent", "\u00a2" ); |
506 | 18 | parser.defineEntityReplacementText( "pound", "\u00a3" ); |
507 | 18 | parser.defineEntityReplacementText( "curren", "\u00a4" ); |
508 | 18 | parser.defineEntityReplacementText( "yen", "\u00a5" ); |
509 | 18 | parser.defineEntityReplacementText( "brvbar", "\u00a6" ); |
510 | 18 | parser.defineEntityReplacementText( "sect", "\u00a7" ); |
511 | 18 | parser.defineEntityReplacementText( "uml", "\u00a8" ); |
512 | 18 | parser.defineEntityReplacementText( "copy", "\u00a9" ); |
513 | 18 | parser.defineEntityReplacementText( "ordf", "\u00aa" ); |
514 | 18 | parser.defineEntityReplacementText( "laquo", "\u00ab" ); |
515 | 18 | parser.defineEntityReplacementText( "not", "\u00ac" ); |
516 | 18 | parser.defineEntityReplacementText( "shy", "\u00ad" ); |
517 | 18 | parser.defineEntityReplacementText( "reg", "\u00ae" ); |
518 | 18 | parser.defineEntityReplacementText( "macr", "\u00af" ); |
519 | 18 | parser.defineEntityReplacementText( "deg", "\u00b0" ); |
520 | 18 | parser.defineEntityReplacementText( "plusmn", "\u00b1" ); |
521 | 18 | parser.defineEntityReplacementText( "sup2", "\u00b2" ); |
522 | 18 | parser.defineEntityReplacementText( "sup3", "\u00b3" ); |
523 | 18 | parser.defineEntityReplacementText( "acute", "\u00b4" ); |
524 | 18 | parser.defineEntityReplacementText( "micro", "\u00b5" ); |
525 | 18 | parser.defineEntityReplacementText( "para", "\u00b6" ); |
526 | 18 | parser.defineEntityReplacementText( "middot", "\u00b7" ); |
527 | 18 | parser.defineEntityReplacementText( "cedil", "\u00b8" ); |
528 | 18 | parser.defineEntityReplacementText( "sup1", "\u00b9" ); |
529 | 18 | parser.defineEntityReplacementText( "ordm", "\u00ba" ); |
530 | 18 | parser.defineEntityReplacementText( "raquo", "\u00bb" ); |
531 | 18 | parser.defineEntityReplacementText( "frac14", "\u00bc" ); |
532 | 18 | parser.defineEntityReplacementText( "frac12", "\u00bd" ); |
533 | 18 | parser.defineEntityReplacementText( "frac34", "\u00be" ); |
534 | 18 | parser.defineEntityReplacementText( "iquest", "\u00bf" ); |
535 | 18 | parser.defineEntityReplacementText( "Agrave", "\u00c0" ); |
536 | 18 | parser.defineEntityReplacementText( "Aacute", "\u00c1" ); |
537 | 18 | parser.defineEntityReplacementText( "Acirc", "\u00c2" ); |
538 | 18 | parser.defineEntityReplacementText( "Atilde", "\u00c3" ); |
539 | 18 | parser.defineEntityReplacementText( "Auml", "\u00c4" ); |
540 | 18 | parser.defineEntityReplacementText( "Aring", "\u00c5" ); |
541 | 18 | parser.defineEntityReplacementText( "AElig", "\u00c6" ); |
542 | 18 | parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); |
543 | 18 | parser.defineEntityReplacementText( "Egrave", "\u00c8" ); |
544 | 18 | parser.defineEntityReplacementText( "Eacute", "\u00c9" ); |
545 | 18 | parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); |
546 | 18 | parser.defineEntityReplacementText( "Euml", "\u00cb" ); |
547 | 18 | parser.defineEntityReplacementText( "Igrave", "\u00cc" ); |
548 | 18 | parser.defineEntityReplacementText( "Iacute", "\u00cd" ); |
549 | 18 | parser.defineEntityReplacementText( "Icirc", "\u00ce" ); |
550 | 18 | parser.defineEntityReplacementText( "Iuml", "\u00cf" ); |
551 | 18 | parser.defineEntityReplacementText( "ETH", "\u00d0" ); |
552 | 18 | parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); |
553 | 18 | parser.defineEntityReplacementText( "Ograve", "\u00d2" ); |
554 | 18 | parser.defineEntityReplacementText( "Oacute", "\u00d3" ); |
555 | 18 | parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); |
556 | 18 | parser.defineEntityReplacementText( "Otilde", "\u00d5" ); |
557 | 18 | parser.defineEntityReplacementText( "Ouml", "\u00d6" ); |
558 | 18 | parser.defineEntityReplacementText( "times", "\u00d7" ); |
559 | 18 | parser.defineEntityReplacementText( "Oslash", "\u00d8" ); |
560 | 18 | parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); |
561 | 18 | parser.defineEntityReplacementText( "Uacute", "\u00da" ); |
562 | 18 | parser.defineEntityReplacementText( "Ucirc", "\u00db" ); |
563 | 18 | parser.defineEntityReplacementText( "Uuml", "\u00dc" ); |
564 | 18 | parser.defineEntityReplacementText( "Yacute", "\u00dd" ); |
565 | 18 | parser.defineEntityReplacementText( "THORN", "\u00de" ); |
566 | 18 | parser.defineEntityReplacementText( "szlig", "\u00df" ); |
567 | 18 | parser.defineEntityReplacementText( "agrave", "\u00e0" ); |
568 | 18 | parser.defineEntityReplacementText( "aacute", "\u00e1" ); |
569 | 18 | parser.defineEntityReplacementText( "acirc", "\u00e2" ); |
570 | 18 | parser.defineEntityReplacementText( "atilde", "\u00e3" ); |
571 | 18 | parser.defineEntityReplacementText( "auml", "\u00e4" ); |
572 | 18 | parser.defineEntityReplacementText( "aring", "\u00e5" ); |
573 | 18 | parser.defineEntityReplacementText( "aelig", "\u00e6" ); |
574 | 18 | parser.defineEntityReplacementText( "ccedil", "\u00e7" ); |
575 | 18 | parser.defineEntityReplacementText( "egrave", "\u00e8" ); |
576 | 18 | parser.defineEntityReplacementText( "eacute", "\u00e9" ); |
577 | 18 | parser.defineEntityReplacementText( "ecirc", "\u00ea" ); |
578 | 18 | parser.defineEntityReplacementText( "euml", "\u00eb" ); |
579 | 18 | parser.defineEntityReplacementText( "igrave", "\u00ec" ); |
580 | 18 | parser.defineEntityReplacementText( "iacute", "\u00ed" ); |
581 | 18 | parser.defineEntityReplacementText( "icirc", "\u00ee" ); |
582 | 18 | parser.defineEntityReplacementText( "iuml", "\u00ef" ); |
583 | 18 | parser.defineEntityReplacementText( "eth", "\u00f0" ); |
584 | 18 | parser.defineEntityReplacementText( "ntilde", "\u00f1" ); |
585 | 18 | parser.defineEntityReplacementText( "ograve", "\u00f2" ); |
586 | 18 | parser.defineEntityReplacementText( "oacute", "\u00f3" ); |
587 | 18 | parser.defineEntityReplacementText( "ocirc", "\u00f4" ); |
588 | 18 | parser.defineEntityReplacementText( "otilde", "\u00f5" ); |
589 | 18 | parser.defineEntityReplacementText( "ouml", "\u00f6" ); |
590 | 18 | parser.defineEntityReplacementText( "divide", "\u00f7" ); |
591 | 18 | parser.defineEntityReplacementText( "oslash", "\u00f8" ); |
592 | 18 | parser.defineEntityReplacementText( "ugrave", "\u00f9" ); |
593 | 18 | parser.defineEntityReplacementText( "uacute", "\u00fa" ); |
594 | 18 | parser.defineEntityReplacementText( "ucirc", "\u00fb" ); |
595 | 18 | parser.defineEntityReplacementText( "uuml", "\u00fc" ); |
596 | 18 | parser.defineEntityReplacementText( "yacute", "\u00fd" ); |
597 | 18 | parser.defineEntityReplacementText( "thorn", "\u00fe" ); |
598 | 18 | parser.defineEntityReplacementText( "yuml", "\u00ff" ); |
599 | |
|
600 | |
|
601 | |
|
602 | |
|
603 | |
|
604 | 18 | parser.defineEntityReplacementText( "OElig", "\u0152" ); |
605 | 18 | parser.defineEntityReplacementText( "oelig", "\u0153" ); |
606 | 18 | parser.defineEntityReplacementText( "Scaron", "\u0160" ); |
607 | 18 | parser.defineEntityReplacementText( "scaron", "\u0161" ); |
608 | 18 | parser.defineEntityReplacementText( "Yuml", "\u0178" ); |
609 | 18 | parser.defineEntityReplacementText( "circ", "\u02c6" ); |
610 | 18 | parser.defineEntityReplacementText( "tilde", "\u02dc" ); |
611 | 18 | parser.defineEntityReplacementText( "ensp", "\u2002" ); |
612 | 18 | parser.defineEntityReplacementText( "emsp", "\u2003" ); |
613 | 18 | parser.defineEntityReplacementText( "thinsp", "\u2009" ); |
614 | 18 | parser.defineEntityReplacementText( "zwnj", "\u200c" ); |
615 | 18 | parser.defineEntityReplacementText( "zwj", "\u200d" ); |
616 | 18 | parser.defineEntityReplacementText( "lrm", "\u200e" ); |
617 | 18 | parser.defineEntityReplacementText( "rlm", "\u200f" ); |
618 | 18 | parser.defineEntityReplacementText( "ndash", "\u2013" ); |
619 | 18 | parser.defineEntityReplacementText( "mdash", "\u2014" ); |
620 | 18 | parser.defineEntityReplacementText( "lsquo", "\u2018" ); |
621 | 18 | parser.defineEntityReplacementText( "rsquo", "\u2019" ); |
622 | 18 | parser.defineEntityReplacementText( "sbquo", "\u201a" ); |
623 | 18 | parser.defineEntityReplacementText( "ldquo", "\u201c" ); |
624 | 18 | parser.defineEntityReplacementText( "rdquo", "\u201d" ); |
625 | 18 | parser.defineEntityReplacementText( "bdquo", "\u201e" ); |
626 | 18 | parser.defineEntityReplacementText( "dagger", "\u2020" ); |
627 | 18 | parser.defineEntityReplacementText( "Dagger", "\u2021" ); |
628 | 18 | parser.defineEntityReplacementText( "permil", "\u2030" ); |
629 | 18 | parser.defineEntityReplacementText( "lsaquo", "\u2039" ); |
630 | 18 | parser.defineEntityReplacementText( "rsaquo", "\u203a" ); |
631 | 18 | parser.defineEntityReplacementText( "euro", "\u20ac" ); |
632 | |
|
633 | |
|
634 | |
|
635 | |
|
636 | |
|
637 | 18 | parser.defineEntityReplacementText( "fnof", "\u0192" ); |
638 | 18 | parser.defineEntityReplacementText( "Alpha", "\u0391" ); |
639 | 18 | parser.defineEntityReplacementText( "Beta", "\u0392" ); |
640 | 18 | parser.defineEntityReplacementText( "Gamma", "\u0393" ); |
641 | 18 | parser.defineEntityReplacementText( "Delta", "\u0394" ); |
642 | 18 | parser.defineEntityReplacementText( "Epsilon", "\u0395" ); |
643 | 18 | parser.defineEntityReplacementText( "Zeta", "\u0396" ); |
644 | 18 | parser.defineEntityReplacementText( "Eta", "\u0397" ); |
645 | 18 | parser.defineEntityReplacementText( "Theta", "\u0398" ); |
646 | 18 | parser.defineEntityReplacementText( "Iota", "\u0399" ); |
647 | 18 | parser.defineEntityReplacementText( "Kappa", "\u039a" ); |
648 | 18 | parser.defineEntityReplacementText( "Lambda", "\u039b" ); |
649 | 18 | parser.defineEntityReplacementText( "Mu", "\u039c" ); |
650 | 18 | parser.defineEntityReplacementText( "Nu", "\u039d" ); |
651 | 18 | parser.defineEntityReplacementText( "Xi", "\u039e" ); |
652 | 18 | parser.defineEntityReplacementText( "Omicron", "\u039f" ); |
653 | 18 | parser.defineEntityReplacementText( "Pi", "\u03a0" ); |
654 | 18 | parser.defineEntityReplacementText( "Rho", "\u03a1" ); |
655 | 18 | parser.defineEntityReplacementText( "Sigma", "\u03a3" ); |
656 | 18 | parser.defineEntityReplacementText( "Tau", "\u03a4" ); |
657 | 18 | parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); |
658 | 18 | parser.defineEntityReplacementText( "Phi", "\u03a6" ); |
659 | 18 | parser.defineEntityReplacementText( "Chi", "\u03a7" ); |
660 | 18 | parser.defineEntityReplacementText( "Psi", "\u03a8" ); |
661 | 18 | parser.defineEntityReplacementText( "Omega", "\u03a9" ); |
662 | 18 | parser.defineEntityReplacementText( "alpha", "\u03b1" ); |
663 | 18 | parser.defineEntityReplacementText( "beta", "\u03b2" ); |
664 | 18 | parser.defineEntityReplacementText( "gamma", "\u03b3" ); |
665 | 18 | parser.defineEntityReplacementText( "delta", "\u03b4" ); |
666 | 18 | parser.defineEntityReplacementText( "epsilon", "\u03b5" ); |
667 | 18 | parser.defineEntityReplacementText( "zeta", "\u03b6" ); |
668 | 18 | parser.defineEntityReplacementText( "eta", "\u03b7" ); |
669 | 18 | parser.defineEntityReplacementText( "theta", "\u03b8" ); |
670 | 18 | parser.defineEntityReplacementText( "iota", "\u03b9" ); |
671 | 18 | parser.defineEntityReplacementText( "kappa", "\u03ba" ); |
672 | 18 | parser.defineEntityReplacementText( "lambda", "\u03bb" ); |
673 | 18 | parser.defineEntityReplacementText( "mu", "\u03bc" ); |
674 | 18 | parser.defineEntityReplacementText( "nu", "\u03bd" ); |
675 | 18 | parser.defineEntityReplacementText( "xi", "\u03be" ); |
676 | 18 | parser.defineEntityReplacementText( "omicron", "\u03bf" ); |
677 | 18 | parser.defineEntityReplacementText( "pi", "\u03c0" ); |
678 | 18 | parser.defineEntityReplacementText( "rho", "\u03c1" ); |
679 | 18 | parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); |
680 | 18 | parser.defineEntityReplacementText( "sigma", "\u03c3" ); |
681 | 18 | parser.defineEntityReplacementText( "tau", "\u03c4" ); |
682 | 18 | parser.defineEntityReplacementText( "upsilon", "\u03c5" ); |
683 | 18 | parser.defineEntityReplacementText( "phi", "\u03c6" ); |
684 | 18 | parser.defineEntityReplacementText( "chi", "\u03c7" ); |
685 | 18 | parser.defineEntityReplacementText( "psi", "\u03c8" ); |
686 | 18 | parser.defineEntityReplacementText( "omega", "\u03c9" ); |
687 | 18 | parser.defineEntityReplacementText( "thetasym", "\u03d1" ); |
688 | 18 | parser.defineEntityReplacementText( "upsih", "\u03d2" ); |
689 | 18 | parser.defineEntityReplacementText( "piv", "\u03d6" ); |
690 | 18 | parser.defineEntityReplacementText( "bull", "\u2022" ); |
691 | 18 | parser.defineEntityReplacementText( "hellip", "\u2026" ); |
692 | 18 | parser.defineEntityReplacementText( "prime", "\u2032" ); |
693 | 18 | parser.defineEntityReplacementText( "Prime", "\u2033" ); |
694 | 18 | parser.defineEntityReplacementText( "oline", "\u203e" ); |
695 | 18 | parser.defineEntityReplacementText( "frasl", "\u2044" ); |
696 | 18 | parser.defineEntityReplacementText( "weierp", "\u2118" ); |
697 | 18 | parser.defineEntityReplacementText( "image", "\u2111" ); |
698 | 18 | parser.defineEntityReplacementText( "real", "\u211c" ); |
699 | 18 | parser.defineEntityReplacementText( "trade", "\u2122" ); |
700 | 18 | parser.defineEntityReplacementText( "alefsym", "\u2135" ); |
701 | 18 | parser.defineEntityReplacementText( "larr", "\u2190" ); |
702 | 18 | parser.defineEntityReplacementText( "uarr", "\u2191" ); |
703 | 18 | parser.defineEntityReplacementText( "rarr", "\u2192" ); |
704 | 18 | parser.defineEntityReplacementText( "darr", "\u2193" ); |
705 | 18 | parser.defineEntityReplacementText( "harr", "\u2194" ); |
706 | 18 | parser.defineEntityReplacementText( "crarr", "\u21b5" ); |
707 | 18 | parser.defineEntityReplacementText( "lArr", "\u21d0" ); |
708 | 18 | parser.defineEntityReplacementText( "uArr", "\u21d1" ); |
709 | 18 | parser.defineEntityReplacementText( "rArr", "\u21d2" ); |
710 | 18 | parser.defineEntityReplacementText( "dArr", "\u21d3" ); |
711 | 18 | parser.defineEntityReplacementText( "hArr", "\u21d4" ); |
712 | 18 | parser.defineEntityReplacementText( "forall", "\u2200" ); |
713 | 18 | parser.defineEntityReplacementText( "part", "\u2202" ); |
714 | 18 | parser.defineEntityReplacementText( "exist", "\u2203" ); |
715 | 18 | parser.defineEntityReplacementText( "empty", "\u2205" ); |
716 | 18 | parser.defineEntityReplacementText( "nabla", "\u2207" ); |
717 | 18 | parser.defineEntityReplacementText( "isin", "\u2208" ); |
718 | 18 | parser.defineEntityReplacementText( "notin", "\u2209" ); |
719 | 18 | parser.defineEntityReplacementText( "ni", "\u220b" ); |
720 | 18 | parser.defineEntityReplacementText( "prod", "\u220f" ); |
721 | 18 | parser.defineEntityReplacementText( "sum", "\u2211" ); |
722 | 18 | parser.defineEntityReplacementText( "minus", "\u2212" ); |
723 | 18 | parser.defineEntityReplacementText( "lowast", "\u2217" ); |
724 | 18 | parser.defineEntityReplacementText( "radic", "\u221a" ); |
725 | 18 | parser.defineEntityReplacementText( "prop", "\u221d" ); |
726 | 18 | parser.defineEntityReplacementText( "infin", "\u221e" ); |
727 | 18 | parser.defineEntityReplacementText( "ang", "\u2220" ); |
728 | 18 | parser.defineEntityReplacementText( "and", "\u2227" ); |
729 | 18 | parser.defineEntityReplacementText( "or", "\u2228" ); |
730 | 18 | parser.defineEntityReplacementText( "cap", "\u2229" ); |
731 | 18 | parser.defineEntityReplacementText( "cup", "\u222a" ); |
732 | 18 | parser.defineEntityReplacementText( "int", "\u222b" ); |
733 | 18 | parser.defineEntityReplacementText( "there4", "\u2234" ); |
734 | 18 | parser.defineEntityReplacementText( "sim", "\u223c" ); |
735 | 18 | parser.defineEntityReplacementText( "cong", "\u2245" ); |
736 | 18 | parser.defineEntityReplacementText( "asymp", "\u2248" ); |
737 | 18 | parser.defineEntityReplacementText( "ne", "\u2260" ); |
738 | 18 | parser.defineEntityReplacementText( "equiv", "\u2261" ); |
739 | 18 | parser.defineEntityReplacementText( "le", "\u2264" ); |
740 | 18 | parser.defineEntityReplacementText( "ge", "\u2265" ); |
741 | 18 | parser.defineEntityReplacementText( "sub", "\u2282" ); |
742 | 18 | parser.defineEntityReplacementText( "sup", "\u2283" ); |
743 | 18 | parser.defineEntityReplacementText( "nsub", "\u2284" ); |
744 | 18 | parser.defineEntityReplacementText( "sube", "\u2286" ); |
745 | 18 | parser.defineEntityReplacementText( "supe", "\u2287" ); |
746 | 18 | parser.defineEntityReplacementText( "oplus", "\u2295" ); |
747 | 18 | parser.defineEntityReplacementText( "otimes", "\u2297" ); |
748 | 18 | parser.defineEntityReplacementText( "perp", "\u22a5" ); |
749 | 18 | parser.defineEntityReplacementText( "sdot", "\u22c5" ); |
750 | 18 | parser.defineEntityReplacementText( "lceil", "\u2308" ); |
751 | 18 | parser.defineEntityReplacementText( "rceil", "\u2309" ); |
752 | 18 | parser.defineEntityReplacementText( "lfloor", "\u230a" ); |
753 | 18 | parser.defineEntityReplacementText( "rfloor", "\u230b" ); |
754 | 18 | parser.defineEntityReplacementText( "lang", "\u2329" ); |
755 | 18 | parser.defineEntityReplacementText( "rang", "\u232a" ); |
756 | 18 | parser.defineEntityReplacementText( "loz", "\u25ca" ); |
757 | 18 | parser.defineEntityReplacementText( "spades", "\u2660" ); |
758 | 18 | parser.defineEntityReplacementText( "clubs", "\u2663" ); |
759 | 18 | parser.defineEntityReplacementText( "hearts", "\u2665" ); |
760 | 18 | parser.defineEntityReplacementText( "diams", "\u2666" ); |
761 | |
|
762 | |
} |
763 | 18 | } |
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 Assembly parseAssembly( XmlPullParser parser, boolean strict ) |
798 | |
throws IOException, XmlPullParserException |
799 | |
{ |
800 | 18 | String tagName = parser.getName(); |
801 | 18 | Assembly assembly = new Assembly(); |
802 | 30 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
803 | |
{ |
804 | 12 | String name = parser.getAttributeName( i ); |
805 | 12 | String value = parser.getAttributeValue( i ); |
806 | |
|
807 | 12 | if ( name.indexOf( ':' ) >= 0 ) |
808 | |
{ |
809 | |
|
810 | |
} |
811 | 4 | else if ( "xmlns".equals( name ) ) |
812 | |
{ |
813 | |
|
814 | |
} |
815 | |
else |
816 | |
{ |
817 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
818 | |
} |
819 | |
} |
820 | 18 | java.util.Set parsed = new java.util.HashSet(); |
821 | 49 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
822 | |
{ |
823 | 31 | if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
824 | |
{ |
825 | 18 | assembly.setId( getTrimmedValue( parser.nextText() ) ); |
826 | |
} |
827 | 13 | else if ( checkFieldWithDuplicate( parser, "formats", null, parsed ) ) |
828 | |
{ |
829 | 4 | java.util.List formats = new java.util.ArrayList(); |
830 | 4 | assembly.setFormats( formats ); |
831 | 16 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
832 | |
{ |
833 | 12 | if ( "format".equals( parser.getName() ) ) |
834 | |
{ |
835 | 12 | formats.add( getTrimmedValue( parser.nextText() ) ); |
836 | |
} |
837 | |
else |
838 | |
{ |
839 | 0 | checkUnknownElement( parser, strict ); |
840 | |
} |
841 | |
} |
842 | 4 | } |
843 | 9 | else if ( checkFieldWithDuplicate( parser, "includeBaseDirectory", null, parsed ) ) |
844 | |
{ |
845 | 0 | assembly.setIncludeBaseDirectory( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeBaseDirectory", parser, "true" ) ); |
846 | |
} |
847 | 9 | else if ( checkFieldWithDuplicate( parser, "baseDirectory", null, parsed ) ) |
848 | |
{ |
849 | 0 | assembly.setBaseDirectory( getTrimmedValue( parser.nextText() ) ); |
850 | |
} |
851 | 9 | else if ( checkFieldWithDuplicate( parser, "includeSiteDirectory", null, parsed ) ) |
852 | |
{ |
853 | 1 | assembly.setIncludeSiteDirectory( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeSiteDirectory", parser, "false" ) ); |
854 | |
} |
855 | 8 | else if ( checkFieldWithDuplicate( parser, "containerDescriptorHandlers", null, parsed ) ) |
856 | |
{ |
857 | 0 | java.util.List containerDescriptorHandlers = new java.util.ArrayList(); |
858 | 0 | assembly.setContainerDescriptorHandlers( containerDescriptorHandlers ); |
859 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
860 | |
{ |
861 | 0 | if ( "containerDescriptorHandler".equals( parser.getName() ) ) |
862 | |
{ |
863 | 0 | containerDescriptorHandlers.add( parseContainerDescriptorHandlerConfig( parser, strict ) ); |
864 | |
} |
865 | |
else |
866 | |
{ |
867 | 0 | checkUnknownElement( parser, strict ); |
868 | |
} |
869 | |
} |
870 | 0 | } |
871 | 8 | else if ( checkFieldWithDuplicate( parser, "moduleSets", null, parsed ) ) |
872 | |
{ |
873 | 0 | java.util.List moduleSets = new java.util.ArrayList(); |
874 | 0 | assembly.setModuleSets( moduleSets ); |
875 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
876 | |
{ |
877 | 0 | if ( "moduleSet".equals( parser.getName() ) ) |
878 | |
{ |
879 | 0 | moduleSets.add( parseModuleSet( parser, strict ) ); |
880 | |
} |
881 | |
else |
882 | |
{ |
883 | 0 | checkUnknownElement( parser, strict ); |
884 | |
} |
885 | |
} |
886 | 0 | } |
887 | 8 | else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) ) |
888 | |
{ |
889 | 6 | java.util.List fileSets = new java.util.ArrayList(); |
890 | 6 | assembly.setFileSets( fileSets ); |
891 | 19 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
892 | |
{ |
893 | 13 | if ( "fileSet".equals( parser.getName() ) ) |
894 | |
{ |
895 | 13 | fileSets.add( parseFileSet( parser, strict ) ); |
896 | |
} |
897 | |
else |
898 | |
{ |
899 | 0 | checkUnknownElement( parser, strict ); |
900 | |
} |
901 | |
} |
902 | 6 | } |
903 | 2 | else if ( checkFieldWithDuplicate( parser, "files", null, parsed ) ) |
904 | |
{ |
905 | 0 | java.util.List files = new java.util.ArrayList(); |
906 | 0 | assembly.setFiles( files ); |
907 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
908 | |
{ |
909 | 0 | if ( "file".equals( parser.getName() ) ) |
910 | |
{ |
911 | 0 | files.add( parseFileItem( parser, strict ) ); |
912 | |
} |
913 | |
else |
914 | |
{ |
915 | 0 | checkUnknownElement( parser, strict ); |
916 | |
} |
917 | |
} |
918 | 0 | } |
919 | 2 | else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) ) |
920 | |
{ |
921 | 0 | java.util.List dependencySets = new java.util.ArrayList(); |
922 | 0 | assembly.setDependencySets( dependencySets ); |
923 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
924 | |
{ |
925 | 0 | if ( "dependencySet".equals( parser.getName() ) ) |
926 | |
{ |
927 | 0 | dependencySets.add( parseDependencySet( parser, strict ) ); |
928 | |
} |
929 | |
else |
930 | |
{ |
931 | 0 | checkUnknownElement( parser, strict ); |
932 | |
} |
933 | |
} |
934 | 0 | } |
935 | 2 | else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) ) |
936 | |
{ |
937 | 0 | java.util.List repositories = new java.util.ArrayList(); |
938 | 0 | assembly.setRepositories( repositories ); |
939 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
940 | |
{ |
941 | 0 | if ( "repository".equals( parser.getName() ) ) |
942 | |
{ |
943 | 0 | repositories.add( parseRepository( parser, strict ) ); |
944 | |
} |
945 | |
else |
946 | |
{ |
947 | 0 | checkUnknownElement( parser, strict ); |
948 | |
} |
949 | |
} |
950 | 0 | } |
951 | 2 | else if ( checkFieldWithDuplicate( parser, "componentDescriptors", null, parsed ) ) |
952 | |
{ |
953 | 2 | java.util.List componentDescriptors = new java.util.ArrayList(); |
954 | 2 | assembly.setComponentDescriptors( componentDescriptors ); |
955 | 4 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
956 | |
{ |
957 | 2 | if ( "componentDescriptor".equals( parser.getName() ) ) |
958 | |
{ |
959 | 2 | componentDescriptors.add( getTrimmedValue( parser.nextText() ) ); |
960 | |
} |
961 | |
else |
962 | |
{ |
963 | 0 | checkUnknownElement( parser, strict ); |
964 | |
} |
965 | |
} |
966 | 2 | } |
967 | |
else |
968 | |
{ |
969 | 0 | checkUnknownElement( parser, strict ); |
970 | |
} |
971 | |
} |
972 | 18 | return assembly; |
973 | |
} |
974 | |
|
975 | |
|
976 | |
|
977 | |
|
978 | |
|
979 | |
|
980 | |
|
981 | |
|
982 | |
|
983 | |
|
984 | |
private ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser parser, boolean strict ) |
985 | |
throws IOException, XmlPullParserException |
986 | |
{ |
987 | 0 | String tagName = parser.getName(); |
988 | 0 | ContainerDescriptorHandlerConfig containerDescriptorHandlerConfig = new ContainerDescriptorHandlerConfig(); |
989 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
990 | |
{ |
991 | 0 | String name = parser.getAttributeName( i ); |
992 | 0 | String value = parser.getAttributeValue( i ); |
993 | |
|
994 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
995 | |
{ |
996 | |
|
997 | |
} |
998 | |
else |
999 | |
{ |
1000 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1001 | |
} |
1002 | |
} |
1003 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1004 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1005 | |
{ |
1006 | 0 | if ( checkFieldWithDuplicate( parser, "handlerName", null, parsed ) ) |
1007 | |
{ |
1008 | 0 | containerDescriptorHandlerConfig.setHandlerName( getTrimmedValue( parser.nextText() ) ); |
1009 | |
} |
1010 | 0 | else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) ) |
1011 | |
{ |
1012 | 0 | containerDescriptorHandlerConfig.setConfiguration( Xpp3DomBuilder.build( parser ) ); |
1013 | |
} |
1014 | |
else |
1015 | |
{ |
1016 | 0 | checkUnknownElement( parser, strict ); |
1017 | |
} |
1018 | |
} |
1019 | 0 | return containerDescriptorHandlerConfig; |
1020 | |
} |
1021 | |
|
1022 | |
|
1023 | |
|
1024 | |
|
1025 | |
|
1026 | |
|
1027 | |
|
1028 | |
|
1029 | |
|
1030 | |
|
1031 | |
private DependencySet parseDependencySet( XmlPullParser parser, boolean strict ) |
1032 | |
throws IOException, XmlPullParserException |
1033 | |
{ |
1034 | 0 | String tagName = parser.getName(); |
1035 | 0 | DependencySet dependencySet = new DependencySet(); |
1036 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1037 | |
{ |
1038 | 0 | String name = parser.getAttributeName( i ); |
1039 | 0 | String value = parser.getAttributeValue( i ); |
1040 | |
|
1041 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1042 | |
{ |
1043 | |
|
1044 | |
} |
1045 | |
else |
1046 | |
{ |
1047 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1048 | |
} |
1049 | |
} |
1050 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1051 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1052 | |
{ |
1053 | 0 | if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1054 | |
{ |
1055 | 0 | dependencySet.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1056 | |
} |
1057 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1058 | |
{ |
1059 | 0 | java.util.List includes = new java.util.ArrayList(); |
1060 | 0 | dependencySet.setIncludes( includes ); |
1061 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1062 | |
{ |
1063 | 0 | if ( "include".equals( parser.getName() ) ) |
1064 | |
{ |
1065 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1066 | |
} |
1067 | |
else |
1068 | |
{ |
1069 | 0 | checkUnknownElement( parser, strict ); |
1070 | |
} |
1071 | |
} |
1072 | 0 | } |
1073 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1074 | |
{ |
1075 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1076 | 0 | dependencySet.setExcludes( excludes ); |
1077 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1078 | |
{ |
1079 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1080 | |
{ |
1081 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1082 | |
} |
1083 | |
else |
1084 | |
{ |
1085 | 0 | checkUnknownElement( parser, strict ); |
1086 | |
} |
1087 | |
} |
1088 | 0 | } |
1089 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1090 | |
{ |
1091 | 0 | dependencySet.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1092 | |
} |
1093 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1094 | |
{ |
1095 | 0 | dependencySet.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1096 | |
} |
1097 | 0 | else if ( checkFieldWithDuplicate( parser, "useStrictFiltering", null, parsed ) ) |
1098 | |
{ |
1099 | 0 | dependencySet.setUseStrictFiltering( getBooleanValue( getTrimmedValue( parser.nextText() ), "useStrictFiltering", parser, "false" ) ); |
1100 | |
} |
1101 | 0 | else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) ) |
1102 | |
{ |
1103 | 0 | dependencySet.setOutputFileNameMapping( getTrimmedValue( parser.nextText() ) ); |
1104 | |
} |
1105 | 0 | else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) ) |
1106 | |
{ |
1107 | 0 | dependencySet.setUnpack( getBooleanValue( getTrimmedValue( parser.nextText() ), "unpack", parser, "false" ) ); |
1108 | |
} |
1109 | 0 | else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) ) |
1110 | |
{ |
1111 | 0 | dependencySet.setUnpackOptions( parseUnpackOptions( parser, strict ) ); |
1112 | |
} |
1113 | 0 | else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) ) |
1114 | |
{ |
1115 | 0 | dependencySet.setScope( getTrimmedValue( parser.nextText() ) ); |
1116 | |
} |
1117 | 0 | else if ( checkFieldWithDuplicate( parser, "useProjectArtifact", null, parsed ) ) |
1118 | |
{ |
1119 | 0 | dependencySet.setUseProjectArtifact( getBooleanValue( getTrimmedValue( parser.nextText() ), "useProjectArtifact", parser, "true" ) ); |
1120 | |
} |
1121 | 0 | else if ( checkFieldWithDuplicate( parser, "useProjectAttachments", null, parsed ) ) |
1122 | |
{ |
1123 | 0 | dependencySet.setUseProjectAttachments( getBooleanValue( getTrimmedValue( parser.nextText() ), "useProjectAttachments", parser, "false" ) ); |
1124 | |
} |
1125 | 0 | else if ( checkFieldWithDuplicate( parser, "useTransitiveDependencies", null, parsed ) ) |
1126 | |
{ |
1127 | 0 | dependencySet.setUseTransitiveDependencies( getBooleanValue( getTrimmedValue( parser.nextText() ), "useTransitiveDependencies", parser, "true" ) ); |
1128 | |
} |
1129 | 0 | else if ( checkFieldWithDuplicate( parser, "useTransitiveFiltering", null, parsed ) ) |
1130 | |
{ |
1131 | 0 | dependencySet.setUseTransitiveFiltering( getBooleanValue( getTrimmedValue( parser.nextText() ), "useTransitiveFiltering", parser, "false" ) ); |
1132 | |
} |
1133 | |
else |
1134 | |
{ |
1135 | 0 | checkUnknownElement( parser, strict ); |
1136 | |
} |
1137 | |
} |
1138 | 0 | return dependencySet; |
1139 | |
} |
1140 | |
|
1141 | |
|
1142 | |
|
1143 | |
|
1144 | |
|
1145 | |
|
1146 | |
|
1147 | |
|
1148 | |
|
1149 | |
|
1150 | |
private FileItem parseFileItem( XmlPullParser parser, boolean strict ) |
1151 | |
throws IOException, XmlPullParserException |
1152 | |
{ |
1153 | 0 | String tagName = parser.getName(); |
1154 | 0 | FileItem fileItem = new FileItem(); |
1155 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1156 | |
{ |
1157 | 0 | String name = parser.getAttributeName( i ); |
1158 | 0 | String value = parser.getAttributeValue( i ); |
1159 | |
|
1160 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1161 | |
{ |
1162 | |
|
1163 | |
} |
1164 | |
else |
1165 | |
{ |
1166 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1167 | |
} |
1168 | |
} |
1169 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1170 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1171 | |
{ |
1172 | 0 | if ( checkFieldWithDuplicate( parser, "source", null, parsed ) ) |
1173 | |
{ |
1174 | 0 | fileItem.setSource( getTrimmedValue( parser.nextText() ) ); |
1175 | |
} |
1176 | 0 | else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1177 | |
{ |
1178 | 0 | fileItem.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1179 | |
} |
1180 | 0 | else if ( checkFieldWithDuplicate( parser, "destName", null, parsed ) ) |
1181 | |
{ |
1182 | 0 | fileItem.setDestName( getTrimmedValue( parser.nextText() ) ); |
1183 | |
} |
1184 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1185 | |
{ |
1186 | 0 | fileItem.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1187 | |
} |
1188 | 0 | else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) ) |
1189 | |
{ |
1190 | 0 | fileItem.setLineEnding( getTrimmedValue( parser.nextText() ) ); |
1191 | |
} |
1192 | 0 | else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) ) |
1193 | |
{ |
1194 | 0 | fileItem.setFiltered( getBooleanValue( getTrimmedValue( parser.nextText() ), "filtered", parser, "false" ) ); |
1195 | |
} |
1196 | |
else |
1197 | |
{ |
1198 | 0 | checkUnknownElement( parser, strict ); |
1199 | |
} |
1200 | |
} |
1201 | 0 | return fileItem; |
1202 | |
} |
1203 | |
|
1204 | |
|
1205 | |
|
1206 | |
|
1207 | |
|
1208 | |
|
1209 | |
|
1210 | |
|
1211 | |
|
1212 | |
|
1213 | |
private FileSet parseFileSet( XmlPullParser parser, boolean strict ) |
1214 | |
throws IOException, XmlPullParserException |
1215 | |
{ |
1216 | 13 | String tagName = parser.getName(); |
1217 | 13 | FileSet fileSet = new FileSet(); |
1218 | 13 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1219 | |
{ |
1220 | 0 | String name = parser.getAttributeName( i ); |
1221 | 0 | String value = parser.getAttributeValue( i ); |
1222 | |
|
1223 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1224 | |
{ |
1225 | |
|
1226 | |
} |
1227 | |
else |
1228 | |
{ |
1229 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1230 | |
} |
1231 | |
} |
1232 | 13 | java.util.Set parsed = new java.util.HashSet(); |
1233 | 44 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1234 | |
{ |
1235 | 31 | if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) ) |
1236 | |
{ |
1237 | 2 | fileSet.setUseDefaultExcludes( getBooleanValue( getTrimmedValue( parser.nextText() ), "useDefaultExcludes", parser, "true" ) ); |
1238 | |
} |
1239 | 29 | else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1240 | |
{ |
1241 | 9 | fileSet.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1242 | |
} |
1243 | 20 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1244 | |
{ |
1245 | 7 | java.util.List includes = new java.util.ArrayList(); |
1246 | 7 | fileSet.setIncludes( includes ); |
1247 | 23 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1248 | |
{ |
1249 | 16 | if ( "include".equals( parser.getName() ) ) |
1250 | |
{ |
1251 | 16 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1252 | |
} |
1253 | |
else |
1254 | |
{ |
1255 | 0 | checkUnknownElement( parser, strict ); |
1256 | |
} |
1257 | |
} |
1258 | 7 | } |
1259 | 13 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1260 | |
{ |
1261 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1262 | 0 | fileSet.setExcludes( excludes ); |
1263 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1264 | |
{ |
1265 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1266 | |
{ |
1267 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1268 | |
} |
1269 | |
else |
1270 | |
{ |
1271 | 0 | checkUnknownElement( parser, strict ); |
1272 | |
} |
1273 | |
} |
1274 | 0 | } |
1275 | 13 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1276 | |
{ |
1277 | 0 | fileSet.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1278 | |
} |
1279 | 13 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1280 | |
{ |
1281 | 0 | fileSet.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1282 | |
} |
1283 | 13 | else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) ) |
1284 | |
{ |
1285 | 13 | fileSet.setDirectory( getTrimmedValue( parser.nextText() ) ); |
1286 | |
} |
1287 | 0 | else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) ) |
1288 | |
{ |
1289 | 0 | fileSet.setLineEnding( getTrimmedValue( parser.nextText() ) ); |
1290 | |
} |
1291 | 0 | else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) ) |
1292 | |
{ |
1293 | 0 | fileSet.setFiltered( getBooleanValue( getTrimmedValue( parser.nextText() ), "filtered", parser, "false" ) ); |
1294 | |
} |
1295 | |
else |
1296 | |
{ |
1297 | 0 | checkUnknownElement( parser, strict ); |
1298 | |
} |
1299 | |
} |
1300 | 13 | return fileSet; |
1301 | |
} |
1302 | |
|
1303 | |
|
1304 | |
|
1305 | |
|
1306 | |
|
1307 | |
|
1308 | |
|
1309 | |
|
1310 | |
|
1311 | |
|
1312 | |
private GroupVersionAlignment parseGroupVersionAlignment( XmlPullParser parser, boolean strict ) |
1313 | |
throws IOException, XmlPullParserException |
1314 | |
{ |
1315 | 0 | String tagName = parser.getName(); |
1316 | 0 | GroupVersionAlignment groupVersionAlignment = new GroupVersionAlignment(); |
1317 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1318 | |
{ |
1319 | 0 | String name = parser.getAttributeName( i ); |
1320 | 0 | String value = parser.getAttributeValue( i ); |
1321 | |
|
1322 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1323 | |
{ |
1324 | |
|
1325 | |
} |
1326 | |
else |
1327 | |
{ |
1328 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1329 | |
} |
1330 | |
} |
1331 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1332 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1333 | |
{ |
1334 | 0 | if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
1335 | |
{ |
1336 | 0 | groupVersionAlignment.setId( getTrimmedValue( parser.nextText() ) ); |
1337 | |
} |
1338 | 0 | else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) ) |
1339 | |
{ |
1340 | 0 | groupVersionAlignment.setVersion( getTrimmedValue( parser.nextText() ) ); |
1341 | |
} |
1342 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1343 | |
{ |
1344 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1345 | 0 | groupVersionAlignment.setExcludes( excludes ); |
1346 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1347 | |
{ |
1348 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1349 | |
{ |
1350 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1351 | |
} |
1352 | |
else |
1353 | |
{ |
1354 | 0 | checkUnknownElement( parser, strict ); |
1355 | |
} |
1356 | |
} |
1357 | 0 | } |
1358 | |
else |
1359 | |
{ |
1360 | 0 | checkUnknownElement( parser, strict ); |
1361 | |
} |
1362 | |
} |
1363 | 0 | return groupVersionAlignment; |
1364 | |
} |
1365 | |
|
1366 | |
|
1367 | |
|
1368 | |
|
1369 | |
|
1370 | |
|
1371 | |
|
1372 | |
|
1373 | |
|
1374 | |
|
1375 | |
private ModuleBinaries parseModuleBinaries( XmlPullParser parser, boolean strict ) |
1376 | |
throws IOException, XmlPullParserException |
1377 | |
{ |
1378 | 0 | String tagName = parser.getName(); |
1379 | 0 | ModuleBinaries moduleBinaries = new ModuleBinaries(); |
1380 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1381 | |
{ |
1382 | 0 | String name = parser.getAttributeName( i ); |
1383 | 0 | String value = parser.getAttributeValue( i ); |
1384 | |
|
1385 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1386 | |
{ |
1387 | |
|
1388 | |
} |
1389 | |
else |
1390 | |
{ |
1391 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1392 | |
} |
1393 | |
} |
1394 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1395 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1396 | |
{ |
1397 | 0 | if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1398 | |
{ |
1399 | 0 | moduleBinaries.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1400 | |
} |
1401 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1402 | |
{ |
1403 | 0 | java.util.List includes = new java.util.ArrayList(); |
1404 | 0 | moduleBinaries.setIncludes( includes ); |
1405 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1406 | |
{ |
1407 | 0 | if ( "include".equals( parser.getName() ) ) |
1408 | |
{ |
1409 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1410 | |
} |
1411 | |
else |
1412 | |
{ |
1413 | 0 | checkUnknownElement( parser, strict ); |
1414 | |
} |
1415 | |
} |
1416 | 0 | } |
1417 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1418 | |
{ |
1419 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1420 | 0 | moduleBinaries.setExcludes( excludes ); |
1421 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1422 | |
{ |
1423 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1424 | |
{ |
1425 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1426 | |
} |
1427 | |
else |
1428 | |
{ |
1429 | 0 | checkUnknownElement( parser, strict ); |
1430 | |
} |
1431 | |
} |
1432 | 0 | } |
1433 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1434 | |
{ |
1435 | 0 | moduleBinaries.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1436 | |
} |
1437 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1438 | |
{ |
1439 | 0 | moduleBinaries.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1440 | |
} |
1441 | 0 | else if ( checkFieldWithDuplicate( parser, "attachmentClassifier", null, parsed ) ) |
1442 | |
{ |
1443 | 0 | moduleBinaries.setAttachmentClassifier( getTrimmedValue( parser.nextText() ) ); |
1444 | |
} |
1445 | 0 | else if ( checkFieldWithDuplicate( parser, "includeDependencies", null, parsed ) ) |
1446 | |
{ |
1447 | 0 | moduleBinaries.setIncludeDependencies( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeDependencies", parser, "true" ) ); |
1448 | |
} |
1449 | 0 | else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) ) |
1450 | |
{ |
1451 | 0 | java.util.List dependencySets = new java.util.ArrayList(); |
1452 | 0 | moduleBinaries.setDependencySets( dependencySets ); |
1453 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1454 | |
{ |
1455 | 0 | if ( "dependencySet".equals( parser.getName() ) ) |
1456 | |
{ |
1457 | 0 | dependencySets.add( parseDependencySet( parser, strict ) ); |
1458 | |
} |
1459 | |
else |
1460 | |
{ |
1461 | 0 | checkUnknownElement( parser, strict ); |
1462 | |
} |
1463 | |
} |
1464 | 0 | } |
1465 | 0 | else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) ) |
1466 | |
{ |
1467 | 0 | moduleBinaries.setUnpack( getBooleanValue( getTrimmedValue( parser.nextText() ), "unpack", parser, "true" ) ); |
1468 | |
} |
1469 | 0 | else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) ) |
1470 | |
{ |
1471 | 0 | moduleBinaries.setUnpackOptions( parseUnpackOptions( parser, strict ) ); |
1472 | |
} |
1473 | 0 | else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) ) |
1474 | |
{ |
1475 | 0 | moduleBinaries.setOutputFileNameMapping( getTrimmedValue( parser.nextText() ) ); |
1476 | |
} |
1477 | |
else |
1478 | |
{ |
1479 | 0 | checkUnknownElement( parser, strict ); |
1480 | |
} |
1481 | |
} |
1482 | 0 | return moduleBinaries; |
1483 | |
} |
1484 | |
|
1485 | |
|
1486 | |
|
1487 | |
|
1488 | |
|
1489 | |
|
1490 | |
|
1491 | |
|
1492 | |
|
1493 | |
|
1494 | |
private ModuleSet parseModuleSet( XmlPullParser parser, boolean strict ) |
1495 | |
throws IOException, XmlPullParserException |
1496 | |
{ |
1497 | 0 | String tagName = parser.getName(); |
1498 | 0 | ModuleSet moduleSet = new ModuleSet(); |
1499 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1500 | |
{ |
1501 | 0 | String name = parser.getAttributeName( i ); |
1502 | 0 | String value = parser.getAttributeValue( i ); |
1503 | |
|
1504 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1505 | |
{ |
1506 | |
|
1507 | |
} |
1508 | |
else |
1509 | |
{ |
1510 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1511 | |
} |
1512 | |
} |
1513 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1514 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1515 | |
{ |
1516 | 0 | if ( checkFieldWithDuplicate( parser, "useAllReactorProjects", null, parsed ) ) |
1517 | |
{ |
1518 | 0 | moduleSet.setUseAllReactorProjects( getBooleanValue( getTrimmedValue( parser.nextText() ), "useAllReactorProjects", parser, "false" ) ); |
1519 | |
} |
1520 | 0 | else if ( checkFieldWithDuplicate( parser, "includeSubModules", null, parsed ) ) |
1521 | |
{ |
1522 | 0 | moduleSet.setIncludeSubModules( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeSubModules", parser, "true" ) ); |
1523 | |
} |
1524 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1525 | |
{ |
1526 | 0 | java.util.List includes = new java.util.ArrayList(); |
1527 | 0 | moduleSet.setIncludes( includes ); |
1528 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1529 | |
{ |
1530 | 0 | if ( "include".equals( parser.getName() ) ) |
1531 | |
{ |
1532 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1533 | |
} |
1534 | |
else |
1535 | |
{ |
1536 | 0 | checkUnknownElement( parser, strict ); |
1537 | |
} |
1538 | |
} |
1539 | 0 | } |
1540 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1541 | |
{ |
1542 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1543 | 0 | moduleSet.setExcludes( excludes ); |
1544 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1545 | |
{ |
1546 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1547 | |
{ |
1548 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1549 | |
} |
1550 | |
else |
1551 | |
{ |
1552 | 0 | checkUnknownElement( parser, strict ); |
1553 | |
} |
1554 | |
} |
1555 | 0 | } |
1556 | 0 | else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) ) |
1557 | |
{ |
1558 | 0 | moduleSet.setSources( parseModuleSources( parser, strict ) ); |
1559 | |
} |
1560 | 0 | else if ( checkFieldWithDuplicate( parser, "binaries", null, parsed ) ) |
1561 | |
{ |
1562 | 0 | moduleSet.setBinaries( parseModuleBinaries( parser, strict ) ); |
1563 | |
} |
1564 | |
else |
1565 | |
{ |
1566 | 0 | checkUnknownElement( parser, strict ); |
1567 | |
} |
1568 | |
} |
1569 | 0 | return moduleSet; |
1570 | |
} |
1571 | |
|
1572 | |
|
1573 | |
|
1574 | |
|
1575 | |
|
1576 | |
|
1577 | |
|
1578 | |
|
1579 | |
|
1580 | |
|
1581 | |
private ModuleSources parseModuleSources( XmlPullParser parser, boolean strict ) |
1582 | |
throws IOException, XmlPullParserException |
1583 | |
{ |
1584 | 0 | String tagName = parser.getName(); |
1585 | 0 | ModuleSources moduleSources = new ModuleSources(); |
1586 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1587 | |
{ |
1588 | 0 | String name = parser.getAttributeName( i ); |
1589 | 0 | String value = parser.getAttributeValue( i ); |
1590 | |
|
1591 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1592 | |
{ |
1593 | |
|
1594 | |
} |
1595 | |
else |
1596 | |
{ |
1597 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1598 | |
} |
1599 | |
} |
1600 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1601 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1602 | |
{ |
1603 | 0 | if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) ) |
1604 | |
{ |
1605 | 0 | moduleSources.setUseDefaultExcludes( getBooleanValue( getTrimmedValue( parser.nextText() ), "useDefaultExcludes", parser, "true" ) ); |
1606 | |
} |
1607 | 0 | else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1608 | |
{ |
1609 | 0 | moduleSources.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1610 | |
} |
1611 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1612 | |
{ |
1613 | 0 | java.util.List includes = new java.util.ArrayList(); |
1614 | 0 | moduleSources.setIncludes( includes ); |
1615 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1616 | |
{ |
1617 | 0 | if ( "include".equals( parser.getName() ) ) |
1618 | |
{ |
1619 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1620 | |
} |
1621 | |
else |
1622 | |
{ |
1623 | 0 | checkUnknownElement( parser, strict ); |
1624 | |
} |
1625 | |
} |
1626 | 0 | } |
1627 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1628 | |
{ |
1629 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1630 | 0 | moduleSources.setExcludes( excludes ); |
1631 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1632 | |
{ |
1633 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1634 | |
{ |
1635 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1636 | |
} |
1637 | |
else |
1638 | |
{ |
1639 | 0 | checkUnknownElement( parser, strict ); |
1640 | |
} |
1641 | |
} |
1642 | 0 | } |
1643 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1644 | |
{ |
1645 | 0 | moduleSources.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1646 | |
} |
1647 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1648 | |
{ |
1649 | 0 | moduleSources.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1650 | |
} |
1651 | 0 | else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) ) |
1652 | |
{ |
1653 | 0 | java.util.List fileSets = new java.util.ArrayList(); |
1654 | 0 | moduleSources.setFileSets( fileSets ); |
1655 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1656 | |
{ |
1657 | 0 | if ( "fileSet".equals( parser.getName() ) ) |
1658 | |
{ |
1659 | 0 | fileSets.add( parseFileSet( parser, strict ) ); |
1660 | |
} |
1661 | |
else |
1662 | |
{ |
1663 | 0 | checkUnknownElement( parser, strict ); |
1664 | |
} |
1665 | |
} |
1666 | 0 | } |
1667 | 0 | else if ( checkFieldWithDuplicate( parser, "includeModuleDirectory", null, parsed ) ) |
1668 | |
{ |
1669 | 0 | moduleSources.setIncludeModuleDirectory( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeModuleDirectory", parser, "true" ) ); |
1670 | |
} |
1671 | 0 | else if ( checkFieldWithDuplicate( parser, "excludeSubModuleDirectories", null, parsed ) ) |
1672 | |
{ |
1673 | 0 | moduleSources.setExcludeSubModuleDirectories( getBooleanValue( getTrimmedValue( parser.nextText() ), "excludeSubModuleDirectories", parser, "true" ) ); |
1674 | |
} |
1675 | 0 | else if ( checkFieldWithDuplicate( parser, "outputDirectoryMapping", null, parsed ) ) |
1676 | |
{ |
1677 | 0 | moduleSources.setOutputDirectoryMapping( getTrimmedValue( parser.nextText() ) ); |
1678 | |
} |
1679 | |
else |
1680 | |
{ |
1681 | 0 | checkUnknownElement( parser, strict ); |
1682 | |
} |
1683 | |
} |
1684 | 0 | return moduleSources; |
1685 | |
} |
1686 | |
|
1687 | |
|
1688 | |
|
1689 | |
|
1690 | |
|
1691 | |
|
1692 | |
|
1693 | |
|
1694 | |
|
1695 | |
|
1696 | |
private Repository parseRepository( XmlPullParser parser, boolean strict ) |
1697 | |
throws IOException, XmlPullParserException |
1698 | |
{ |
1699 | 0 | String tagName = parser.getName(); |
1700 | 0 | Repository repository = new Repository(); |
1701 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1702 | |
{ |
1703 | 0 | String name = parser.getAttributeName( i ); |
1704 | 0 | String value = parser.getAttributeValue( i ); |
1705 | |
|
1706 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1707 | |
{ |
1708 | |
|
1709 | |
} |
1710 | |
else |
1711 | |
{ |
1712 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1713 | |
} |
1714 | |
} |
1715 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1716 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1717 | |
{ |
1718 | 0 | if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) ) |
1719 | |
{ |
1720 | 0 | repository.setOutputDirectory( getTrimmedValue( parser.nextText() ) ); |
1721 | |
} |
1722 | 0 | else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1723 | |
{ |
1724 | 0 | java.util.List includes = new java.util.ArrayList(); |
1725 | 0 | repository.setIncludes( includes ); |
1726 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1727 | |
{ |
1728 | 0 | if ( "include".equals( parser.getName() ) ) |
1729 | |
{ |
1730 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1731 | |
} |
1732 | |
else |
1733 | |
{ |
1734 | 0 | checkUnknownElement( parser, strict ); |
1735 | |
} |
1736 | |
} |
1737 | 0 | } |
1738 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1739 | |
{ |
1740 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1741 | 0 | repository.setExcludes( excludes ); |
1742 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1743 | |
{ |
1744 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1745 | |
{ |
1746 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1747 | |
} |
1748 | |
else |
1749 | |
{ |
1750 | 0 | checkUnknownElement( parser, strict ); |
1751 | |
} |
1752 | |
} |
1753 | 0 | } |
1754 | 0 | else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) ) |
1755 | |
{ |
1756 | 0 | repository.setFileMode( getTrimmedValue( parser.nextText() ) ); |
1757 | |
} |
1758 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) ) |
1759 | |
{ |
1760 | 0 | repository.setDirectoryMode( getTrimmedValue( parser.nextText() ) ); |
1761 | |
} |
1762 | 0 | else if ( checkFieldWithDuplicate( parser, "includeMetadata", null, parsed ) ) |
1763 | |
{ |
1764 | 0 | repository.setIncludeMetadata( getBooleanValue( getTrimmedValue( parser.nextText() ), "includeMetadata", parser, "false" ) ); |
1765 | |
} |
1766 | 0 | else if ( checkFieldWithDuplicate( parser, "groupVersionAlignments", null, parsed ) ) |
1767 | |
{ |
1768 | 0 | java.util.List groupVersionAlignments = new java.util.ArrayList(); |
1769 | 0 | repository.setGroupVersionAlignments( groupVersionAlignments ); |
1770 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1771 | |
{ |
1772 | 0 | if ( "groupVersionAlignment".equals( parser.getName() ) ) |
1773 | |
{ |
1774 | 0 | groupVersionAlignments.add( parseGroupVersionAlignment( parser, strict ) ); |
1775 | |
} |
1776 | |
else |
1777 | |
{ |
1778 | 0 | checkUnknownElement( parser, strict ); |
1779 | |
} |
1780 | |
} |
1781 | 0 | } |
1782 | 0 | else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) ) |
1783 | |
{ |
1784 | 0 | repository.setScope( getTrimmedValue( parser.nextText() ) ); |
1785 | |
} |
1786 | |
else |
1787 | |
{ |
1788 | 0 | checkUnknownElement( parser, strict ); |
1789 | |
} |
1790 | |
} |
1791 | 0 | return repository; |
1792 | |
} |
1793 | |
|
1794 | |
|
1795 | |
|
1796 | |
|
1797 | |
|
1798 | |
|
1799 | |
|
1800 | |
|
1801 | |
|
1802 | |
|
1803 | |
private UnpackOptions parseUnpackOptions( XmlPullParser parser, boolean strict ) |
1804 | |
throws IOException, XmlPullParserException |
1805 | |
{ |
1806 | 0 | String tagName = parser.getName(); |
1807 | 0 | UnpackOptions unpackOptions = new UnpackOptions(); |
1808 | 0 | for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) |
1809 | |
{ |
1810 | 0 | String name = parser.getAttributeName( i ); |
1811 | 0 | String value = parser.getAttributeValue( i ); |
1812 | |
|
1813 | 0 | if ( name.indexOf( ':' ) >= 0 ) |
1814 | |
{ |
1815 | |
|
1816 | |
} |
1817 | |
else |
1818 | |
{ |
1819 | 0 | checkUnknownAttribute( parser, name, tagName, strict ); |
1820 | |
} |
1821 | |
} |
1822 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1823 | 0 | while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) |
1824 | |
{ |
1825 | 0 | if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) ) |
1826 | |
{ |
1827 | 0 | java.util.List includes = new java.util.ArrayList(); |
1828 | 0 | unpackOptions.setIncludes( includes ); |
1829 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1830 | |
{ |
1831 | 0 | if ( "include".equals( parser.getName() ) ) |
1832 | |
{ |
1833 | 0 | includes.add( getTrimmedValue( parser.nextText() ) ); |
1834 | |
} |
1835 | |
else |
1836 | |
{ |
1837 | 0 | checkUnknownElement( parser, strict ); |
1838 | |
} |
1839 | |
} |
1840 | 0 | } |
1841 | 0 | else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) ) |
1842 | |
{ |
1843 | 0 | java.util.List excludes = new java.util.ArrayList(); |
1844 | 0 | unpackOptions.setExcludes( excludes ); |
1845 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1846 | |
{ |
1847 | 0 | if ( "exclude".equals( parser.getName() ) ) |
1848 | |
{ |
1849 | 0 | excludes.add( getTrimmedValue( parser.nextText() ) ); |
1850 | |
} |
1851 | |
else |
1852 | |
{ |
1853 | 0 | checkUnknownElement( parser, strict ); |
1854 | |
} |
1855 | |
} |
1856 | 0 | } |
1857 | 0 | else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) ) |
1858 | |
{ |
1859 | 0 | unpackOptions.setFiltered( getBooleanValue( getTrimmedValue( parser.nextText() ), "filtered", parser, "false" ) ); |
1860 | |
} |
1861 | 0 | else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) ) |
1862 | |
{ |
1863 | 0 | unpackOptions.setLineEnding( getTrimmedValue( parser.nextText() ) ); |
1864 | |
} |
1865 | 0 | else if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) ) |
1866 | |
{ |
1867 | 0 | unpackOptions.setUseDefaultExcludes( getBooleanValue( getTrimmedValue( parser.nextText() ), "useDefaultExcludes", parser, "true" ) ); |
1868 | |
} |
1869 | |
else |
1870 | |
{ |
1871 | 0 | checkUnknownElement( parser, strict ); |
1872 | |
} |
1873 | |
} |
1874 | 0 | return unpackOptions; |
1875 | |
} |
1876 | |
|
1877 | |
|
1878 | |
|
1879 | |
|
1880 | |
|
1881 | |
|
1882 | |
|
1883 | |
|
1884 | |
|
1885 | |
|
1886 | |
public Assembly read( Reader reader, boolean strict ) |
1887 | |
throws IOException, XmlPullParserException |
1888 | |
{ |
1889 | 18 | XmlPullParser parser = new MXParser(); |
1890 | |
|
1891 | 18 | parser.setInput( reader ); |
1892 | |
|
1893 | 18 | initParser( parser ); |
1894 | |
|
1895 | 18 | return read( parser, strict ); |
1896 | |
} |
1897 | |
|
1898 | |
|
1899 | |
|
1900 | |
|
1901 | |
|
1902 | |
|
1903 | |
|
1904 | |
|
1905 | |
|
1906 | |
public Assembly read( Reader reader ) |
1907 | |
throws IOException, XmlPullParserException |
1908 | |
{ |
1909 | 18 | return read( reader, true ); |
1910 | |
} |
1911 | |
|
1912 | |
|
1913 | |
|
1914 | |
|
1915 | |
|
1916 | |
|
1917 | |
|
1918 | |
|
1919 | |
|
1920 | |
|
1921 | |
public Assembly read( InputStream in, boolean strict ) |
1922 | |
throws IOException, XmlPullParserException |
1923 | |
{ |
1924 | 0 | return read( ReaderFactory.newXmlReader( in ), strict ); |
1925 | |
} |
1926 | |
|
1927 | |
|
1928 | |
|
1929 | |
|
1930 | |
|
1931 | |
|
1932 | |
|
1933 | |
|
1934 | |
|
1935 | |
public Assembly read( InputStream in ) |
1936 | |
throws IOException, XmlPullParserException |
1937 | |
{ |
1938 | 0 | return read( ReaderFactory.newXmlReader( in ) ); |
1939 | |
} |
1940 | |
|
1941 | |
|
1942 | |
|
1943 | |
|
1944 | |
|
1945 | |
|
1946 | |
|
1947 | |
|
1948 | |
|
1949 | |
|
1950 | |
private Assembly read( XmlPullParser parser, boolean strict ) |
1951 | |
throws IOException, XmlPullParserException |
1952 | |
{ |
1953 | 18 | int eventType = parser.getEventType(); |
1954 | 36 | while ( eventType != XmlPullParser.END_DOCUMENT ) |
1955 | |
{ |
1956 | 36 | if ( eventType == XmlPullParser.START_TAG ) |
1957 | |
{ |
1958 | 18 | if ( strict && ! "assembly".equals( parser.getName() ) ) |
1959 | |
{ |
1960 | 0 | throw new XmlPullParserException( "Expected root element 'assembly' but found '" + parser.getName() + "'", parser, null ); |
1961 | |
} |
1962 | 18 | Assembly assembly = parseAssembly( parser, strict ); |
1963 | 18 | assembly.setModelEncoding( parser.getInputEncoding() ); |
1964 | 18 | return assembly; |
1965 | |
} |
1966 | 18 | eventType = parser.next(); |
1967 | |
} |
1968 | 0 | throw new XmlPullParserException( "Expected root element 'assembly' but found no element at all: invalid XML document", parser, null ); |
1969 | |
} |
1970 | |
|
1971 | |
|
1972 | |
|
1973 | |
|
1974 | |
|
1975 | |
|
1976 | |
public void setAddDefaultEntities( boolean addDefaultEntities ) |
1977 | |
{ |
1978 | 0 | this.addDefaultEntities = addDefaultEntities; |
1979 | 0 | } |
1980 | |
|
1981 | |
} |