View Javadoc

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