View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.11,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.model.io.xpp3;
7   
8     //---------------------------------/
9    //- Imported classes and packages -/
10  //---------------------------------/
11  
12  import java.io.OutputStream;
13  import java.io.Writer;
14  import java.util.Iterator;
15  import org.apache.maven.model.Activation;
16  import org.apache.maven.model.ActivationFile;
17  import org.apache.maven.model.ActivationOS;
18  import org.apache.maven.model.ActivationProperty;
19  import org.apache.maven.model.Build;
20  import org.apache.maven.model.BuildBase;
21  import org.apache.maven.model.CiManagement;
22  import org.apache.maven.model.ConfigurationContainer;
23  import org.apache.maven.model.Contributor;
24  import org.apache.maven.model.Dependency;
25  import org.apache.maven.model.DependencyManagement;
26  import org.apache.maven.model.DeploymentRepository;
27  import org.apache.maven.model.Developer;
28  import org.apache.maven.model.DistributionManagement;
29  import org.apache.maven.model.Exclusion;
30  import org.apache.maven.model.Extension;
31  import org.apache.maven.model.FileSet;
32  import org.apache.maven.model.IssueManagement;
33  import org.apache.maven.model.License;
34  import org.apache.maven.model.MailingList;
35  import org.apache.maven.model.Model;
36  import org.apache.maven.model.ModelBase;
37  import org.apache.maven.model.Notifier;
38  import org.apache.maven.model.Organization;
39  import org.apache.maven.model.Parent;
40  import org.apache.maven.model.PatternSet;
41  import org.apache.maven.model.Plugin;
42  import org.apache.maven.model.PluginConfiguration;
43  import org.apache.maven.model.PluginContainer;
44  import org.apache.maven.model.PluginExecution;
45  import org.apache.maven.model.PluginManagement;
46  import org.apache.maven.model.Prerequisites;
47  import org.apache.maven.model.Profile;
48  import org.apache.maven.model.Relocation;
49  import org.apache.maven.model.ReportPlugin;
50  import org.apache.maven.model.ReportSet;
51  import org.apache.maven.model.Reporting;
52  import org.apache.maven.model.Repository;
53  import org.apache.maven.model.RepositoryBase;
54  import org.apache.maven.model.RepositoryPolicy;
55  import org.apache.maven.model.Resource;
56  import org.apache.maven.model.Scm;
57  import org.apache.maven.model.Site;
58  import org.codehaus.plexus.util.xml.Xpp3Dom;
59  import org.codehaus.plexus.util.xml.pull.MXSerializer;
60  import org.codehaus.plexus.util.xml.pull.XmlSerializer;
61  
62  /**
63   * Class MavenXpp3Writer.
64   * 
65   * @version $Revision$ $Date$
66   */
67  @SuppressWarnings( "all" )
68  public class MavenXpp3Writer
69  {
70  
71        //--------------------------/
72       //- Class/Member Variables -/
73      //--------------------------/
74  
75      /**
76       * Field NAMESPACE.
77       */
78      private static final String NAMESPACE = null;
79  
80      /**
81       * Field fileComment.
82       */
83      private String fileComment = null;
84  
85  
86        //-----------/
87       //- Methods -/
88      //-----------/
89  
90      /**
91       * Method setFileComment.
92       * 
93       * @param fileComment
94       */
95      public void setFileComment( String fileComment )
96      {
97          this.fileComment = fileComment;
98      } //-- void setFileComment( String )
99  
100     /**
101      * Method write.
102      * 
103      * @param writer
104      * @param model
105      * @throws java.io.IOException
106      */
107     public void write( Writer writer, Model model )
108         throws java.io.IOException
109     {
110         XmlSerializer serializer = new MXSerializer();
111         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
112         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
113         serializer.setOutput( writer );
114         serializer.startDocument( model.getModelEncoding(), null );
115         writeModel( model, "project", serializer );
116         serializer.endDocument();
117     } //-- void write( Writer, Model )
118 
119     /**
120      * Method write.
121      * 
122      * @param stream
123      * @param model
124      * @throws java.io.IOException
125      */
126     public void write( OutputStream stream, Model model )
127         throws java.io.IOException
128     {
129         XmlSerializer serializer = new MXSerializer();
130         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
131         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
132         serializer.setOutput( stream, model.getModelEncoding() );
133         serializer.startDocument( model.getModelEncoding(), null );
134         writeModel( model, "project", serializer );
135         serializer.endDocument();
136     } //-- void write( OutputStream, Model )
137 
138     /**
139      * Method writeActivation.
140      * 
141      * @param activation
142      * @param serializer
143      * @param tagName
144      * @throws java.io.IOException
145      */
146     private void writeActivation( Activation activation, String tagName, XmlSerializer serializer )
147         throws java.io.IOException
148     {
149         serializer.startTag( NAMESPACE, tagName );
150         if ( activation.isActiveByDefault() != false )
151         {
152             serializer.startTag( NAMESPACE, "activeByDefault" ).text( String.valueOf( activation.isActiveByDefault() ) ).endTag( NAMESPACE, "activeByDefault" );
153         }
154         if ( activation.getJdk() != null )
155         {
156             serializer.startTag( NAMESPACE, "jdk" ).text( activation.getJdk() ).endTag( NAMESPACE, "jdk" );
157         }
158         if ( activation.getOs() != null )
159         {
160             writeActivationOS( (ActivationOS) activation.getOs(), "os", serializer );
161         }
162         if ( activation.getProperty() != null )
163         {
164             writeActivationProperty( (ActivationProperty) activation.getProperty(), "property", serializer );
165         }
166         if ( activation.getFile() != null )
167         {
168             writeActivationFile( (ActivationFile) activation.getFile(), "file", serializer );
169         }
170         serializer.endTag( NAMESPACE, tagName );
171     } //-- void writeActivation( Activation, String, XmlSerializer )
172 
173     /**
174      * Method writeActivationFile.
175      * 
176      * @param activationFile
177      * @param serializer
178      * @param tagName
179      * @throws java.io.IOException
180      */
181     private void writeActivationFile( ActivationFile activationFile, String tagName, XmlSerializer serializer )
182         throws java.io.IOException
183     {
184         serializer.startTag( NAMESPACE, tagName );
185         if ( activationFile.getMissing() != null )
186         {
187             serializer.startTag( NAMESPACE, "missing" ).text( activationFile.getMissing() ).endTag( NAMESPACE, "missing" );
188         }
189         if ( activationFile.getExists() != null )
190         {
191             serializer.startTag( NAMESPACE, "exists" ).text( activationFile.getExists() ).endTag( NAMESPACE, "exists" );
192         }
193         serializer.endTag( NAMESPACE, tagName );
194     } //-- void writeActivationFile( ActivationFile, String, XmlSerializer )
195 
196     /**
197      * Method writeActivationOS.
198      * 
199      * @param activationOS
200      * @param serializer
201      * @param tagName
202      * @throws java.io.IOException
203      */
204     private void writeActivationOS( ActivationOS activationOS, String tagName, XmlSerializer serializer )
205         throws java.io.IOException
206     {
207         serializer.startTag( NAMESPACE, tagName );
208         if ( activationOS.getName() != null )
209         {
210             serializer.startTag( NAMESPACE, "name" ).text( activationOS.getName() ).endTag( NAMESPACE, "name" );
211         }
212         if ( activationOS.getFamily() != null )
213         {
214             serializer.startTag( NAMESPACE, "family" ).text( activationOS.getFamily() ).endTag( NAMESPACE, "family" );
215         }
216         if ( activationOS.getArch() != null )
217         {
218             serializer.startTag( NAMESPACE, "arch" ).text( activationOS.getArch() ).endTag( NAMESPACE, "arch" );
219         }
220         if ( activationOS.getVersion() != null )
221         {
222             serializer.startTag( NAMESPACE, "version" ).text( activationOS.getVersion() ).endTag( NAMESPACE, "version" );
223         }
224         serializer.endTag( NAMESPACE, tagName );
225     } //-- void writeActivationOS( ActivationOS, String, XmlSerializer )
226 
227     /**
228      * Method writeActivationProperty.
229      * 
230      * @param activationProperty
231      * @param serializer
232      * @param tagName
233      * @throws java.io.IOException
234      */
235     private void writeActivationProperty( ActivationProperty activationProperty, String tagName, XmlSerializer serializer )
236         throws java.io.IOException
237     {
238         serializer.startTag( NAMESPACE, tagName );
239         if ( activationProperty.getName() != null )
240         {
241             serializer.startTag( NAMESPACE, "name" ).text( activationProperty.getName() ).endTag( NAMESPACE, "name" );
242         }
243         if ( activationProperty.getValue() != null )
244         {
245             serializer.startTag( NAMESPACE, "value" ).text( activationProperty.getValue() ).endTag( NAMESPACE, "value" );
246         }
247         serializer.endTag( NAMESPACE, tagName );
248     } //-- void writeActivationProperty( ActivationProperty, String, XmlSerializer )
249 
250     /**
251      * Method writeBuild.
252      * 
253      * @param build
254      * @param serializer
255      * @param tagName
256      * @throws java.io.IOException
257      */
258     private void writeBuild( Build build, String tagName, XmlSerializer serializer )
259         throws java.io.IOException
260     {
261         serializer.startTag( NAMESPACE, tagName );
262         if ( build.getSourceDirectory() != null )
263         {
264             serializer.startTag( NAMESPACE, "sourceDirectory" ).text( build.getSourceDirectory() ).endTag( NAMESPACE, "sourceDirectory" );
265         }
266         if ( build.getScriptSourceDirectory() != null )
267         {
268             serializer.startTag( NAMESPACE, "scriptSourceDirectory" ).text( build.getScriptSourceDirectory() ).endTag( NAMESPACE, "scriptSourceDirectory" );
269         }
270         if ( build.getTestSourceDirectory() != null )
271         {
272             serializer.startTag( NAMESPACE, "testSourceDirectory" ).text( build.getTestSourceDirectory() ).endTag( NAMESPACE, "testSourceDirectory" );
273         }
274         if ( build.getOutputDirectory() != null )
275         {
276             serializer.startTag( NAMESPACE, "outputDirectory" ).text( build.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" );
277         }
278         if ( build.getTestOutputDirectory() != null )
279         {
280             serializer.startTag( NAMESPACE, "testOutputDirectory" ).text( build.getTestOutputDirectory() ).endTag( NAMESPACE, "testOutputDirectory" );
281         }
282         if ( ( build.getExtensions() != null ) && ( build.getExtensions().size() > 0 ) )
283         {
284             serializer.startTag( NAMESPACE, "extensions" );
285             for ( Iterator iter = build.getExtensions().iterator(); iter.hasNext(); )
286             {
287                 Extension o = (Extension) iter.next();
288                 writeExtension( o, "extension", serializer );
289             }
290             serializer.endTag( NAMESPACE, "extensions" );
291         }
292         if ( build.getDefaultGoal() != null )
293         {
294             serializer.startTag( NAMESPACE, "defaultGoal" ).text( build.getDefaultGoal() ).endTag( NAMESPACE, "defaultGoal" );
295         }
296         if ( ( build.getResources() != null ) && ( build.getResources().size() > 0 ) )
297         {
298             serializer.startTag( NAMESPACE, "resources" );
299             for ( Iterator iter = build.getResources().iterator(); iter.hasNext(); )
300             {
301                 Resource o = (Resource) iter.next();
302                 writeResource( o, "resource", serializer );
303             }
304             serializer.endTag( NAMESPACE, "resources" );
305         }
306         if ( ( build.getTestResources() != null ) && ( build.getTestResources().size() > 0 ) )
307         {
308             serializer.startTag( NAMESPACE, "testResources" );
309             for ( Iterator iter = build.getTestResources().iterator(); iter.hasNext(); )
310             {
311                 Resource o = (Resource) iter.next();
312                 writeResource( o, "testResource", serializer );
313             }
314             serializer.endTag( NAMESPACE, "testResources" );
315         }
316         if ( build.getDirectory() != null )
317         {
318             serializer.startTag( NAMESPACE, "directory" ).text( build.getDirectory() ).endTag( NAMESPACE, "directory" );
319         }
320         if ( build.getFinalName() != null )
321         {
322             serializer.startTag( NAMESPACE, "finalName" ).text( build.getFinalName() ).endTag( NAMESPACE, "finalName" );
323         }
324         if ( ( build.getFilters() != null ) && ( build.getFilters().size() > 0 ) )
325         {
326             serializer.startTag( NAMESPACE, "filters" );
327             for ( Iterator iter = build.getFilters().iterator(); iter.hasNext(); )
328             {
329                 String filter = (String) iter.next();
330                 serializer.startTag( NAMESPACE, "filter" ).text( filter ).endTag( NAMESPACE, "filter" );
331             }
332             serializer.endTag( NAMESPACE, "filters" );
333         }
334         if ( build.getPluginManagement() != null )
335         {
336             writePluginManagement( (PluginManagement) build.getPluginManagement(), "pluginManagement", serializer );
337         }
338         if ( ( build.getPlugins() != null ) && ( build.getPlugins().size() > 0 ) )
339         {
340             serializer.startTag( NAMESPACE, "plugins" );
341             for ( Iterator iter = build.getPlugins().iterator(); iter.hasNext(); )
342             {
343                 Plugin o = (Plugin) iter.next();
344                 writePlugin( o, "plugin", serializer );
345             }
346             serializer.endTag( NAMESPACE, "plugins" );
347         }
348         serializer.endTag( NAMESPACE, tagName );
349     } //-- void writeBuild( Build, String, XmlSerializer )
350 
351     /**
352      * Method writeBuildBase.
353      * 
354      * @param buildBase
355      * @param serializer
356      * @param tagName
357      * @throws java.io.IOException
358      */
359     private void writeBuildBase( BuildBase buildBase, String tagName, XmlSerializer serializer )
360         throws java.io.IOException
361     {
362         serializer.startTag( NAMESPACE, tagName );
363         if ( buildBase.getDefaultGoal() != null )
364         {
365             serializer.startTag( NAMESPACE, "defaultGoal" ).text( buildBase.getDefaultGoal() ).endTag( NAMESPACE, "defaultGoal" );
366         }
367         if ( ( buildBase.getResources() != null ) && ( buildBase.getResources().size() > 0 ) )
368         {
369             serializer.startTag( NAMESPACE, "resources" );
370             for ( Iterator iter = buildBase.getResources().iterator(); iter.hasNext(); )
371             {
372                 Resource o = (Resource) iter.next();
373                 writeResource( o, "resource", serializer );
374             }
375             serializer.endTag( NAMESPACE, "resources" );
376         }
377         if ( ( buildBase.getTestResources() != null ) && ( buildBase.getTestResources().size() > 0 ) )
378         {
379             serializer.startTag( NAMESPACE, "testResources" );
380             for ( Iterator iter = buildBase.getTestResources().iterator(); iter.hasNext(); )
381             {
382                 Resource o = (Resource) iter.next();
383                 writeResource( o, "testResource", serializer );
384             }
385             serializer.endTag( NAMESPACE, "testResources" );
386         }
387         if ( buildBase.getDirectory() != null )
388         {
389             serializer.startTag( NAMESPACE, "directory" ).text( buildBase.getDirectory() ).endTag( NAMESPACE, "directory" );
390         }
391         if ( buildBase.getFinalName() != null )
392         {
393             serializer.startTag( NAMESPACE, "finalName" ).text( buildBase.getFinalName() ).endTag( NAMESPACE, "finalName" );
394         }
395         if ( ( buildBase.getFilters() != null ) && ( buildBase.getFilters().size() > 0 ) )
396         {
397             serializer.startTag( NAMESPACE, "filters" );
398             for ( Iterator iter = buildBase.getFilters().iterator(); iter.hasNext(); )
399             {
400                 String filter = (String) iter.next();
401                 serializer.startTag( NAMESPACE, "filter" ).text( filter ).endTag( NAMESPACE, "filter" );
402             }
403             serializer.endTag( NAMESPACE, "filters" );
404         }
405         if ( buildBase.getPluginManagement() != null )
406         {
407             writePluginManagement( (PluginManagement) buildBase.getPluginManagement(), "pluginManagement", serializer );
408         }
409         if ( ( buildBase.getPlugins() != null ) && ( buildBase.getPlugins().size() > 0 ) )
410         {
411             serializer.startTag( NAMESPACE, "plugins" );
412             for ( Iterator iter = buildBase.getPlugins().iterator(); iter.hasNext(); )
413             {
414                 Plugin o = (Plugin) iter.next();
415                 writePlugin( o, "plugin", serializer );
416             }
417             serializer.endTag( NAMESPACE, "plugins" );
418         }
419         serializer.endTag( NAMESPACE, tagName );
420     } //-- void writeBuildBase( BuildBase, String, XmlSerializer )
421 
422     /**
423      * Method writeCiManagement.
424      * 
425      * @param ciManagement
426      * @param serializer
427      * @param tagName
428      * @throws java.io.IOException
429      */
430     private void writeCiManagement( CiManagement ciManagement, String tagName, XmlSerializer serializer )
431         throws java.io.IOException
432     {
433         serializer.startTag( NAMESPACE, tagName );
434         if ( ciManagement.getSystem() != null )
435         {
436             serializer.startTag( NAMESPACE, "system" ).text( ciManagement.getSystem() ).endTag( NAMESPACE, "system" );
437         }
438         if ( ciManagement.getUrl() != null )
439         {
440             serializer.startTag( NAMESPACE, "url" ).text( ciManagement.getUrl() ).endTag( NAMESPACE, "url" );
441         }
442         if ( ( ciManagement.getNotifiers() != null ) && ( ciManagement.getNotifiers().size() > 0 ) )
443         {
444             serializer.startTag( NAMESPACE, "notifiers" );
445             for ( Iterator iter = ciManagement.getNotifiers().iterator(); iter.hasNext(); )
446             {
447                 Notifier o = (Notifier) iter.next();
448                 writeNotifier( o, "notifier", serializer );
449             }
450             serializer.endTag( NAMESPACE, "notifiers" );
451         }
452         serializer.endTag( NAMESPACE, tagName );
453     } //-- void writeCiManagement( CiManagement, String, XmlSerializer )
454 
455     /**
456      * Method writeConfigurationContainer.
457      * 
458      * @param configurationContainer
459      * @param serializer
460      * @param tagName
461      * @throws java.io.IOException
462      */
463     private void writeConfigurationContainer( ConfigurationContainer configurationContainer, String tagName, XmlSerializer serializer )
464         throws java.io.IOException
465     {
466         serializer.startTag( NAMESPACE, tagName );
467         if ( configurationContainer.getInherited() != null )
468         {
469             serializer.startTag( NAMESPACE, "inherited" ).text( configurationContainer.getInherited() ).endTag( NAMESPACE, "inherited" );
470         }
471         if ( configurationContainer.getConfiguration() != null )
472         {
473             ((Xpp3Dom) configurationContainer.getConfiguration()).writeToSerializer( NAMESPACE, serializer );
474         }
475         serializer.endTag( NAMESPACE, tagName );
476     } //-- void writeConfigurationContainer( ConfigurationContainer, String, XmlSerializer )
477 
478     /**
479      * Method writeContributor.
480      * 
481      * @param contributor
482      * @param serializer
483      * @param tagName
484      * @throws java.io.IOException
485      */
486     private void writeContributor( Contributor contributor, String tagName, XmlSerializer serializer )
487         throws java.io.IOException
488     {
489         serializer.startTag( NAMESPACE, tagName );
490         if ( contributor.getName() != null )
491         {
492             serializer.startTag( NAMESPACE, "name" ).text( contributor.getName() ).endTag( NAMESPACE, "name" );
493         }
494         if ( contributor.getEmail() != null )
495         {
496             serializer.startTag( NAMESPACE, "email" ).text( contributor.getEmail() ).endTag( NAMESPACE, "email" );
497         }
498         if ( contributor.getUrl() != null )
499         {
500             serializer.startTag( NAMESPACE, "url" ).text( contributor.getUrl() ).endTag( NAMESPACE, "url" );
501         }
502         if ( contributor.getOrganization() != null )
503         {
504             serializer.startTag( NAMESPACE, "organization" ).text( contributor.getOrganization() ).endTag( NAMESPACE, "organization" );
505         }
506         if ( contributor.getOrganizationUrl() != null )
507         {
508             serializer.startTag( NAMESPACE, "organizationUrl" ).text( contributor.getOrganizationUrl() ).endTag( NAMESPACE, "organizationUrl" );
509         }
510         if ( ( contributor.getRoles() != null ) && ( contributor.getRoles().size() > 0 ) )
511         {
512             serializer.startTag( NAMESPACE, "roles" );
513             for ( Iterator iter = contributor.getRoles().iterator(); iter.hasNext(); )
514             {
515                 String role = (String) iter.next();
516                 serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" );
517             }
518             serializer.endTag( NAMESPACE, "roles" );
519         }
520         if ( contributor.getTimezone() != null )
521         {
522             serializer.startTag( NAMESPACE, "timezone" ).text( contributor.getTimezone() ).endTag( NAMESPACE, "timezone" );
523         }
524         if ( ( contributor.getProperties() != null ) && ( contributor.getProperties().size() > 0 ) )
525         {
526             serializer.startTag( NAMESPACE, "properties" );
527             for ( Iterator iter = contributor.getProperties().keySet().iterator(); iter.hasNext(); )
528             {
529                 String key = (String) iter.next();
530                 String value = (String) contributor.getProperties().get( key );
531                 serializer.startTag( NAMESPACE, key ).text( value ).endTag( NAMESPACE, key );
532             }
533             serializer.endTag( NAMESPACE, "properties" );
534         }
535         serializer.endTag( NAMESPACE, tagName );
536     } //-- void writeContributor( Contributor, String, XmlSerializer )
537 
538     /**
539      * Method writeDependency.
540      * 
541      * @param dependency
542      * @param serializer
543      * @param tagName
544      * @throws java.io.IOException
545      */
546     private void writeDependency( Dependency dependency, String tagName, XmlSerializer serializer )
547         throws java.io.IOException
548     {
549         serializer.startTag( NAMESPACE, tagName );
550         if ( dependency.getGroupId() != null )
551         {
552             serializer.startTag( NAMESPACE, "groupId" ).text( dependency.getGroupId() ).endTag( NAMESPACE, "groupId" );
553         }
554         if ( dependency.getArtifactId() != null )
555         {
556             serializer.startTag( NAMESPACE, "artifactId" ).text( dependency.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
557         }
558         if ( dependency.getVersion() != null )
559         {
560             serializer.startTag( NAMESPACE, "version" ).text( dependency.getVersion() ).endTag( NAMESPACE, "version" );
561         }
562         if ( ( dependency.getType() != null ) && !dependency.getType().equals( "jar" ) )
563         {
564             serializer.startTag( NAMESPACE, "type" ).text( dependency.getType() ).endTag( NAMESPACE, "type" );
565         }
566         if ( dependency.getClassifier() != null )
567         {
568             serializer.startTag( NAMESPACE, "classifier" ).text( dependency.getClassifier() ).endTag( NAMESPACE, "classifier" );
569         }
570         if ( dependency.getScope() != null )
571         {
572             serializer.startTag( NAMESPACE, "scope" ).text( dependency.getScope() ).endTag( NAMESPACE, "scope" );
573         }
574         if ( dependency.getSystemPath() != null )
575         {
576             serializer.startTag( NAMESPACE, "systemPath" ).text( dependency.getSystemPath() ).endTag( NAMESPACE, "systemPath" );
577         }
578         if ( ( dependency.getExclusions() != null ) && ( dependency.getExclusions().size() > 0 ) )
579         {
580             serializer.startTag( NAMESPACE, "exclusions" );
581             for ( Iterator iter = dependency.getExclusions().iterator(); iter.hasNext(); )
582             {
583                 Exclusion o = (Exclusion) iter.next();
584                 writeExclusion( o, "exclusion", serializer );
585             }
586             serializer.endTag( NAMESPACE, "exclusions" );
587         }
588         if ( dependency.getOptional() != null )
589         {
590             serializer.startTag( NAMESPACE, "optional" ).text( dependency.getOptional() ).endTag( NAMESPACE, "optional" );
591         }
592         serializer.endTag( NAMESPACE, tagName );
593     } //-- void writeDependency( Dependency, String, XmlSerializer )
594 
595     /**
596      * Method writeDependencyManagement.
597      * 
598      * @param dependencyManagement
599      * @param serializer
600      * @param tagName
601      * @throws java.io.IOException
602      */
603     private void writeDependencyManagement( DependencyManagement dependencyManagement, String tagName, XmlSerializer serializer )
604         throws java.io.IOException
605     {
606         serializer.startTag( NAMESPACE, tagName );
607         if ( ( dependencyManagement.getDependencies() != null ) && ( dependencyManagement.getDependencies().size() > 0 ) )
608         {
609             serializer.startTag( NAMESPACE, "dependencies" );
610             for ( Iterator iter = dependencyManagement.getDependencies().iterator(); iter.hasNext(); )
611             {
612                 Dependency o = (Dependency) iter.next();
613                 writeDependency( o, "dependency", serializer );
614             }
615             serializer.endTag( NAMESPACE, "dependencies" );
616         }
617         serializer.endTag( NAMESPACE, tagName );
618     } //-- void writeDependencyManagement( DependencyManagement, String, XmlSerializer )
619 
620     /**
621      * Method writeDeploymentRepository.
622      * 
623      * @param deploymentRepository
624      * @param serializer
625      * @param tagName
626      * @throws java.io.IOException
627      */
628     private void writeDeploymentRepository( DeploymentRepository deploymentRepository, String tagName, XmlSerializer serializer )
629         throws java.io.IOException
630     {
631         serializer.startTag( NAMESPACE, tagName );
632         if ( deploymentRepository.isUniqueVersion() != true )
633         {
634             serializer.startTag( NAMESPACE, "uniqueVersion" ).text( String.valueOf( deploymentRepository.isUniqueVersion() ) ).endTag( NAMESPACE, "uniqueVersion" );
635         }
636         if ( deploymentRepository.getReleases() != null )
637         {
638             writeRepositoryPolicy( (RepositoryPolicy) deploymentRepository.getReleases(), "releases", serializer );
639         }
640         if ( deploymentRepository.getSnapshots() != null )
641         {
642             writeRepositoryPolicy( (RepositoryPolicy) deploymentRepository.getSnapshots(), "snapshots", serializer );
643         }
644         if ( deploymentRepository.getId() != null )
645         {
646             serializer.startTag( NAMESPACE, "id" ).text( deploymentRepository.getId() ).endTag( NAMESPACE, "id" );
647         }
648         if ( deploymentRepository.getName() != null )
649         {
650             serializer.startTag( NAMESPACE, "name" ).text( deploymentRepository.getName() ).endTag( NAMESPACE, "name" );
651         }
652         if ( deploymentRepository.getUrl() != null )
653         {
654             serializer.startTag( NAMESPACE, "url" ).text( deploymentRepository.getUrl() ).endTag( NAMESPACE, "url" );
655         }
656         if ( ( deploymentRepository.getLayout() != null ) && !deploymentRepository.getLayout().equals( "default" ) )
657         {
658             serializer.startTag( NAMESPACE, "layout" ).text( deploymentRepository.getLayout() ).endTag( NAMESPACE, "layout" );
659         }
660         serializer.endTag( NAMESPACE, tagName );
661     } //-- void writeDeploymentRepository( DeploymentRepository, String, XmlSerializer )
662 
663     /**
664      * Method writeDeveloper.
665      * 
666      * @param developer
667      * @param serializer
668      * @param tagName
669      * @throws java.io.IOException
670      */
671     private void writeDeveloper( Developer developer, String tagName, XmlSerializer serializer )
672         throws java.io.IOException
673     {
674         serializer.startTag( NAMESPACE, tagName );
675         if ( developer.getId() != null )
676         {
677             serializer.startTag( NAMESPACE, "id" ).text( developer.getId() ).endTag( NAMESPACE, "id" );
678         }
679         if ( developer.getName() != null )
680         {
681             serializer.startTag( NAMESPACE, "name" ).text( developer.getName() ).endTag( NAMESPACE, "name" );
682         }
683         if ( developer.getEmail() != null )
684         {
685             serializer.startTag( NAMESPACE, "email" ).text( developer.getEmail() ).endTag( NAMESPACE, "email" );
686         }
687         if ( developer.getUrl() != null )
688         {
689             serializer.startTag( NAMESPACE, "url" ).text( developer.getUrl() ).endTag( NAMESPACE, "url" );
690         }
691         if ( developer.getOrganization() != null )
692         {
693             serializer.startTag( NAMESPACE, "organization" ).text( developer.getOrganization() ).endTag( NAMESPACE, "organization" );
694         }
695         if ( developer.getOrganizationUrl() != null )
696         {
697             serializer.startTag( NAMESPACE, "organizationUrl" ).text( developer.getOrganizationUrl() ).endTag( NAMESPACE, "organizationUrl" );
698         }
699         if ( ( developer.getRoles() != null ) && ( developer.getRoles().size() > 0 ) )
700         {
701             serializer.startTag( NAMESPACE, "roles" );
702             for ( Iterator iter = developer.getRoles().iterator(); iter.hasNext(); )
703             {
704                 String role = (String) iter.next();
705                 serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" );
706             }
707             serializer.endTag( NAMESPACE, "roles" );
708         }
709         if ( developer.getTimezone() != null )
710         {
711             serializer.startTag( NAMESPACE, "timezone" ).text( developer.getTimezone() ).endTag( NAMESPACE, "timezone" );
712         }
713         if ( ( developer.getProperties() != null ) && ( developer.getProperties().size() > 0 ) )
714         {
715             serializer.startTag( NAMESPACE, "properties" );
716             for ( Iterator iter = developer.getProperties().keySet().iterator(); iter.hasNext(); )
717             {
718                 String key = (String) iter.next();
719                 String value = (String) developer.getProperties().get( key );
720                 serializer.startTag( NAMESPACE, key ).text( value ).endTag( NAMESPACE, key );
721             }
722             serializer.endTag( NAMESPACE, "properties" );
723         }
724         serializer.endTag( NAMESPACE, tagName );
725     } //-- void writeDeveloper( Developer, String, XmlSerializer )
726 
727     /**
728      * Method writeDistributionManagement.
729      * 
730      * @param distributionManagement
731      * @param serializer
732      * @param tagName
733      * @throws java.io.IOException
734      */
735     private void writeDistributionManagement( DistributionManagement distributionManagement, String tagName, XmlSerializer serializer )
736         throws java.io.IOException
737     {
738         serializer.startTag( NAMESPACE, tagName );
739         if ( distributionManagement.getRepository() != null )
740         {
741             writeDeploymentRepository( (DeploymentRepository) distributionManagement.getRepository(), "repository", serializer );
742         }
743         if ( distributionManagement.getSnapshotRepository() != null )
744         {
745             writeDeploymentRepository( (DeploymentRepository) distributionManagement.getSnapshotRepository(), "snapshotRepository", serializer );
746         }
747         if ( distributionManagement.getSite() != null )
748         {
749             writeSite( (Site) distributionManagement.getSite(), "site", serializer );
750         }
751         if ( distributionManagement.getDownloadUrl() != null )
752         {
753             serializer.startTag( NAMESPACE, "downloadUrl" ).text( distributionManagement.getDownloadUrl() ).endTag( NAMESPACE, "downloadUrl" );
754         }
755         if ( distributionManagement.getRelocation() != null )
756         {
757             writeRelocation( (Relocation) distributionManagement.getRelocation(), "relocation", serializer );
758         }
759         if ( distributionManagement.getStatus() != null )
760         {
761             serializer.startTag( NAMESPACE, "status" ).text( distributionManagement.getStatus() ).endTag( NAMESPACE, "status" );
762         }
763         serializer.endTag( NAMESPACE, tagName );
764     } //-- void writeDistributionManagement( DistributionManagement, String, XmlSerializer )
765 
766     /**
767      * Method writeExclusion.
768      * 
769      * @param exclusion
770      * @param serializer
771      * @param tagName
772      * @throws java.io.IOException
773      */
774     private void writeExclusion( Exclusion exclusion, String tagName, XmlSerializer serializer )
775         throws java.io.IOException
776     {
777         serializer.startTag( NAMESPACE, tagName );
778         if ( exclusion.getGroupId() != null )
779         {
780             serializer.startTag( NAMESPACE, "groupId" ).text( exclusion.getGroupId() ).endTag( NAMESPACE, "groupId" );
781         }
782         if ( exclusion.getArtifactId() != null )
783         {
784             serializer.startTag( NAMESPACE, "artifactId" ).text( exclusion.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
785         }
786         serializer.endTag( NAMESPACE, tagName );
787     } //-- void writeExclusion( Exclusion, String, XmlSerializer )
788 
789     /**
790      * Method writeExtension.
791      * 
792      * @param extension
793      * @param serializer
794      * @param tagName
795      * @throws java.io.IOException
796      */
797     private void writeExtension( Extension extension, String tagName, XmlSerializer serializer )
798         throws java.io.IOException
799     {
800         serializer.startTag( NAMESPACE, tagName );
801         if ( extension.getGroupId() != null )
802         {
803             serializer.startTag( NAMESPACE, "groupId" ).text( extension.getGroupId() ).endTag( NAMESPACE, "groupId" );
804         }
805         if ( extension.getArtifactId() != null )
806         {
807             serializer.startTag( NAMESPACE, "artifactId" ).text( extension.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
808         }
809         if ( extension.getVersion() != null )
810         {
811             serializer.startTag( NAMESPACE, "version" ).text( extension.getVersion() ).endTag( NAMESPACE, "version" );
812         }
813         serializer.endTag( NAMESPACE, tagName );
814     } //-- void writeExtension( Extension, String, XmlSerializer )
815 
816     /**
817      * Method writeFileSet.
818      * 
819      * @param fileSet
820      * @param serializer
821      * @param tagName
822      * @throws java.io.IOException
823      */
824     private void writeFileSet( FileSet fileSet, String tagName, XmlSerializer serializer )
825         throws java.io.IOException
826     {
827         serializer.startTag( NAMESPACE, tagName );
828         if ( fileSet.getDirectory() != null )
829         {
830             serializer.startTag( NAMESPACE, "directory" ).text( fileSet.getDirectory() ).endTag( NAMESPACE, "directory" );
831         }
832         if ( ( fileSet.getIncludes() != null ) && ( fileSet.getIncludes().size() > 0 ) )
833         {
834             serializer.startTag( NAMESPACE, "includes" );
835             for ( Iterator iter = fileSet.getIncludes().iterator(); iter.hasNext(); )
836             {
837                 String include = (String) iter.next();
838                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
839             }
840             serializer.endTag( NAMESPACE, "includes" );
841         }
842         if ( ( fileSet.getExcludes() != null ) && ( fileSet.getExcludes().size() > 0 ) )
843         {
844             serializer.startTag( NAMESPACE, "excludes" );
845             for ( Iterator iter = fileSet.getExcludes().iterator(); iter.hasNext(); )
846             {
847                 String exclude = (String) iter.next();
848                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
849             }
850             serializer.endTag( NAMESPACE, "excludes" );
851         }
852         serializer.endTag( NAMESPACE, tagName );
853     } //-- void writeFileSet( FileSet, String, XmlSerializer )
854 
855     /**
856      * Method writeIssueManagement.
857      * 
858      * @param issueManagement
859      * @param serializer
860      * @param tagName
861      * @throws java.io.IOException
862      */
863     private void writeIssueManagement( IssueManagement issueManagement, String tagName, XmlSerializer serializer )
864         throws java.io.IOException
865     {
866         serializer.startTag( NAMESPACE, tagName );
867         if ( issueManagement.getSystem() != null )
868         {
869             serializer.startTag( NAMESPACE, "system" ).text( issueManagement.getSystem() ).endTag( NAMESPACE, "system" );
870         }
871         if ( issueManagement.getUrl() != null )
872         {
873             serializer.startTag( NAMESPACE, "url" ).text( issueManagement.getUrl() ).endTag( NAMESPACE, "url" );
874         }
875         serializer.endTag( NAMESPACE, tagName );
876     } //-- void writeIssueManagement( IssueManagement, String, XmlSerializer )
877 
878     /**
879      * Method writeLicense.
880      * 
881      * @param license
882      * @param serializer
883      * @param tagName
884      * @throws java.io.IOException
885      */
886     private void writeLicense( License license, String tagName, XmlSerializer serializer )
887         throws java.io.IOException
888     {
889         serializer.startTag( NAMESPACE, tagName );
890         if ( license.getName() != null )
891         {
892             serializer.startTag( NAMESPACE, "name" ).text( license.getName() ).endTag( NAMESPACE, "name" );
893         }
894         if ( license.getUrl() != null )
895         {
896             serializer.startTag( NAMESPACE, "url" ).text( license.getUrl() ).endTag( NAMESPACE, "url" );
897         }
898         if ( license.getDistribution() != null )
899         {
900             serializer.startTag( NAMESPACE, "distribution" ).text( license.getDistribution() ).endTag( NAMESPACE, "distribution" );
901         }
902         if ( license.getComments() != null )
903         {
904             serializer.startTag( NAMESPACE, "comments" ).text( license.getComments() ).endTag( NAMESPACE, "comments" );
905         }
906         serializer.endTag( NAMESPACE, tagName );
907     } //-- void writeLicense( License, String, XmlSerializer )
908 
909     /**
910      * Method writeMailingList.
911      * 
912      * @param mailingList
913      * @param serializer
914      * @param tagName
915      * @throws java.io.IOException
916      */
917     private void writeMailingList( MailingList mailingList, String tagName, XmlSerializer serializer )
918         throws java.io.IOException
919     {
920         serializer.startTag( NAMESPACE, tagName );
921         if ( mailingList.getName() != null )
922         {
923             serializer.startTag( NAMESPACE, "name" ).text( mailingList.getName() ).endTag( NAMESPACE, "name" );
924         }
925         if ( mailingList.getSubscribe() != null )
926         {
927             serializer.startTag( NAMESPACE, "subscribe" ).text( mailingList.getSubscribe() ).endTag( NAMESPACE, "subscribe" );
928         }
929         if ( mailingList.getUnsubscribe() != null )
930         {
931             serializer.startTag( NAMESPACE, "unsubscribe" ).text( mailingList.getUnsubscribe() ).endTag( NAMESPACE, "unsubscribe" );
932         }
933         if ( mailingList.getPost() != null )
934         {
935             serializer.startTag( NAMESPACE, "post" ).text( mailingList.getPost() ).endTag( NAMESPACE, "post" );
936         }
937         if ( mailingList.getArchive() != null )
938         {
939             serializer.startTag( NAMESPACE, "archive" ).text( mailingList.getArchive() ).endTag( NAMESPACE, "archive" );
940         }
941         if ( ( mailingList.getOtherArchives() != null ) && ( mailingList.getOtherArchives().size() > 0 ) )
942         {
943             serializer.startTag( NAMESPACE, "otherArchives" );
944             for ( Iterator iter = mailingList.getOtherArchives().iterator(); iter.hasNext(); )
945             {
946                 String otherArchive = (String) iter.next();
947                 serializer.startTag( NAMESPACE, "otherArchive" ).text( otherArchive ).endTag( NAMESPACE, "otherArchive" );
948             }
949             serializer.endTag( NAMESPACE, "otherArchives" );
950         }
951         serializer.endTag( NAMESPACE, tagName );
952     } //-- void writeMailingList( MailingList, String, XmlSerializer )
953 
954     /**
955      * Method writeModel.
956      * 
957      * @param model
958      * @param serializer
959      * @param tagName
960      * @throws java.io.IOException
961      */
962     private void writeModel( Model model, String tagName, XmlSerializer serializer )
963         throws java.io.IOException
964     {
965         if ( this.fileComment != null )
966         {
967         serializer.comment(this.fileComment);
968         }
969         serializer.setPrefix( "", "http://maven.apache.org/POM/4.0.0" );
970         serializer.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
971         serializer.startTag( NAMESPACE, tagName );
972         serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" );
973         if ( model.getChildProjectUrlInheritAppendPath() != null )
974         {
975             serializer.attribute( NAMESPACE, "child.project.url.inherit.append.path", model.getChildProjectUrlInheritAppendPath() );
976         }
977         if ( model.getModelVersion() != null )
978         {
979             serializer.startTag( NAMESPACE, "modelVersion" ).text( model.getModelVersion() ).endTag( NAMESPACE, "modelVersion" );
980         }
981         if ( model.getParent() != null )
982         {
983             writeParent( (Parent) model.getParent(), "parent", serializer );
984         }
985         if ( model.getGroupId() != null )
986         {
987             serializer.startTag( NAMESPACE, "groupId" ).text( model.getGroupId() ).endTag( NAMESPACE, "groupId" );
988         }
989         if ( model.getArtifactId() != null )
990         {
991             serializer.startTag( NAMESPACE, "artifactId" ).text( model.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
992         }
993         if ( model.getVersion() != null )
994         {
995             serializer.startTag( NAMESPACE, "version" ).text( model.getVersion() ).endTag( NAMESPACE, "version" );
996         }
997         if ( ( model.getPackaging() != null ) && !model.getPackaging().equals( "jar" ) )
998         {
999             serializer.startTag( NAMESPACE, "packaging" ).text( model.getPackaging() ).endTag( NAMESPACE, "packaging" );
1000         }
1001         if ( model.getName() != null )
1002         {
1003             serializer.startTag( NAMESPACE, "name" ).text( model.getName() ).endTag( NAMESPACE, "name" );
1004         }
1005         if ( model.getDescription() != null )
1006         {
1007             serializer.startTag( NAMESPACE, "description" ).text( model.getDescription() ).endTag( NAMESPACE, "description" );
1008         }
1009         if ( model.getUrl() != null )
1010         {
1011             serializer.startTag( NAMESPACE, "url" ).text( model.getUrl() ).endTag( NAMESPACE, "url" );
1012         }
1013         if ( model.getInceptionYear() != null )
1014         {
1015             serializer.startTag( NAMESPACE, "inceptionYear" ).text( model.getInceptionYear() ).endTag( NAMESPACE, "inceptionYear" );
1016         }
1017         if ( model.getOrganization() != null )
1018         {
1019             writeOrganization( (Organization) model.getOrganization(), "organization", serializer );
1020         }
1021         if ( ( model.getLicenses() != null ) && ( model.getLicenses().size() > 0 ) )
1022         {
1023             serializer.startTag( NAMESPACE, "licenses" );
1024             for ( Iterator iter = model.getLicenses().iterator(); iter.hasNext(); )
1025             {
1026                 License o = (License) iter.next();
1027                 writeLicense( o, "license", serializer );
1028             }
1029             serializer.endTag( NAMESPACE, "licenses" );
1030         }
1031         if ( ( model.getDevelopers() != null ) && ( model.getDevelopers().size() > 0 ) )
1032         {
1033             serializer.startTag( NAMESPACE, "developers" );
1034             for ( Iterator iter = model.getDevelopers().iterator(); iter.hasNext(); )
1035             {
1036                 Developer o = (Developer) iter.next();
1037                 writeDeveloper( o, "developer", serializer );
1038             }
1039             serializer.endTag( NAMESPACE, "developers" );
1040         }
1041         if ( ( model.getContributors() != null ) && ( model.getContributors().size() > 0 ) )
1042         {
1043             serializer.startTag( NAMESPACE, "contributors" );
1044             for ( Iterator iter = model.getContributors().iterator(); iter.hasNext(); )
1045             {
1046                 Contributor o = (Contributor) iter.next();
1047                 writeContributor( o, "contributor", serializer );
1048             }
1049             serializer.endTag( NAMESPACE, "contributors" );
1050         }
1051         if ( ( model.getMailingLists() != null ) && ( model.getMailingLists().size() > 0 ) )
1052         {
1053             serializer.startTag( NAMESPACE, "mailingLists" );
1054             for ( Iterator iter = model.getMailingLists().iterator(); iter.hasNext(); )
1055             {
1056                 MailingList o = (MailingList) iter.next();
1057                 writeMailingList( o, "mailingList", serializer );
1058             }
1059             serializer.endTag( NAMESPACE, "mailingLists" );
1060         }
1061         if ( model.getPrerequisites() != null )
1062         {
1063             writePrerequisites( (Prerequisites) model.getPrerequisites(), "prerequisites", serializer );
1064         }
1065         if ( ( model.getModules() != null ) && ( model.getModules().size() > 0 ) )
1066         {
1067             serializer.startTag( NAMESPACE, "modules" );
1068             for ( Iterator iter = model.getModules().iterator(); iter.hasNext(); )
1069             {
1070                 String module = (String) iter.next();
1071                 serializer.startTag( NAMESPACE, "module" ).text( module ).endTag( NAMESPACE, "module" );
1072             }
1073             serializer.endTag( NAMESPACE, "modules" );
1074         }
1075         if ( model.getScm() != null )
1076         {
1077             writeScm( (Scm) model.getScm(), "scm", serializer );
1078         }
1079         if ( model.getIssueManagement() != null )
1080         {
1081             writeIssueManagement( (IssueManagement) model.getIssueManagement(), "issueManagement", serializer );
1082         }
1083         if ( model.getCiManagement() != null )
1084         {
1085             writeCiManagement( (CiManagement) model.getCiManagement(), "ciManagement", serializer );
1086         }
1087         if ( model.getDistributionManagement() != null )
1088         {
1089             writeDistributionManagement( (DistributionManagement) model.getDistributionManagement(), "distributionManagement", serializer );
1090         }
1091         if ( ( model.getProperties() != null ) && ( model.getProperties().size() > 0 ) )
1092         {
1093             serializer.startTag( NAMESPACE, "properties" );
1094             for ( Iterator iter = model.getProperties().keySet().iterator(); iter.hasNext(); )
1095             {
1096                 String key = (String) iter.next();
1097                 String value = (String) model.getProperties().get( key );
1098                 serializer.startTag( NAMESPACE, key ).text( value ).endTag( NAMESPACE, key );
1099             }
1100             serializer.endTag( NAMESPACE, "properties" );
1101         }
1102         if ( model.getDependencyManagement() != null )
1103         {
1104             writeDependencyManagement( (DependencyManagement) model.getDependencyManagement(), "dependencyManagement", serializer );
1105         }
1106         if ( ( model.getDependencies() != null ) && ( model.getDependencies().size() > 0 ) )
1107         {
1108             serializer.startTag( NAMESPACE, "dependencies" );
1109             for ( Iterator iter = model.getDependencies().iterator(); iter.hasNext(); )
1110             {
1111                 Dependency o = (Dependency) iter.next();
1112                 writeDependency( o, "dependency", serializer );
1113             }
1114             serializer.endTag( NAMESPACE, "dependencies" );
1115         }
1116         if ( ( model.getRepositories() != null ) && ( model.getRepositories().size() > 0 ) )
1117         {
1118             serializer.startTag( NAMESPACE, "repositories" );
1119             for ( Iterator iter = model.getRepositories().iterator(); iter.hasNext(); )
1120             {
1121                 Repository o = (Repository) iter.next();
1122                 writeRepository( o, "repository", serializer );
1123             }
1124             serializer.endTag( NAMESPACE, "repositories" );
1125         }
1126         if ( ( model.getPluginRepositories() != null ) && ( model.getPluginRepositories().size() > 0 ) )
1127         {
1128             serializer.startTag( NAMESPACE, "pluginRepositories" );
1129             for ( Iterator iter = model.getPluginRepositories().iterator(); iter.hasNext(); )
1130             {
1131                 Repository o = (Repository) iter.next();
1132                 writeRepository( o, "pluginRepository", serializer );
1133             }
1134             serializer.endTag( NAMESPACE, "pluginRepositories" );
1135         }
1136         if ( model.getBuild() != null )
1137         {
1138             writeBuild( (Build) model.getBuild(), "build", serializer );
1139         }
1140         if ( model.getReports() != null )
1141         {
1142             ((Xpp3Dom) model.getReports()).writeToSerializer( NAMESPACE, serializer );
1143         }
1144         if ( model.getReporting() != null )
1145         {
1146             writeReporting( (Reporting) model.getReporting(), "reporting", serializer );
1147         }
1148         if ( ( model.getProfiles() != null ) && ( model.getProfiles().size() > 0 ) )
1149         {
1150             serializer.startTag( NAMESPACE, "profiles" );
1151             for ( Iterator iter = model.getProfiles().iterator(); iter.hasNext(); )
1152             {
1153                 Profile o = (Profile) iter.next();
1154                 writeProfile( o, "profile", serializer );
1155             }
1156             serializer.endTag( NAMESPACE, "profiles" );
1157         }
1158         serializer.endTag( NAMESPACE, tagName );
1159     } //-- void writeModel( Model, String, XmlSerializer )
1160 
1161     /**
1162      * Method writeModelBase.
1163      * 
1164      * @param modelBase
1165      * @param serializer
1166      * @param tagName
1167      * @throws java.io.IOException
1168      */
1169     private void writeModelBase( ModelBase modelBase, String tagName, XmlSerializer serializer )
1170         throws java.io.IOException
1171     {
1172         serializer.startTag( NAMESPACE, tagName );
1173         if ( ( modelBase.getModules() != null ) && ( modelBase.getModules().size() > 0 ) )
1174         {
1175             serializer.startTag( NAMESPACE, "modules" );
1176             for ( Iterator iter = modelBase.getModules().iterator(); iter.hasNext(); )
1177             {
1178                 String module = (String) iter.next();
1179                 serializer.startTag( NAMESPACE, "module" ).text( module ).endTag( NAMESPACE, "module" );
1180             }
1181             serializer.endTag( NAMESPACE, "modules" );
1182         }
1183         if ( modelBase.getDistributionManagement() != null )
1184         {
1185             writeDistributionManagement( (DistributionManagement) modelBase.getDistributionManagement(), "distributionManagement", serializer );
1186         }
1187         if ( ( modelBase.getProperties() != null ) && ( modelBase.getProperties().size() > 0 ) )
1188         {
1189             serializer.startTag( NAMESPACE, "properties" );
1190             for ( Iterator iter = modelBase.getProperties().keySet().iterator(); iter.hasNext(); )
1191             {
1192                 String key = (String) iter.next();
1193                 String value = (String) modelBase.getProperties().get( key );
1194                 serializer.startTag( NAMESPACE, key ).text( value ).endTag( NAMESPACE, key );
1195             }
1196             serializer.endTag( NAMESPACE, "properties" );
1197         }
1198         if ( modelBase.getDependencyManagement() != null )
1199         {
1200             writeDependencyManagement( (DependencyManagement) modelBase.getDependencyManagement(), "dependencyManagement", serializer );
1201         }
1202         if ( ( modelBase.getDependencies() != null ) && ( modelBase.getDependencies().size() > 0 ) )
1203         {
1204             serializer.startTag( NAMESPACE, "dependencies" );
1205             for ( Iterator iter = modelBase.getDependencies().iterator(); iter.hasNext(); )
1206             {
1207                 Dependency o = (Dependency) iter.next();
1208                 writeDependency( o, "dependency", serializer );
1209             }
1210             serializer.endTag( NAMESPACE, "dependencies" );
1211         }
1212         if ( ( modelBase.getRepositories() != null ) && ( modelBase.getRepositories().size() > 0 ) )
1213         {
1214             serializer.startTag( NAMESPACE, "repositories" );
1215             for ( Iterator iter = modelBase.getRepositories().iterator(); iter.hasNext(); )
1216             {
1217                 Repository o = (Repository) iter.next();
1218                 writeRepository( o, "repository", serializer );
1219             }
1220             serializer.endTag( NAMESPACE, "repositories" );
1221         }
1222         if ( ( modelBase.getPluginRepositories() != null ) && ( modelBase.getPluginRepositories().size() > 0 ) )
1223         {
1224             serializer.startTag( NAMESPACE, "pluginRepositories" );
1225             for ( Iterator iter = modelBase.getPluginRepositories().iterator(); iter.hasNext(); )
1226             {
1227                 Repository o = (Repository) iter.next();
1228                 writeRepository( o, "pluginRepository", serializer );
1229             }
1230             serializer.endTag( NAMESPACE, "pluginRepositories" );
1231         }
1232         if ( modelBase.getReports() != null )
1233         {
1234             ((Xpp3Dom) modelBase.getReports()).writeToSerializer( NAMESPACE, serializer );
1235         }
1236         if ( modelBase.getReporting() != null )
1237         {
1238             writeReporting( (Reporting) modelBase.getReporting(), "reporting", serializer );
1239         }
1240         serializer.endTag( NAMESPACE, tagName );
1241     } //-- void writeModelBase( ModelBase, String, XmlSerializer )
1242 
1243     /**
1244      * Method writeNotifier.
1245      * 
1246      * @param notifier
1247      * @param serializer
1248      * @param tagName
1249      * @throws java.io.IOException
1250      */
1251     private void writeNotifier( Notifier notifier, String tagName, XmlSerializer serializer )
1252         throws java.io.IOException
1253     {
1254         serializer.startTag( NAMESPACE, tagName );
1255         if ( ( notifier.getType() != null ) && !notifier.getType().equals( "mail" ) )
1256         {
1257             serializer.startTag( NAMESPACE, "type" ).text( notifier.getType() ).endTag( NAMESPACE, "type" );
1258         }
1259         if ( notifier.isSendOnError() != true )
1260         {
1261             serializer.startTag( NAMESPACE, "sendOnError" ).text( String.valueOf( notifier.isSendOnError() ) ).endTag( NAMESPACE, "sendOnError" );
1262         }
1263         if ( notifier.isSendOnFailure() != true )
1264         {
1265             serializer.startTag( NAMESPACE, "sendOnFailure" ).text( String.valueOf( notifier.isSendOnFailure() ) ).endTag( NAMESPACE, "sendOnFailure" );
1266         }
1267         if ( notifier.isSendOnSuccess() != true )
1268         {
1269             serializer.startTag( NAMESPACE, "sendOnSuccess" ).text( String.valueOf( notifier.isSendOnSuccess() ) ).endTag( NAMESPACE, "sendOnSuccess" );
1270         }
1271         if ( notifier.isSendOnWarning() != true )
1272         {
1273             serializer.startTag( NAMESPACE, "sendOnWarning" ).text( String.valueOf( notifier.isSendOnWarning() ) ).endTag( NAMESPACE, "sendOnWarning" );
1274         }
1275         if ( notifier.getAddress() != null )
1276         {
1277             serializer.startTag( NAMESPACE, "address" ).text( notifier.getAddress() ).endTag( NAMESPACE, "address" );
1278         }
1279         if ( ( notifier.getConfiguration() != null ) && ( notifier.getConfiguration().size() > 0 ) )
1280         {
1281             serializer.startTag( NAMESPACE, "configuration" );
1282             for ( Iterator iter = notifier.getConfiguration().keySet().iterator(); iter.hasNext(); )
1283             {
1284                 String key = (String) iter.next();
1285                 String value = (String) notifier.getConfiguration().get( key );
1286                 serializer.startTag( NAMESPACE, key ).text( value ).endTag( NAMESPACE, key );
1287             }
1288             serializer.endTag( NAMESPACE, "configuration" );
1289         }
1290         serializer.endTag( NAMESPACE, tagName );
1291     } //-- void writeNotifier( Notifier, String, XmlSerializer )
1292 
1293     /**
1294      * Method writeOrganization.
1295      * 
1296      * @param organization
1297      * @param serializer
1298      * @param tagName
1299      * @throws java.io.IOException
1300      */
1301     private void writeOrganization( Organization organization, String tagName, XmlSerializer serializer )
1302         throws java.io.IOException
1303     {
1304         serializer.startTag( NAMESPACE, tagName );
1305         if ( organization.getName() != null )
1306         {
1307             serializer.startTag( NAMESPACE, "name" ).text( organization.getName() ).endTag( NAMESPACE, "name" );
1308         }
1309         if ( organization.getUrl() != null )
1310         {
1311             serializer.startTag( NAMESPACE, "url" ).text( organization.getUrl() ).endTag( NAMESPACE, "url" );
1312         }
1313         serializer.endTag( NAMESPACE, tagName );
1314     } //-- void writeOrganization( Organization, String, XmlSerializer )
1315 
1316     /**
1317      * Method writeParent.
1318      * 
1319      * @param parent
1320      * @param serializer
1321      * @param tagName
1322      * @throws java.io.IOException
1323      */
1324     private void writeParent( Parent parent, String tagName, XmlSerializer serializer )
1325         throws java.io.IOException
1326     {
1327         serializer.startTag( NAMESPACE, tagName );
1328         if ( parent.getGroupId() != null )
1329         {
1330             serializer.startTag( NAMESPACE, "groupId" ).text( parent.getGroupId() ).endTag( NAMESPACE, "groupId" );
1331         }
1332         if ( parent.getArtifactId() != null )
1333         {
1334             serializer.startTag( NAMESPACE, "artifactId" ).text( parent.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
1335         }
1336         if ( parent.getVersion() != null )
1337         {
1338             serializer.startTag( NAMESPACE, "version" ).text( parent.getVersion() ).endTag( NAMESPACE, "version" );
1339         }
1340         if ( ( parent.getRelativePath() != null ) && !parent.getRelativePath().equals( "../pom.xml" ) )
1341         {
1342             serializer.startTag( NAMESPACE, "relativePath" ).text( parent.getRelativePath() ).endTag( NAMESPACE, "relativePath" );
1343         }
1344         serializer.endTag( NAMESPACE, tagName );
1345     } //-- void writeParent( Parent, String, XmlSerializer )
1346 
1347     /**
1348      * Method writePatternSet.
1349      * 
1350      * @param patternSet
1351      * @param serializer
1352      * @param tagName
1353      * @throws java.io.IOException
1354      */
1355     private void writePatternSet( PatternSet patternSet, String tagName, XmlSerializer serializer )
1356         throws java.io.IOException
1357     {
1358         serializer.startTag( NAMESPACE, tagName );
1359         if ( ( patternSet.getIncludes() != null ) && ( patternSet.getIncludes().size() > 0 ) )
1360         {
1361             serializer.startTag( NAMESPACE, "includes" );
1362             for ( Iterator iter = patternSet.getIncludes().iterator(); iter.hasNext(); )
1363             {
1364                 String include = (String) iter.next();
1365                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
1366             }
1367             serializer.endTag( NAMESPACE, "includes" );
1368         }
1369         if ( ( patternSet.getExcludes() != null ) && ( patternSet.getExcludes().size() > 0 ) )
1370         {
1371             serializer.startTag( NAMESPACE, "excludes" );
1372             for ( Iterator iter = patternSet.getExcludes().iterator(); iter.hasNext(); )
1373             {
1374                 String exclude = (String) iter.next();
1375                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
1376             }
1377             serializer.endTag( NAMESPACE, "excludes" );
1378         }
1379         serializer.endTag( NAMESPACE, tagName );
1380     } //-- void writePatternSet( PatternSet, String, XmlSerializer )
1381 
1382     /**
1383      * Method writePlugin.
1384      * 
1385      * @param plugin
1386      * @param serializer
1387      * @param tagName
1388      * @throws java.io.IOException
1389      */
1390     private void writePlugin( Plugin plugin, String tagName, XmlSerializer serializer )
1391         throws java.io.IOException
1392     {
1393         serializer.startTag( NAMESPACE, tagName );
1394         if ( ( plugin.getGroupId() != null ) && !plugin.getGroupId().equals( "org.apache.maven.plugins" ) )
1395         {
1396             serializer.startTag( NAMESPACE, "groupId" ).text( plugin.getGroupId() ).endTag( NAMESPACE, "groupId" );
1397         }
1398         if ( plugin.getArtifactId() != null )
1399         {
1400             serializer.startTag( NAMESPACE, "artifactId" ).text( plugin.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
1401         }
1402         if ( plugin.getVersion() != null )
1403         {
1404             serializer.startTag( NAMESPACE, "version" ).text( plugin.getVersion() ).endTag( NAMESPACE, "version" );
1405         }
1406         if ( plugin.getExtensions() != null )
1407         {
1408             serializer.startTag( NAMESPACE, "extensions" ).text( plugin.getExtensions() ).endTag( NAMESPACE, "extensions" );
1409         }
1410         if ( ( plugin.getExecutions() != null ) && ( plugin.getExecutions().size() > 0 ) )
1411         {
1412             serializer.startTag( NAMESPACE, "executions" );
1413             for ( Iterator iter = plugin.getExecutions().iterator(); iter.hasNext(); )
1414             {
1415                 PluginExecution o = (PluginExecution) iter.next();
1416                 writePluginExecution( o, "execution", serializer );
1417             }
1418             serializer.endTag( NAMESPACE, "executions" );
1419         }
1420         if ( ( plugin.getDependencies() != null ) && ( plugin.getDependencies().size() > 0 ) )
1421         {
1422             serializer.startTag( NAMESPACE, "dependencies" );
1423             for ( Iterator iter = plugin.getDependencies().iterator(); iter.hasNext(); )
1424             {
1425                 Dependency o = (Dependency) iter.next();
1426                 writeDependency( o, "dependency", serializer );
1427             }
1428             serializer.endTag( NAMESPACE, "dependencies" );
1429         }
1430         if ( plugin.getGoals() != null )
1431         {
1432             ((Xpp3Dom) plugin.getGoals()).writeToSerializer( NAMESPACE, serializer );
1433         }
1434         if ( plugin.getInherited() != null )
1435         {
1436             serializer.startTag( NAMESPACE, "inherited" ).text( plugin.getInherited() ).endTag( NAMESPACE, "inherited" );
1437         }
1438         if ( plugin.getConfiguration() != null )
1439         {
1440             ((Xpp3Dom) plugin.getConfiguration()).writeToSerializer( NAMESPACE, serializer );
1441         }
1442         serializer.endTag( NAMESPACE, tagName );
1443     } //-- void writePlugin( Plugin, String, XmlSerializer )
1444 
1445     /**
1446      * Method writePluginConfiguration.
1447      * 
1448      * @param pluginConfiguration
1449      * @param serializer
1450      * @param tagName
1451      * @throws java.io.IOException
1452      */
1453     private void writePluginConfiguration( PluginConfiguration pluginConfiguration, String tagName, XmlSerializer serializer )
1454         throws java.io.IOException
1455     {
1456         serializer.startTag( NAMESPACE, tagName );
1457         if ( pluginConfiguration.getPluginManagement() != null )
1458         {
1459             writePluginManagement( (PluginManagement) pluginConfiguration.getPluginManagement(), "pluginManagement", serializer );
1460         }
1461         if ( ( pluginConfiguration.getPlugins() != null ) && ( pluginConfiguration.getPlugins().size() > 0 ) )
1462         {
1463             serializer.startTag( NAMESPACE, "plugins" );
1464             for ( Iterator iter = pluginConfiguration.getPlugins().iterator(); iter.hasNext(); )
1465             {
1466                 Plugin o = (Plugin) iter.next();
1467                 writePlugin( o, "plugin", serializer );
1468             }
1469             serializer.endTag( NAMESPACE, "plugins" );
1470         }
1471         serializer.endTag( NAMESPACE, tagName );
1472     } //-- void writePluginConfiguration( PluginConfiguration, String, XmlSerializer )
1473 
1474     /**
1475      * Method writePluginContainer.
1476      * 
1477      * @param pluginContainer
1478      * @param serializer
1479      * @param tagName
1480      * @throws java.io.IOException
1481      */
1482     private void writePluginContainer( PluginContainer pluginContainer, String tagName, XmlSerializer serializer )
1483         throws java.io.IOException
1484     {
1485         serializer.startTag( NAMESPACE, tagName );
1486         if ( ( pluginContainer.getPlugins() != null ) && ( pluginContainer.getPlugins().size() > 0 ) )
1487         {
1488             serializer.startTag( NAMESPACE, "plugins" );
1489             for ( Iterator iter = pluginContainer.getPlugins().iterator(); iter.hasNext(); )
1490             {
1491                 Plugin o = (Plugin) iter.next();
1492                 writePlugin( o, "plugin", serializer );
1493             }
1494             serializer.endTag( NAMESPACE, "plugins" );
1495         }
1496         serializer.endTag( NAMESPACE, tagName );
1497     } //-- void writePluginContainer( PluginContainer, String, XmlSerializer )
1498 
1499     /**
1500      * Method writePluginExecution.
1501      * 
1502      * @param pluginExecution
1503      * @param serializer
1504      * @param tagName
1505      * @throws java.io.IOException
1506      */
1507     private void writePluginExecution( PluginExecution pluginExecution, String tagName, XmlSerializer serializer )
1508         throws java.io.IOException
1509     {
1510         serializer.startTag( NAMESPACE, tagName );
1511         if ( ( pluginExecution.getId() != null ) && !pluginExecution.getId().equals( "default" ) )
1512         {
1513             serializer.startTag( NAMESPACE, "id" ).text( pluginExecution.getId() ).endTag( NAMESPACE, "id" );
1514         }
1515         if ( pluginExecution.getPhase() != null )
1516         {
1517             serializer.startTag( NAMESPACE, "phase" ).text( pluginExecution.getPhase() ).endTag( NAMESPACE, "phase" );
1518         }
1519         if ( ( pluginExecution.getGoals() != null ) && ( pluginExecution.getGoals().size() > 0 ) )
1520         {
1521             serializer.startTag( NAMESPACE, "goals" );
1522             for ( Iterator iter = pluginExecution.getGoals().iterator(); iter.hasNext(); )
1523             {
1524                 String goal = (String) iter.next();
1525                 serializer.startTag( NAMESPACE, "goal" ).text( goal ).endTag( NAMESPACE, "goal" );
1526             }
1527             serializer.endTag( NAMESPACE, "goals" );
1528         }
1529         if ( pluginExecution.getInherited() != null )
1530         {
1531             serializer.startTag( NAMESPACE, "inherited" ).text( pluginExecution.getInherited() ).endTag( NAMESPACE, "inherited" );
1532         }
1533         if ( pluginExecution.getConfiguration() != null )
1534         {
1535             ((Xpp3Dom) pluginExecution.getConfiguration()).writeToSerializer( NAMESPACE, serializer );
1536         }
1537         serializer.endTag( NAMESPACE, tagName );
1538     } //-- void writePluginExecution( PluginExecution, String, XmlSerializer )
1539 
1540     /**
1541      * Method writePluginManagement.
1542      * 
1543      * @param pluginManagement
1544      * @param serializer
1545      * @param tagName
1546      * @throws java.io.IOException
1547      */
1548     private void writePluginManagement( PluginManagement pluginManagement, String tagName, XmlSerializer serializer )
1549         throws java.io.IOException
1550     {
1551         serializer.startTag( NAMESPACE, tagName );
1552         if ( ( pluginManagement.getPlugins() != null ) && ( pluginManagement.getPlugins().size() > 0 ) )
1553         {
1554             serializer.startTag( NAMESPACE, "plugins" );
1555             for ( Iterator iter = pluginManagement.getPlugins().iterator(); iter.hasNext(); )
1556             {
1557                 Plugin o = (Plugin) iter.next();
1558                 writePlugin( o, "plugin", serializer );
1559             }
1560             serializer.endTag( NAMESPACE, "plugins" );
1561         }
1562         serializer.endTag( NAMESPACE, tagName );
1563     } //-- void writePluginManagement( PluginManagement, String, XmlSerializer )
1564 
1565     /**
1566      * Method writePrerequisites.
1567      * 
1568      * @param prerequisites
1569      * @param serializer
1570      * @param tagName
1571      * @throws java.io.IOException
1572      */
1573     private void writePrerequisites( Prerequisites prerequisites, String tagName, XmlSerializer serializer )
1574         throws java.io.IOException
1575     {
1576         serializer.startTag( NAMESPACE, tagName );
1577         if ( ( prerequisites.getMaven() != null ) && !prerequisites.getMaven().equals( "2.0" ) )
1578         {
1579             serializer.startTag( NAMESPACE, "maven" ).text( prerequisites.getMaven() ).endTag( NAMESPACE, "maven" );
1580         }
1581         serializer.endTag( NAMESPACE, tagName );
1582     } //-- void writePrerequisites( Prerequisites, String, XmlSerializer )
1583 
1584     /**
1585      * Method writeProfile.
1586      * 
1587      * @param profile
1588      * @param serializer
1589      * @param tagName
1590      * @throws java.io.IOException
1591      */
1592     private void writeProfile( Profile profile, String tagName, XmlSerializer serializer )
1593         throws java.io.IOException
1594     {
1595         serializer.startTag( NAMESPACE, tagName );
1596         if ( ( profile.getId() != null ) && !profile.getId().equals( "default" ) )
1597         {
1598             serializer.startTag( NAMESPACE, "id" ).text( profile.getId() ).endTag( NAMESPACE, "id" );
1599         }
1600         if ( profile.getActivation() != null )
1601         {
1602             writeActivation( (Activation) profile.getActivation(), "activation", serializer );
1603         }
1604         if ( profile.getBuild() != null )
1605         {
1606             writeBuildBase( (BuildBase) profile.getBuild(), "build", serializer );
1607         }
1608         if ( ( profile.getModules() != null ) && ( profile.getModules().size() > 0 ) )
1609         {
1610             serializer.startTag( NAMESPACE, "modules" );
1611             for ( Iterator iter = profile.getModules().iterator(); iter.hasNext(); )
1612             {
1613                 String module = (String) iter.next();
1614                 serializer.startTag( NAMESPACE, "module" ).text( module ).endTag( NAMESPACE, "module" );
1615             }
1616             serializer.endTag( NAMESPACE, "modules" );
1617         }
1618         if ( profile.getDistributionManagement() != null )
1619         {
1620             writeDistributionManagement( (DistributionManagement) profile.getDistributionManagement(), "distributionManagement", serializer );
1621         }
1622         if ( ( profile.getProperties() != null ) && ( profile.getProperties().size() > 0 ) )
1623         {
1624             serializer.startTag( NAMESPACE, "properties" );
1625             for ( Iterator iter = profile.getProperties().keySet().iterator(); iter.hasNext(); )
1626             {
1627                 String key = (String) iter.next();
1628                 String value = (String) profile.getProperties().get( key );
1629                 serializer.startTag( NAMESPACE, key ).text( value ).endTag( NAMESPACE, key );
1630             }
1631             serializer.endTag( NAMESPACE, "properties" );
1632         }
1633         if ( profile.getDependencyManagement() != null )
1634         {
1635             writeDependencyManagement( (DependencyManagement) profile.getDependencyManagement(), "dependencyManagement", serializer );
1636         }
1637         if ( ( profile.getDependencies() != null ) && ( profile.getDependencies().size() > 0 ) )
1638         {
1639             serializer.startTag( NAMESPACE, "dependencies" );
1640             for ( Iterator iter = profile.getDependencies().iterator(); iter.hasNext(); )
1641             {
1642                 Dependency o = (Dependency) iter.next();
1643                 writeDependency( o, "dependency", serializer );
1644             }
1645             serializer.endTag( NAMESPACE, "dependencies" );
1646         }
1647         if ( ( profile.getRepositories() != null ) && ( profile.getRepositories().size() > 0 ) )
1648         {
1649             serializer.startTag( NAMESPACE, "repositories" );
1650             for ( Iterator iter = profile.getRepositories().iterator(); iter.hasNext(); )
1651             {
1652                 Repository o = (Repository) iter.next();
1653                 writeRepository( o, "repository", serializer );
1654             }
1655             serializer.endTag( NAMESPACE, "repositories" );
1656         }
1657         if ( ( profile.getPluginRepositories() != null ) && ( profile.getPluginRepositories().size() > 0 ) )
1658         {
1659             serializer.startTag( NAMESPACE, "pluginRepositories" );
1660             for ( Iterator iter = profile.getPluginRepositories().iterator(); iter.hasNext(); )
1661             {
1662                 Repository o = (Repository) iter.next();
1663                 writeRepository( o, "pluginRepository", serializer );
1664             }
1665             serializer.endTag( NAMESPACE, "pluginRepositories" );
1666         }
1667         if ( profile.getReports() != null )
1668         {
1669             ((Xpp3Dom) profile.getReports()).writeToSerializer( NAMESPACE, serializer );
1670         }
1671         if ( profile.getReporting() != null )
1672         {
1673             writeReporting( (Reporting) profile.getReporting(), "reporting", serializer );
1674         }
1675         serializer.endTag( NAMESPACE, tagName );
1676     } //-- void writeProfile( Profile, String, XmlSerializer )
1677 
1678     /**
1679      * Method writeRelocation.
1680      * 
1681      * @param relocation
1682      * @param serializer
1683      * @param tagName
1684      * @throws java.io.IOException
1685      */
1686     private void writeRelocation( Relocation relocation, String tagName, XmlSerializer serializer )
1687         throws java.io.IOException
1688     {
1689         serializer.startTag( NAMESPACE, tagName );
1690         if ( relocation.getGroupId() != null )
1691         {
1692             serializer.startTag( NAMESPACE, "groupId" ).text( relocation.getGroupId() ).endTag( NAMESPACE, "groupId" );
1693         }
1694         if ( relocation.getArtifactId() != null )
1695         {
1696             serializer.startTag( NAMESPACE, "artifactId" ).text( relocation.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
1697         }
1698         if ( relocation.getVersion() != null )
1699         {
1700             serializer.startTag( NAMESPACE, "version" ).text( relocation.getVersion() ).endTag( NAMESPACE, "version" );
1701         }
1702         if ( relocation.getMessage() != null )
1703         {
1704             serializer.startTag( NAMESPACE, "message" ).text( relocation.getMessage() ).endTag( NAMESPACE, "message" );
1705         }
1706         serializer.endTag( NAMESPACE, tagName );
1707     } //-- void writeRelocation( Relocation, String, XmlSerializer )
1708 
1709     /**
1710      * Method writeReportPlugin.
1711      * 
1712      * @param reportPlugin
1713      * @param serializer
1714      * @param tagName
1715      * @throws java.io.IOException
1716      */
1717     private void writeReportPlugin( ReportPlugin reportPlugin, String tagName, XmlSerializer serializer )
1718         throws java.io.IOException
1719     {
1720         serializer.startTag( NAMESPACE, tagName );
1721         if ( ( reportPlugin.getGroupId() != null ) && !reportPlugin.getGroupId().equals( "org.apache.maven.plugins" ) )
1722         {
1723             serializer.startTag( NAMESPACE, "groupId" ).text( reportPlugin.getGroupId() ).endTag( NAMESPACE, "groupId" );
1724         }
1725         if ( reportPlugin.getArtifactId() != null )
1726         {
1727             serializer.startTag( NAMESPACE, "artifactId" ).text( reportPlugin.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
1728         }
1729         if ( reportPlugin.getVersion() != null )
1730         {
1731             serializer.startTag( NAMESPACE, "version" ).text( reportPlugin.getVersion() ).endTag( NAMESPACE, "version" );
1732         }
1733         if ( ( reportPlugin.getReportSets() != null ) && ( reportPlugin.getReportSets().size() > 0 ) )
1734         {
1735             serializer.startTag( NAMESPACE, "reportSets" );
1736             for ( Iterator iter = reportPlugin.getReportSets().iterator(); iter.hasNext(); )
1737             {
1738                 ReportSet o = (ReportSet) iter.next();
1739                 writeReportSet( o, "reportSet", serializer );
1740             }
1741             serializer.endTag( NAMESPACE, "reportSets" );
1742         }
1743         if ( reportPlugin.getInherited() != null )
1744         {
1745             serializer.startTag( NAMESPACE, "inherited" ).text( reportPlugin.getInherited() ).endTag( NAMESPACE, "inherited" );
1746         }
1747         if ( reportPlugin.getConfiguration() != null )
1748         {
1749             ((Xpp3Dom) reportPlugin.getConfiguration()).writeToSerializer( NAMESPACE, serializer );
1750         }
1751         serializer.endTag( NAMESPACE, tagName );
1752     } //-- void writeReportPlugin( ReportPlugin, String, XmlSerializer )
1753 
1754     /**
1755      * Method writeReportSet.
1756      * 
1757      * @param reportSet
1758      * @param serializer
1759      * @param tagName
1760      * @throws java.io.IOException
1761      */
1762     private void writeReportSet( ReportSet reportSet, String tagName, XmlSerializer serializer )
1763         throws java.io.IOException
1764     {
1765         serializer.startTag( NAMESPACE, tagName );
1766         if ( ( reportSet.getId() != null ) && !reportSet.getId().equals( "default" ) )
1767         {
1768             serializer.startTag( NAMESPACE, "id" ).text( reportSet.getId() ).endTag( NAMESPACE, "id" );
1769         }
1770         if ( ( reportSet.getReports() != null ) && ( reportSet.getReports().size() > 0 ) )
1771         {
1772             serializer.startTag( NAMESPACE, "reports" );
1773             for ( Iterator iter = reportSet.getReports().iterator(); iter.hasNext(); )
1774             {
1775                 String report = (String) iter.next();
1776                 serializer.startTag( NAMESPACE, "report" ).text( report ).endTag( NAMESPACE, "report" );
1777             }
1778             serializer.endTag( NAMESPACE, "reports" );
1779         }
1780         if ( reportSet.getInherited() != null )
1781         {
1782             serializer.startTag( NAMESPACE, "inherited" ).text( reportSet.getInherited() ).endTag( NAMESPACE, "inherited" );
1783         }
1784         if ( reportSet.getConfiguration() != null )
1785         {
1786             ((Xpp3Dom) reportSet.getConfiguration()).writeToSerializer( NAMESPACE, serializer );
1787         }
1788         serializer.endTag( NAMESPACE, tagName );
1789     } //-- void writeReportSet( ReportSet, String, XmlSerializer )
1790 
1791     /**
1792      * Method writeReporting.
1793      * 
1794      * @param reporting
1795      * @param serializer
1796      * @param tagName
1797      * @throws java.io.IOException
1798      */
1799     private void writeReporting( Reporting reporting, String tagName, XmlSerializer serializer )
1800         throws java.io.IOException
1801     {
1802         serializer.startTag( NAMESPACE, tagName );
1803         if ( reporting.getExcludeDefaults() != null )
1804         {
1805             serializer.startTag( NAMESPACE, "excludeDefaults" ).text( reporting.getExcludeDefaults() ).endTag( NAMESPACE, "excludeDefaults" );
1806         }
1807         if ( reporting.getOutputDirectory() != null )
1808         {
1809             serializer.startTag( NAMESPACE, "outputDirectory" ).text( reporting.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" );
1810         }
1811         if ( ( reporting.getPlugins() != null ) && ( reporting.getPlugins().size() > 0 ) )
1812         {
1813             serializer.startTag( NAMESPACE, "plugins" );
1814             for ( Iterator iter = reporting.getPlugins().iterator(); iter.hasNext(); )
1815             {
1816                 ReportPlugin o = (ReportPlugin) iter.next();
1817                 writeReportPlugin( o, "plugin", serializer );
1818             }
1819             serializer.endTag( NAMESPACE, "plugins" );
1820         }
1821         serializer.endTag( NAMESPACE, tagName );
1822     } //-- void writeReporting( Reporting, String, XmlSerializer )
1823 
1824     /**
1825      * Method writeRepository.
1826      * 
1827      * @param repository
1828      * @param serializer
1829      * @param tagName
1830      * @throws java.io.IOException
1831      */
1832     private void writeRepository( Repository repository, String tagName, XmlSerializer serializer )
1833         throws java.io.IOException
1834     {
1835         serializer.startTag( NAMESPACE, tagName );
1836         if ( repository.getReleases() != null )
1837         {
1838             writeRepositoryPolicy( (RepositoryPolicy) repository.getReleases(), "releases", serializer );
1839         }
1840         if ( repository.getSnapshots() != null )
1841         {
1842             writeRepositoryPolicy( (RepositoryPolicy) repository.getSnapshots(), "snapshots", serializer );
1843         }
1844         if ( repository.getId() != null )
1845         {
1846             serializer.startTag( NAMESPACE, "id" ).text( repository.getId() ).endTag( NAMESPACE, "id" );
1847         }
1848         if ( repository.getName() != null )
1849         {
1850             serializer.startTag( NAMESPACE, "name" ).text( repository.getName() ).endTag( NAMESPACE, "name" );
1851         }
1852         if ( repository.getUrl() != null )
1853         {
1854             serializer.startTag( NAMESPACE, "url" ).text( repository.getUrl() ).endTag( NAMESPACE, "url" );
1855         }
1856         if ( ( repository.getLayout() != null ) && !repository.getLayout().equals( "default" ) )
1857         {
1858             serializer.startTag( NAMESPACE, "layout" ).text( repository.getLayout() ).endTag( NAMESPACE, "layout" );
1859         }
1860         serializer.endTag( NAMESPACE, tagName );
1861     } //-- void writeRepository( Repository, String, XmlSerializer )
1862 
1863     /**
1864      * Method writeRepositoryBase.
1865      * 
1866      * @param repositoryBase
1867      * @param serializer
1868      * @param tagName
1869      * @throws java.io.IOException
1870      */
1871     private void writeRepositoryBase( RepositoryBase repositoryBase, String tagName, XmlSerializer serializer )
1872         throws java.io.IOException
1873     {
1874         serializer.startTag( NAMESPACE, tagName );
1875         if ( repositoryBase.getId() != null )
1876         {
1877             serializer.startTag( NAMESPACE, "id" ).text( repositoryBase.getId() ).endTag( NAMESPACE, "id" );
1878         }
1879         if ( repositoryBase.getName() != null )
1880         {
1881             serializer.startTag( NAMESPACE, "name" ).text( repositoryBase.getName() ).endTag( NAMESPACE, "name" );
1882         }
1883         if ( repositoryBase.getUrl() != null )
1884         {
1885             serializer.startTag( NAMESPACE, "url" ).text( repositoryBase.getUrl() ).endTag( NAMESPACE, "url" );
1886         }
1887         if ( ( repositoryBase.getLayout() != null ) && !repositoryBase.getLayout().equals( "default" ) )
1888         {
1889             serializer.startTag( NAMESPACE, "layout" ).text( repositoryBase.getLayout() ).endTag( NAMESPACE, "layout" );
1890         }
1891         serializer.endTag( NAMESPACE, tagName );
1892     } //-- void writeRepositoryBase( RepositoryBase, String, XmlSerializer )
1893 
1894     /**
1895      * Method writeRepositoryPolicy.
1896      * 
1897      * @param repositoryPolicy
1898      * @param serializer
1899      * @param tagName
1900      * @throws java.io.IOException
1901      */
1902     private void writeRepositoryPolicy( RepositoryPolicy repositoryPolicy, String tagName, XmlSerializer serializer )
1903         throws java.io.IOException
1904     {
1905         serializer.startTag( NAMESPACE, tagName );
1906         if ( repositoryPolicy.getEnabled() != null )
1907         {
1908             serializer.startTag( NAMESPACE, "enabled" ).text( repositoryPolicy.getEnabled() ).endTag( NAMESPACE, "enabled" );
1909         }
1910         if ( repositoryPolicy.getUpdatePolicy() != null )
1911         {
1912             serializer.startTag( NAMESPACE, "updatePolicy" ).text( repositoryPolicy.getUpdatePolicy() ).endTag( NAMESPACE, "updatePolicy" );
1913         }
1914         if ( repositoryPolicy.getChecksumPolicy() != null )
1915         {
1916             serializer.startTag( NAMESPACE, "checksumPolicy" ).text( repositoryPolicy.getChecksumPolicy() ).endTag( NAMESPACE, "checksumPolicy" );
1917         }
1918         serializer.endTag( NAMESPACE, tagName );
1919     } //-- void writeRepositoryPolicy( RepositoryPolicy, String, XmlSerializer )
1920 
1921     /**
1922      * Method writeResource.
1923      * 
1924      * @param resource
1925      * @param serializer
1926      * @param tagName
1927      * @throws java.io.IOException
1928      */
1929     private void writeResource( Resource resource, String tagName, XmlSerializer serializer )
1930         throws java.io.IOException
1931     {
1932         serializer.startTag( NAMESPACE, tagName );
1933         if ( resource.getTargetPath() != null )
1934         {
1935             serializer.startTag( NAMESPACE, "targetPath" ).text( resource.getTargetPath() ).endTag( NAMESPACE, "targetPath" );
1936         }
1937         if ( resource.getFiltering() != null )
1938         {
1939             serializer.startTag( NAMESPACE, "filtering" ).text( resource.getFiltering() ).endTag( NAMESPACE, "filtering" );
1940         }
1941         if ( resource.getDirectory() != null )
1942         {
1943             serializer.startTag( NAMESPACE, "directory" ).text( resource.getDirectory() ).endTag( NAMESPACE, "directory" );
1944         }
1945         if ( ( resource.getIncludes() != null ) && ( resource.getIncludes().size() > 0 ) )
1946         {
1947             serializer.startTag( NAMESPACE, "includes" );
1948             for ( Iterator iter = resource.getIncludes().iterator(); iter.hasNext(); )
1949             {
1950                 String include = (String) iter.next();
1951                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
1952             }
1953             serializer.endTag( NAMESPACE, "includes" );
1954         }
1955         if ( ( resource.getExcludes() != null ) && ( resource.getExcludes().size() > 0 ) )
1956         {
1957             serializer.startTag( NAMESPACE, "excludes" );
1958             for ( Iterator iter = resource.getExcludes().iterator(); iter.hasNext(); )
1959             {
1960                 String exclude = (String) iter.next();
1961                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
1962             }
1963             serializer.endTag( NAMESPACE, "excludes" );
1964         }
1965         serializer.endTag( NAMESPACE, tagName );
1966     } //-- void writeResource( Resource, String, XmlSerializer )
1967 
1968     /**
1969      * Method writeScm.
1970      * 
1971      * @param scm
1972      * @param serializer
1973      * @param tagName
1974      * @throws java.io.IOException
1975      */
1976     private void writeScm( Scm scm, String tagName, XmlSerializer serializer )
1977         throws java.io.IOException
1978     {
1979         serializer.startTag( NAMESPACE, tagName );
1980         if ( scm.getChildScmConnectionInheritAppendPath() != null )
1981         {
1982             serializer.attribute( NAMESPACE, "child.scm.connection.inherit.append.path", scm.getChildScmConnectionInheritAppendPath() );
1983         }
1984         if ( scm.getChildScmDeveloperConnectionInheritAppendPath() != null )
1985         {
1986             serializer.attribute( NAMESPACE, "child.scm.developerConnection.inherit.append.path", scm.getChildScmDeveloperConnectionInheritAppendPath() );
1987         }
1988         if ( scm.getChildScmUrlInheritAppendPath() != null )
1989         {
1990             serializer.attribute( NAMESPACE, "child.scm.url.inherit.append.path", scm.getChildScmUrlInheritAppendPath() );
1991         }
1992         if ( scm.getConnection() != null )
1993         {
1994             serializer.startTag( NAMESPACE, "connection" ).text( scm.getConnection() ).endTag( NAMESPACE, "connection" );
1995         }
1996         if ( scm.getDeveloperConnection() != null )
1997         {
1998             serializer.startTag( NAMESPACE, "developerConnection" ).text( scm.getDeveloperConnection() ).endTag( NAMESPACE, "developerConnection" );
1999         }
2000         if ( ( scm.getTag() != null ) && !scm.getTag().equals( "HEAD" ) )
2001         {
2002             serializer.startTag( NAMESPACE, "tag" ).text( scm.getTag() ).endTag( NAMESPACE, "tag" );
2003         }
2004         if ( scm.getUrl() != null )
2005         {
2006             serializer.startTag( NAMESPACE, "url" ).text( scm.getUrl() ).endTag( NAMESPACE, "url" );
2007         }
2008         serializer.endTag( NAMESPACE, tagName );
2009     } //-- void writeScm( Scm, String, XmlSerializer )
2010 
2011     /**
2012      * Method writeSite.
2013      * 
2014      * @param site
2015      * @param serializer
2016      * @param tagName
2017      * @throws java.io.IOException
2018      */
2019     private void writeSite( Site site, String tagName, XmlSerializer serializer )
2020         throws java.io.IOException
2021     {
2022         serializer.startTag( NAMESPACE, tagName );
2023         if ( site.getChildSiteUrlInheritAppendPath() != null )
2024         {
2025             serializer.attribute( NAMESPACE, "child.site.url.inherit.append.path", site.getChildSiteUrlInheritAppendPath() );
2026         }
2027         if ( site.getId() != null )
2028         {
2029             serializer.startTag( NAMESPACE, "id" ).text( site.getId() ).endTag( NAMESPACE, "id" );
2030         }
2031         if ( site.getName() != null )
2032         {
2033             serializer.startTag( NAMESPACE, "name" ).text( site.getName() ).endTag( NAMESPACE, "name" );
2034         }
2035         if ( site.getUrl() != null )
2036         {
2037             serializer.startTag( NAMESPACE, "url" ).text( site.getUrl() ).endTag( NAMESPACE, "url" );
2038         }
2039         serializer.endTag( NAMESPACE, tagName );
2040     } //-- void writeSite( Site, String, XmlSerializer )
2041 
2042 }