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