View Javadoc

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