001 /*
002 =================== DO NOT EDIT THIS FILE ====================
003 Generated by Modello 1.4.1 on 2013-02-24 03:34:48,
004 any modifications will be overwritten.
005 ==============================================================
006 */
007
008 package org.apache.maven.plugin.lifecycle.io.xpp3;
009
010 //---------------------------------/
011 //- Imported classes and packages -/
012 //---------------------------------/
013
014 import java.io.IOException;
015 import java.io.InputStream;
016 import java.io.Reader;
017 import java.text.DateFormat;
018 import java.util.Locale;
019 import org.apache.maven.plugin.lifecycle.Execution;
020 import org.apache.maven.plugin.lifecycle.Lifecycle;
021 import org.apache.maven.plugin.lifecycle.LifecycleConfiguration;
022 import org.apache.maven.plugin.lifecycle.Phase;
023 import org.codehaus.plexus.util.ReaderFactory;
024 import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
025 import org.codehaus.plexus.util.xml.pull.MXParser;
026 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
027 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
028
029 /**
030 * Class LifecycleMappingsXpp3Reader.
031 *
032 * @version $Revision$ $Date$
033 */
034 @SuppressWarnings( "all" )
035 public class LifecycleMappingsXpp3Reader
036 {
037
038 //--------------------------/
039 //- Class/Member Variables -/
040 //--------------------------/
041
042 /**
043 * If set the parser will be loaded with all single characters
044 * from the XHTML specification.
045 * The entities used:
046 * <ul>
047 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
048 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
049 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
050 * </ul>
051 */
052 private boolean addDefaultEntities = true;
053
054
055 //-----------/
056 //- Methods -/
057 //-----------/
058
059 /**
060 * Method checkFieldWithDuplicate.
061 *
062 * @param parser
063 * @param parsed
064 * @param alias
065 * @param tagName
066 * @throws XmlPullParserException
067 * @return boolean
068 */
069 private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
070 throws XmlPullParserException
071 {
072 if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
073 {
074 return false;
075 }
076 if ( !parsed.add( tagName ) )
077 {
078 throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
079 }
080 return true;
081 } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set )
082
083 /**
084 * Method checkUnknownAttribute.
085 *
086 * @param parser
087 * @param strict
088 * @param tagName
089 * @param attribute
090 * @throws XmlPullParserException
091 * @throws IOException
092 */
093 private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
094 throws XmlPullParserException, IOException
095 {
096 // strictXmlAttributes = true for model: if strict == true, not only elements are checked but attributes too
097 if ( strict )
098 {
099 throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
100 }
101 } //-- void checkUnknownAttribute( XmlPullParser, String, String, boolean )
102
103 /**
104 * Method checkUnknownElement.
105 *
106 * @param parser
107 * @param strict
108 * @throws XmlPullParserException
109 * @throws IOException
110 */
111 private void checkUnknownElement( XmlPullParser parser, boolean strict )
112 throws XmlPullParserException, IOException
113 {
114 if ( strict )
115 {
116 throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
117 }
118
119 for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
120 {
121 int eventType = parser.next();
122 if ( eventType == XmlPullParser.START_TAG )
123 {
124 unrecognizedTagCount++;
125 }
126 else if ( eventType == XmlPullParser.END_TAG )
127 {
128 unrecognizedTagCount--;
129 }
130 }
131 } //-- void checkUnknownElement( XmlPullParser, boolean )
132
133 /**
134 * Returns the state of the "add default entities" flag.
135 *
136 * @return boolean
137 */
138 public boolean getAddDefaultEntities()
139 {
140 return addDefaultEntities;
141 } //-- boolean getAddDefaultEntities()
142
143 /**
144 * Method getBooleanValue.
145 *
146 * @param s
147 * @param parser
148 * @param attribute
149 * @throws XmlPullParserException
150 * @return boolean
151 */
152 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
153 throws XmlPullParserException
154 {
155 return getBooleanValue( s, attribute, parser, null );
156 } //-- boolean getBooleanValue( String, String, XmlPullParser )
157
158 /**
159 * Method getBooleanValue.
160 *
161 * @param s
162 * @param defaultValue
163 * @param parser
164 * @param attribute
165 * @throws XmlPullParserException
166 * @return boolean
167 */
168 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
169 throws XmlPullParserException
170 {
171 if ( s != null && s.length() != 0 )
172 {
173 return Boolean.valueOf( s ).booleanValue();
174 }
175 if ( defaultValue != null )
176 {
177 return Boolean.valueOf( defaultValue ).booleanValue();
178 }
179 return false;
180 } //-- boolean getBooleanValue( String, String, XmlPullParser, String )
181
182 /**
183 * Method getByteValue.
184 *
185 * @param s
186 * @param strict
187 * @param parser
188 * @param attribute
189 * @throws XmlPullParserException
190 * @return byte
191 */
192 private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
193 throws XmlPullParserException
194 {
195 if ( s != null )
196 {
197 try
198 {
199 return Byte.valueOf( s ).byteValue();
200 }
201 catch ( NumberFormatException nfe )
202 {
203 if ( strict )
204 {
205 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
206 }
207 }
208 }
209 return 0;
210 } //-- byte getByteValue( String, String, XmlPullParser, boolean )
211
212 /**
213 * Method getCharacterValue.
214 *
215 * @param s
216 * @param parser
217 * @param attribute
218 * @throws XmlPullParserException
219 * @return char
220 */
221 private char getCharacterValue( String s, String attribute, XmlPullParser parser )
222 throws XmlPullParserException
223 {
224 if ( s != null )
225 {
226 return s.charAt( 0 );
227 }
228 return 0;
229 } //-- char getCharacterValue( String, String, XmlPullParser )
230
231 /**
232 * Method getDateValue.
233 *
234 * @param s
235 * @param parser
236 * @param attribute
237 * @throws XmlPullParserException
238 * @return Date
239 */
240 private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
241 throws XmlPullParserException
242 {
243 return getDateValue( s, attribute, null, parser );
244 } //-- java.util.Date getDateValue( String, String, XmlPullParser )
245
246 /**
247 * Method getDateValue.
248 *
249 * @param s
250 * @param parser
251 * @param dateFormat
252 * @param attribute
253 * @throws XmlPullParserException
254 * @return Date
255 */
256 private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
257 throws XmlPullParserException
258 {
259 if ( s != null )
260 {
261 String effectiveDateFormat = dateFormat;
262 if ( dateFormat == null )
263 {
264 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
265 }
266 if ( "long".equals( effectiveDateFormat ) )
267 {
268 try
269 {
270 return new java.util.Date( Long.parseLong( s ) );
271 }
272 catch ( NumberFormatException e )
273 {
274 throw new XmlPullParserException( e.getMessage(), parser, e );
275 }
276 }
277 else
278 {
279 try
280 {
281 DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US );
282 return dateParser.parse( s );
283 }
284 catch ( java.text.ParseException e )
285 {
286 throw new XmlPullParserException( e.getMessage(), parser, e );
287 }
288 }
289 }
290 return null;
291 } //-- java.util.Date getDateValue( String, String, String, XmlPullParser )
292
293 /**
294 * Method getDoubleValue.
295 *
296 * @param s
297 * @param strict
298 * @param parser
299 * @param attribute
300 * @throws XmlPullParserException
301 * @return double
302 */
303 private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
304 throws XmlPullParserException
305 {
306 if ( s != null )
307 {
308 try
309 {
310 return Double.valueOf( s ).doubleValue();
311 }
312 catch ( NumberFormatException nfe )
313 {
314 if ( strict )
315 {
316 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
317 }
318 }
319 }
320 return 0;
321 } //-- double getDoubleValue( String, String, XmlPullParser, boolean )
322
323 /**
324 * Method getFloatValue.
325 *
326 * @param s
327 * @param strict
328 * @param parser
329 * @param attribute
330 * @throws XmlPullParserException
331 * @return float
332 */
333 private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
334 throws XmlPullParserException
335 {
336 if ( s != null )
337 {
338 try
339 {
340 return Float.valueOf( s ).floatValue();
341 }
342 catch ( NumberFormatException nfe )
343 {
344 if ( strict )
345 {
346 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
347 }
348 }
349 }
350 return 0;
351 } //-- float getFloatValue( String, String, XmlPullParser, boolean )
352
353 /**
354 * Method getIntegerValue.
355 *
356 * @param s
357 * @param strict
358 * @param parser
359 * @param attribute
360 * @throws XmlPullParserException
361 * @return int
362 */
363 private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
364 throws XmlPullParserException
365 {
366 if ( s != null )
367 {
368 try
369 {
370 return Integer.valueOf( s ).intValue();
371 }
372 catch ( NumberFormatException nfe )
373 {
374 if ( strict )
375 {
376 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
377 }
378 }
379 }
380 return 0;
381 } //-- int getIntegerValue( String, String, XmlPullParser, boolean )
382
383 /**
384 * Method getLongValue.
385 *
386 * @param s
387 * @param strict
388 * @param parser
389 * @param attribute
390 * @throws XmlPullParserException
391 * @return long
392 */
393 private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
394 throws XmlPullParserException
395 {
396 if ( s != null )
397 {
398 try
399 {
400 return Long.valueOf( s ).longValue();
401 }
402 catch ( NumberFormatException nfe )
403 {
404 if ( strict )
405 {
406 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
407 }
408 }
409 }
410 return 0;
411 } //-- long getLongValue( String, String, XmlPullParser, boolean )
412
413 /**
414 * Method getRequiredAttributeValue.
415 *
416 * @param s
417 * @param strict
418 * @param parser
419 * @param attribute
420 * @throws XmlPullParserException
421 * @return String
422 */
423 private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
424 throws XmlPullParserException
425 {
426 if ( s == null )
427 {
428 if ( strict )
429 {
430 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
431 }
432 }
433 return s;
434 } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean )
435
436 /**
437 * Method getShortValue.
438 *
439 * @param s
440 * @param strict
441 * @param parser
442 * @param attribute
443 * @throws XmlPullParserException
444 * @return short
445 */
446 private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
447 throws XmlPullParserException
448 {
449 if ( s != null )
450 {
451 try
452 {
453 return Short.valueOf( s ).shortValue();
454 }
455 catch ( NumberFormatException nfe )
456 {
457 if ( strict )
458 {
459 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
460 }
461 }
462 }
463 return 0;
464 } //-- short getShortValue( String, String, XmlPullParser, boolean )
465
466 /**
467 * Method getTrimmedValue.
468 *
469 * @param s
470 * @return String
471 */
472 private String getTrimmedValue( String s )
473 {
474 if ( s != null )
475 {
476 s = s.trim();
477 }
478 return s;
479 } //-- String getTrimmedValue( String )
480
481 /**
482 * Method initParser.
483 *
484 * @param parser
485 * @throws XmlPullParserException
486 */
487 private void initParser( XmlPullParser parser )
488 throws XmlPullParserException
489 {
490 if ( addDefaultEntities )
491 {
492 // ----------------------------------------------------------------------
493 // Latin 1 entities
494 // ----------------------------------------------------------------------
495
496 parser.defineEntityReplacementText( "nbsp", "\u00a0" );
497 parser.defineEntityReplacementText( "iexcl", "\u00a1" );
498 parser.defineEntityReplacementText( "cent", "\u00a2" );
499 parser.defineEntityReplacementText( "pound", "\u00a3" );
500 parser.defineEntityReplacementText( "curren", "\u00a4" );
501 parser.defineEntityReplacementText( "yen", "\u00a5" );
502 parser.defineEntityReplacementText( "brvbar", "\u00a6" );
503 parser.defineEntityReplacementText( "sect", "\u00a7" );
504 parser.defineEntityReplacementText( "uml", "\u00a8" );
505 parser.defineEntityReplacementText( "copy", "\u00a9" );
506 parser.defineEntityReplacementText( "ordf", "\u00aa" );
507 parser.defineEntityReplacementText( "laquo", "\u00ab" );
508 parser.defineEntityReplacementText( "not", "\u00ac" );
509 parser.defineEntityReplacementText( "shy", "\u00ad" );
510 parser.defineEntityReplacementText( "reg", "\u00ae" );
511 parser.defineEntityReplacementText( "macr", "\u00af" );
512 parser.defineEntityReplacementText( "deg", "\u00b0" );
513 parser.defineEntityReplacementText( "plusmn", "\u00b1" );
514 parser.defineEntityReplacementText( "sup2", "\u00b2" );
515 parser.defineEntityReplacementText( "sup3", "\u00b3" );
516 parser.defineEntityReplacementText( "acute", "\u00b4" );
517 parser.defineEntityReplacementText( "micro", "\u00b5" );
518 parser.defineEntityReplacementText( "para", "\u00b6" );
519 parser.defineEntityReplacementText( "middot", "\u00b7" );
520 parser.defineEntityReplacementText( "cedil", "\u00b8" );
521 parser.defineEntityReplacementText( "sup1", "\u00b9" );
522 parser.defineEntityReplacementText( "ordm", "\u00ba" );
523 parser.defineEntityReplacementText( "raquo", "\u00bb" );
524 parser.defineEntityReplacementText( "frac14", "\u00bc" );
525 parser.defineEntityReplacementText( "frac12", "\u00bd" );
526 parser.defineEntityReplacementText( "frac34", "\u00be" );
527 parser.defineEntityReplacementText( "iquest", "\u00bf" );
528 parser.defineEntityReplacementText( "Agrave", "\u00c0" );
529 parser.defineEntityReplacementText( "Aacute", "\u00c1" );
530 parser.defineEntityReplacementText( "Acirc", "\u00c2" );
531 parser.defineEntityReplacementText( "Atilde", "\u00c3" );
532 parser.defineEntityReplacementText( "Auml", "\u00c4" );
533 parser.defineEntityReplacementText( "Aring", "\u00c5" );
534 parser.defineEntityReplacementText( "AElig", "\u00c6" );
535 parser.defineEntityReplacementText( "Ccedil", "\u00c7" );
536 parser.defineEntityReplacementText( "Egrave", "\u00c8" );
537 parser.defineEntityReplacementText( "Eacute", "\u00c9" );
538 parser.defineEntityReplacementText( "Ecirc", "\u00ca" );
539 parser.defineEntityReplacementText( "Euml", "\u00cb" );
540 parser.defineEntityReplacementText( "Igrave", "\u00cc" );
541 parser.defineEntityReplacementText( "Iacute", "\u00cd" );
542 parser.defineEntityReplacementText( "Icirc", "\u00ce" );
543 parser.defineEntityReplacementText( "Iuml", "\u00cf" );
544 parser.defineEntityReplacementText( "ETH", "\u00d0" );
545 parser.defineEntityReplacementText( "Ntilde", "\u00d1" );
546 parser.defineEntityReplacementText( "Ograve", "\u00d2" );
547 parser.defineEntityReplacementText( "Oacute", "\u00d3" );
548 parser.defineEntityReplacementText( "Ocirc", "\u00d4" );
549 parser.defineEntityReplacementText( "Otilde", "\u00d5" );
550 parser.defineEntityReplacementText( "Ouml", "\u00d6" );
551 parser.defineEntityReplacementText( "times", "\u00d7" );
552 parser.defineEntityReplacementText( "Oslash", "\u00d8" );
553 parser.defineEntityReplacementText( "Ugrave", "\u00d9" );
554 parser.defineEntityReplacementText( "Uacute", "\u00da" );
555 parser.defineEntityReplacementText( "Ucirc", "\u00db" );
556 parser.defineEntityReplacementText( "Uuml", "\u00dc" );
557 parser.defineEntityReplacementText( "Yacute", "\u00dd" );
558 parser.defineEntityReplacementText( "THORN", "\u00de" );
559 parser.defineEntityReplacementText( "szlig", "\u00df" );
560 parser.defineEntityReplacementText( "agrave", "\u00e0" );
561 parser.defineEntityReplacementText( "aacute", "\u00e1" );
562 parser.defineEntityReplacementText( "acirc", "\u00e2" );
563 parser.defineEntityReplacementText( "atilde", "\u00e3" );
564 parser.defineEntityReplacementText( "auml", "\u00e4" );
565 parser.defineEntityReplacementText( "aring", "\u00e5" );
566 parser.defineEntityReplacementText( "aelig", "\u00e6" );
567 parser.defineEntityReplacementText( "ccedil", "\u00e7" );
568 parser.defineEntityReplacementText( "egrave", "\u00e8" );
569 parser.defineEntityReplacementText( "eacute", "\u00e9" );
570 parser.defineEntityReplacementText( "ecirc", "\u00ea" );
571 parser.defineEntityReplacementText( "euml", "\u00eb" );
572 parser.defineEntityReplacementText( "igrave", "\u00ec" );
573 parser.defineEntityReplacementText( "iacute", "\u00ed" );
574 parser.defineEntityReplacementText( "icirc", "\u00ee" );
575 parser.defineEntityReplacementText( "iuml", "\u00ef" );
576 parser.defineEntityReplacementText( "eth", "\u00f0" );
577 parser.defineEntityReplacementText( "ntilde", "\u00f1" );
578 parser.defineEntityReplacementText( "ograve", "\u00f2" );
579 parser.defineEntityReplacementText( "oacute", "\u00f3" );
580 parser.defineEntityReplacementText( "ocirc", "\u00f4" );
581 parser.defineEntityReplacementText( "otilde", "\u00f5" );
582 parser.defineEntityReplacementText( "ouml", "\u00f6" );
583 parser.defineEntityReplacementText( "divide", "\u00f7" );
584 parser.defineEntityReplacementText( "oslash", "\u00f8" );
585 parser.defineEntityReplacementText( "ugrave", "\u00f9" );
586 parser.defineEntityReplacementText( "uacute", "\u00fa" );
587 parser.defineEntityReplacementText( "ucirc", "\u00fb" );
588 parser.defineEntityReplacementText( "uuml", "\u00fc" );
589 parser.defineEntityReplacementText( "yacute", "\u00fd" );
590 parser.defineEntityReplacementText( "thorn", "\u00fe" );
591 parser.defineEntityReplacementText( "yuml", "\u00ff" );
592
593 // ----------------------------------------------------------------------
594 // Special entities
595 // ----------------------------------------------------------------------
596
597 parser.defineEntityReplacementText( "OElig", "\u0152" );
598 parser.defineEntityReplacementText( "oelig", "\u0153" );
599 parser.defineEntityReplacementText( "Scaron", "\u0160" );
600 parser.defineEntityReplacementText( "scaron", "\u0161" );
601 parser.defineEntityReplacementText( "Yuml", "\u0178" );
602 parser.defineEntityReplacementText( "circ", "\u02c6" );
603 parser.defineEntityReplacementText( "tilde", "\u02dc" );
604 parser.defineEntityReplacementText( "ensp", "\u2002" );
605 parser.defineEntityReplacementText( "emsp", "\u2003" );
606 parser.defineEntityReplacementText( "thinsp", "\u2009" );
607 parser.defineEntityReplacementText( "zwnj", "\u200c" );
608 parser.defineEntityReplacementText( "zwj", "\u200d" );
609 parser.defineEntityReplacementText( "lrm", "\u200e" );
610 parser.defineEntityReplacementText( "rlm", "\u200f" );
611 parser.defineEntityReplacementText( "ndash", "\u2013" );
612 parser.defineEntityReplacementText( "mdash", "\u2014" );
613 parser.defineEntityReplacementText( "lsquo", "\u2018" );
614 parser.defineEntityReplacementText( "rsquo", "\u2019" );
615 parser.defineEntityReplacementText( "sbquo", "\u201a" );
616 parser.defineEntityReplacementText( "ldquo", "\u201c" );
617 parser.defineEntityReplacementText( "rdquo", "\u201d" );
618 parser.defineEntityReplacementText( "bdquo", "\u201e" );
619 parser.defineEntityReplacementText( "dagger", "\u2020" );
620 parser.defineEntityReplacementText( "Dagger", "\u2021" );
621 parser.defineEntityReplacementText( "permil", "\u2030" );
622 parser.defineEntityReplacementText( "lsaquo", "\u2039" );
623 parser.defineEntityReplacementText( "rsaquo", "\u203a" );
624 parser.defineEntityReplacementText( "euro", "\u20ac" );
625
626 // ----------------------------------------------------------------------
627 // Symbol entities
628 // ----------------------------------------------------------------------
629
630 parser.defineEntityReplacementText( "fnof", "\u0192" );
631 parser.defineEntityReplacementText( "Alpha", "\u0391" );
632 parser.defineEntityReplacementText( "Beta", "\u0392" );
633 parser.defineEntityReplacementText( "Gamma", "\u0393" );
634 parser.defineEntityReplacementText( "Delta", "\u0394" );
635 parser.defineEntityReplacementText( "Epsilon", "\u0395" );
636 parser.defineEntityReplacementText( "Zeta", "\u0396" );
637 parser.defineEntityReplacementText( "Eta", "\u0397" );
638 parser.defineEntityReplacementText( "Theta", "\u0398" );
639 parser.defineEntityReplacementText( "Iota", "\u0399" );
640 parser.defineEntityReplacementText( "Kappa", "\u039a" );
641 parser.defineEntityReplacementText( "Lambda", "\u039b" );
642 parser.defineEntityReplacementText( "Mu", "\u039c" );
643 parser.defineEntityReplacementText( "Nu", "\u039d" );
644 parser.defineEntityReplacementText( "Xi", "\u039e" );
645 parser.defineEntityReplacementText( "Omicron", "\u039f" );
646 parser.defineEntityReplacementText( "Pi", "\u03a0" );
647 parser.defineEntityReplacementText( "Rho", "\u03a1" );
648 parser.defineEntityReplacementText( "Sigma", "\u03a3" );
649 parser.defineEntityReplacementText( "Tau", "\u03a4" );
650 parser.defineEntityReplacementText( "Upsilon", "\u03a5" );
651 parser.defineEntityReplacementText( "Phi", "\u03a6" );
652 parser.defineEntityReplacementText( "Chi", "\u03a7" );
653 parser.defineEntityReplacementText( "Psi", "\u03a8" );
654 parser.defineEntityReplacementText( "Omega", "\u03a9" );
655 parser.defineEntityReplacementText( "alpha", "\u03b1" );
656 parser.defineEntityReplacementText( "beta", "\u03b2" );
657 parser.defineEntityReplacementText( "gamma", "\u03b3" );
658 parser.defineEntityReplacementText( "delta", "\u03b4" );
659 parser.defineEntityReplacementText( "epsilon", "\u03b5" );
660 parser.defineEntityReplacementText( "zeta", "\u03b6" );
661 parser.defineEntityReplacementText( "eta", "\u03b7" );
662 parser.defineEntityReplacementText( "theta", "\u03b8" );
663 parser.defineEntityReplacementText( "iota", "\u03b9" );
664 parser.defineEntityReplacementText( "kappa", "\u03ba" );
665 parser.defineEntityReplacementText( "lambda", "\u03bb" );
666 parser.defineEntityReplacementText( "mu", "\u03bc" );
667 parser.defineEntityReplacementText( "nu", "\u03bd" );
668 parser.defineEntityReplacementText( "xi", "\u03be" );
669 parser.defineEntityReplacementText( "omicron", "\u03bf" );
670 parser.defineEntityReplacementText( "pi", "\u03c0" );
671 parser.defineEntityReplacementText( "rho", "\u03c1" );
672 parser.defineEntityReplacementText( "sigmaf", "\u03c2" );
673 parser.defineEntityReplacementText( "sigma", "\u03c3" );
674 parser.defineEntityReplacementText( "tau", "\u03c4" );
675 parser.defineEntityReplacementText( "upsilon", "\u03c5" );
676 parser.defineEntityReplacementText( "phi", "\u03c6" );
677 parser.defineEntityReplacementText( "chi", "\u03c7" );
678 parser.defineEntityReplacementText( "psi", "\u03c8" );
679 parser.defineEntityReplacementText( "omega", "\u03c9" );
680 parser.defineEntityReplacementText( "thetasym", "\u03d1" );
681 parser.defineEntityReplacementText( "upsih", "\u03d2" );
682 parser.defineEntityReplacementText( "piv", "\u03d6" );
683 parser.defineEntityReplacementText( "bull", "\u2022" );
684 parser.defineEntityReplacementText( "hellip", "\u2026" );
685 parser.defineEntityReplacementText( "prime", "\u2032" );
686 parser.defineEntityReplacementText( "Prime", "\u2033" );
687 parser.defineEntityReplacementText( "oline", "\u203e" );
688 parser.defineEntityReplacementText( "frasl", "\u2044" );
689 parser.defineEntityReplacementText( "weierp", "\u2118" );
690 parser.defineEntityReplacementText( "image", "\u2111" );
691 parser.defineEntityReplacementText( "real", "\u211c" );
692 parser.defineEntityReplacementText( "trade", "\u2122" );
693 parser.defineEntityReplacementText( "alefsym", "\u2135" );
694 parser.defineEntityReplacementText( "larr", "\u2190" );
695 parser.defineEntityReplacementText( "uarr", "\u2191" );
696 parser.defineEntityReplacementText( "rarr", "\u2192" );
697 parser.defineEntityReplacementText( "darr", "\u2193" );
698 parser.defineEntityReplacementText( "harr", "\u2194" );
699 parser.defineEntityReplacementText( "crarr", "\u21b5" );
700 parser.defineEntityReplacementText( "lArr", "\u21d0" );
701 parser.defineEntityReplacementText( "uArr", "\u21d1" );
702 parser.defineEntityReplacementText( "rArr", "\u21d2" );
703 parser.defineEntityReplacementText( "dArr", "\u21d3" );
704 parser.defineEntityReplacementText( "hArr", "\u21d4" );
705 parser.defineEntityReplacementText( "forall", "\u2200" );
706 parser.defineEntityReplacementText( "part", "\u2202" );
707 parser.defineEntityReplacementText( "exist", "\u2203" );
708 parser.defineEntityReplacementText( "empty", "\u2205" );
709 parser.defineEntityReplacementText( "nabla", "\u2207" );
710 parser.defineEntityReplacementText( "isin", "\u2208" );
711 parser.defineEntityReplacementText( "notin", "\u2209" );
712 parser.defineEntityReplacementText( "ni", "\u220b" );
713 parser.defineEntityReplacementText( "prod", "\u220f" );
714 parser.defineEntityReplacementText( "sum", "\u2211" );
715 parser.defineEntityReplacementText( "minus", "\u2212" );
716 parser.defineEntityReplacementText( "lowast", "\u2217" );
717 parser.defineEntityReplacementText( "radic", "\u221a" );
718 parser.defineEntityReplacementText( "prop", "\u221d" );
719 parser.defineEntityReplacementText( "infin", "\u221e" );
720 parser.defineEntityReplacementText( "ang", "\u2220" );
721 parser.defineEntityReplacementText( "and", "\u2227" );
722 parser.defineEntityReplacementText( "or", "\u2228" );
723 parser.defineEntityReplacementText( "cap", "\u2229" );
724 parser.defineEntityReplacementText( "cup", "\u222a" );
725 parser.defineEntityReplacementText( "int", "\u222b" );
726 parser.defineEntityReplacementText( "there4", "\u2234" );
727 parser.defineEntityReplacementText( "sim", "\u223c" );
728 parser.defineEntityReplacementText( "cong", "\u2245" );
729 parser.defineEntityReplacementText( "asymp", "\u2248" );
730 parser.defineEntityReplacementText( "ne", "\u2260" );
731 parser.defineEntityReplacementText( "equiv", "\u2261" );
732 parser.defineEntityReplacementText( "le", "\u2264" );
733 parser.defineEntityReplacementText( "ge", "\u2265" );
734 parser.defineEntityReplacementText( "sub", "\u2282" );
735 parser.defineEntityReplacementText( "sup", "\u2283" );
736 parser.defineEntityReplacementText( "nsub", "\u2284" );
737 parser.defineEntityReplacementText( "sube", "\u2286" );
738 parser.defineEntityReplacementText( "supe", "\u2287" );
739 parser.defineEntityReplacementText( "oplus", "\u2295" );
740 parser.defineEntityReplacementText( "otimes", "\u2297" );
741 parser.defineEntityReplacementText( "perp", "\u22a5" );
742 parser.defineEntityReplacementText( "sdot", "\u22c5" );
743 parser.defineEntityReplacementText( "lceil", "\u2308" );
744 parser.defineEntityReplacementText( "rceil", "\u2309" );
745 parser.defineEntityReplacementText( "lfloor", "\u230a" );
746 parser.defineEntityReplacementText( "rfloor", "\u230b" );
747 parser.defineEntityReplacementText( "lang", "\u2329" );
748 parser.defineEntityReplacementText( "rang", "\u232a" );
749 parser.defineEntityReplacementText( "loz", "\u25ca" );
750 parser.defineEntityReplacementText( "spades", "\u2660" );
751 parser.defineEntityReplacementText( "clubs", "\u2663" );
752 parser.defineEntityReplacementText( "hearts", "\u2665" );
753 parser.defineEntityReplacementText( "diams", "\u2666" );
754
755 }
756 } //-- void initParser( XmlPullParser )
757
758 /**
759 * Method nextTag.
760 *
761 * @param parser
762 * @throws IOException
763 * @throws XmlPullParserException
764 * @return int
765 */
766 private int nextTag( XmlPullParser parser )
767 throws IOException, XmlPullParserException
768 {
769 int eventType = parser.next();
770 if ( eventType == XmlPullParser.TEXT )
771 {
772 eventType = parser.next();
773 }
774 if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
775 {
776 throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
777 }
778 return eventType;
779 } //-- int nextTag( XmlPullParser )
780
781 /**
782 * Method parseExecution.
783 *
784 * @param parser
785 * @param strict
786 * @throws IOException
787 * @throws XmlPullParserException
788 * @return Execution
789 */
790 private Execution parseExecution( XmlPullParser parser, boolean strict )
791 throws IOException, XmlPullParserException
792 {
793 String tagName = parser.getName();
794 Execution execution = new Execution();
795 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
796 {
797 String name = parser.getAttributeName( i );
798 String value = parser.getAttributeValue( i );
799
800 if ( name.indexOf( ':' ) >= 0 )
801 {
802 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
803 }
804 else
805 {
806 checkUnknownAttribute( parser, name, tagName, strict );
807 }
808 }
809 java.util.Set parsed = new java.util.HashSet();
810 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
811 {
812 if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
813 {
814 execution.setConfiguration( Xpp3DomBuilder.build( parser ) );
815 }
816 else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
817 {
818 java.util.List goals = new java.util.ArrayList/*<String>*/();
819 execution.setGoals( goals );
820 while ( parser.nextTag() == XmlPullParser.START_TAG )
821 {
822 if ( "goal".equals( parser.getName() ) )
823 {
824 goals.add( getTrimmedValue( parser.nextText() ) );
825 }
826 else
827 {
828 checkUnknownElement( parser, strict );
829 }
830 }
831 }
832 else
833 {
834 checkUnknownElement( parser, strict );
835 }
836 }
837 return execution;
838 } //-- Execution parseExecution( XmlPullParser, boolean )
839
840 /**
841 * Method parseLifecycle.
842 *
843 * @param parser
844 * @param strict
845 * @throws IOException
846 * @throws XmlPullParserException
847 * @return Lifecycle
848 */
849 private Lifecycle parseLifecycle( XmlPullParser parser, boolean strict )
850 throws IOException, XmlPullParserException
851 {
852 String tagName = parser.getName();
853 Lifecycle lifecycle = new Lifecycle();
854 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
855 {
856 String name = parser.getAttributeName( i );
857 String value = parser.getAttributeValue( i );
858
859 if ( name.indexOf( ':' ) >= 0 )
860 {
861 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
862 }
863 else
864 {
865 checkUnknownAttribute( parser, name, tagName, strict );
866 }
867 }
868 java.util.Set parsed = new java.util.HashSet();
869 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
870 {
871 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
872 {
873 lifecycle.setId( getTrimmedValue( parser.nextText() ) );
874 }
875 else if ( checkFieldWithDuplicate( parser, "phases", null, parsed ) )
876 {
877 java.util.List phases = new java.util.ArrayList/*<Phase>*/();
878 lifecycle.setPhases( phases );
879 while ( parser.nextTag() == XmlPullParser.START_TAG )
880 {
881 if ( "phase".equals( parser.getName() ) )
882 {
883 phases.add( parsePhase( parser, strict ) );
884 }
885 else
886 {
887 checkUnknownElement( parser, strict );
888 }
889 }
890 }
891 else
892 {
893 checkUnknownElement( parser, strict );
894 }
895 }
896 return lifecycle;
897 } //-- Lifecycle parseLifecycle( XmlPullParser, boolean )
898
899 /**
900 * Method parseLifecycleConfiguration.
901 *
902 * @param parser
903 * @param strict
904 * @throws IOException
905 * @throws XmlPullParserException
906 * @return LifecycleConfiguration
907 */
908 private LifecycleConfiguration parseLifecycleConfiguration( XmlPullParser parser, boolean strict )
909 throws IOException, XmlPullParserException
910 {
911 String tagName = parser.getName();
912 LifecycleConfiguration lifecycleConfiguration = new LifecycleConfiguration();
913 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
914 {
915 String name = parser.getAttributeName( i );
916 String value = parser.getAttributeValue( i );
917
918 if ( name.indexOf( ':' ) >= 0 )
919 {
920 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
921 }
922 else if ( "xmlns".equals( name ) )
923 {
924 // ignore xmlns attribute in root class, which is a reserved attribute name
925 }
926 else
927 {
928 checkUnknownAttribute( parser, name, tagName, strict );
929 }
930 }
931 java.util.Set parsed = new java.util.HashSet();
932 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
933 {
934 if ( "lifecycle".equals( parser.getName() ) )
935 {
936 java.util.List lifecycles = lifecycleConfiguration.getLifecycles();
937 if ( lifecycles == null )
938 {
939 lifecycles = new java.util.ArrayList/*<Lifecycle>*/();
940 lifecycleConfiguration.setLifecycles( lifecycles );
941 }
942 lifecycles.add( parseLifecycle( parser, strict ) );
943 }
944 else
945 {
946 checkUnknownElement( parser, strict );
947 }
948 }
949 return lifecycleConfiguration;
950 } //-- LifecycleConfiguration parseLifecycleConfiguration( XmlPullParser, boolean )
951
952 /**
953 * Method parsePhase.
954 *
955 * @param parser
956 * @param strict
957 * @throws IOException
958 * @throws XmlPullParserException
959 * @return Phase
960 */
961 private Phase parsePhase( XmlPullParser parser, boolean strict )
962 throws IOException, XmlPullParserException
963 {
964 String tagName = parser.getName();
965 Phase phase = new Phase();
966 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
967 {
968 String name = parser.getAttributeName( i );
969 String value = parser.getAttributeValue( i );
970
971 if ( name.indexOf( ':' ) >= 0 )
972 {
973 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
974 }
975 else
976 {
977 checkUnknownAttribute( parser, name, tagName, strict );
978 }
979 }
980 java.util.Set parsed = new java.util.HashSet();
981 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
982 {
983 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
984 {
985 phase.setId( getTrimmedValue( parser.nextText() ) );
986 }
987 else if ( checkFieldWithDuplicate( parser, "executions", null, parsed ) )
988 {
989 java.util.List executions = new java.util.ArrayList/*<Execution>*/();
990 phase.setExecutions( executions );
991 while ( parser.nextTag() == XmlPullParser.START_TAG )
992 {
993 if ( "execution".equals( parser.getName() ) )
994 {
995 executions.add( parseExecution( parser, strict ) );
996 }
997 else
998 {
999 checkUnknownElement( parser, strict );
1000 }
1001 }
1002 }
1003 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
1004 {
1005 phase.setConfiguration( Xpp3DomBuilder.build( parser ) );
1006 }
1007 else
1008 {
1009 checkUnknownElement( parser, strict );
1010 }
1011 }
1012 return phase;
1013 } //-- Phase parsePhase( XmlPullParser, boolean )
1014
1015 /**
1016 * @see ReaderFactory#newXmlReader
1017 *
1018 * @param reader
1019 * @param strict
1020 * @throws IOException
1021 * @throws XmlPullParserException
1022 * @return LifecycleConfiguration
1023 */
1024 public LifecycleConfiguration read( Reader reader, boolean strict )
1025 throws IOException, XmlPullParserException
1026 {
1027 XmlPullParser parser = new MXParser();
1028
1029 parser.setInput( reader );
1030
1031 initParser( parser );
1032
1033 return read( parser, strict );
1034 } //-- LifecycleConfiguration read( Reader, boolean )
1035
1036 /**
1037 * @see ReaderFactory#newXmlReader
1038 *
1039 * @param reader
1040 * @throws IOException
1041 * @throws XmlPullParserException
1042 * @return LifecycleConfiguration
1043 */
1044 public LifecycleConfiguration read( Reader reader )
1045 throws IOException, XmlPullParserException
1046 {
1047 return read( reader, true );
1048 } //-- LifecycleConfiguration read( Reader )
1049
1050 /**
1051 * Method read.
1052 *
1053 * @param in
1054 * @param strict
1055 * @throws IOException
1056 * @throws XmlPullParserException
1057 * @return LifecycleConfiguration
1058 */
1059 public LifecycleConfiguration read( InputStream in, boolean strict )
1060 throws IOException, XmlPullParserException
1061 {
1062 return read( ReaderFactory.newXmlReader( in ), strict );
1063 } //-- LifecycleConfiguration read( InputStream, boolean )
1064
1065 /**
1066 * Method read.
1067 *
1068 * @param in
1069 * @throws IOException
1070 * @throws XmlPullParserException
1071 * @return LifecycleConfiguration
1072 */
1073 public LifecycleConfiguration read( InputStream in )
1074 throws IOException, XmlPullParserException
1075 {
1076 return read( ReaderFactory.newXmlReader( in ) );
1077 } //-- LifecycleConfiguration read( InputStream )
1078
1079 /**
1080 * Method read.
1081 *
1082 * @param parser
1083 * @param strict
1084 * @throws IOException
1085 * @throws XmlPullParserException
1086 * @return LifecycleConfiguration
1087 */
1088 private LifecycleConfiguration read( XmlPullParser parser, boolean strict )
1089 throws IOException, XmlPullParserException
1090 {
1091 int eventType = parser.getEventType();
1092 while ( eventType != XmlPullParser.END_DOCUMENT )
1093 {
1094 if ( eventType == XmlPullParser.START_TAG )
1095 {
1096 if ( strict && ! "lifecycles".equals( parser.getName() ) )
1097 {
1098 throw new XmlPullParserException( "Expected root element 'lifecycles' but found '" + parser.getName() + "'", parser, null );
1099 }
1100 LifecycleConfiguration lifecycleConfiguration = parseLifecycleConfiguration( parser, strict );
1101 lifecycleConfiguration.setModelEncoding( parser.getInputEncoding() );
1102 return lifecycleConfiguration;
1103 }
1104 eventType = parser.next();
1105 }
1106 throw new XmlPullParserException( "Expected root element 'lifecycles' but found no element at all: invalid XML document", parser, null );
1107 } //-- LifecycleConfiguration read( XmlPullParser, boolean )
1108
1109 /**
1110 * Sets the state of the "add default entities" flag.
1111 *
1112 * @param addDefaultEntities
1113 */
1114 public void setAddDefaultEntities( boolean addDefaultEntities )
1115 {
1116 this.addDefaultEntities = addDefaultEntities;
1117 } //-- void setAddDefaultEntities( boolean )
1118
1119 }