View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.9.1,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.plugins.assembly.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.plugins.assembly.model.Assembly;
16  import org.apache.maven.plugins.assembly.model.ContainerDescriptorHandlerConfig;
17  import org.apache.maven.plugins.assembly.model.DependencySet;
18  import org.apache.maven.plugins.assembly.model.FileItem;
19  import org.apache.maven.plugins.assembly.model.FileSet;
20  import org.apache.maven.plugins.assembly.model.GroupVersionAlignment;
21  import org.apache.maven.plugins.assembly.model.ModuleBinaries;
22  import org.apache.maven.plugins.assembly.model.ModuleSet;
23  import org.apache.maven.plugins.assembly.model.ModuleSources;
24  import org.apache.maven.plugins.assembly.model.Repository;
25  import org.apache.maven.plugins.assembly.model.UnpackOptions;
26  import org.codehaus.plexus.util.xml.Xpp3Dom;
27  import org.codehaus.plexus.util.xml.pull.MXSerializer;
28  import org.codehaus.plexus.util.xml.pull.XmlSerializer;
29  
30  /**
31   * Class AssemblyXpp3Writer.
32   * 
33   * @version $Revision$ $Date$
34   */
35  @SuppressWarnings( "all" )
36  public class AssemblyXpp3Writer
37  {
38  
39        //--------------------------/
40       //- Class/Member Variables -/
41      //--------------------------/
42  
43      /**
44       * Field NAMESPACE.
45       */
46      private static final String NAMESPACE = null;
47  
48      /**
49       * Field fileComment.
50       */
51      private String fileComment = null;
52  
53  
54        //-----------/
55       //- Methods -/
56      //-----------/
57  
58      /**
59       * Method setFileComment.
60       * 
61       * @param fileComment
62       */
63      public void setFileComment( String fileComment )
64      {
65          this.fileComment = fileComment;
66      } //-- void setFileComment( String )
67  
68      /**
69       * Method write.
70       * 
71       * @param writer
72       * @param assembly
73       * @throws java.io.IOException
74       */
75      public void write( Writer writer, Assembly assembly )
76          throws java.io.IOException
77      {
78          XmlSerializer serializer = new MXSerializer();
79          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
80          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
81          serializer.setOutput( writer );
82          serializer.startDocument( assembly.getModelEncoding(), null );
83          writeAssembly( assembly, "assembly", serializer );
84          serializer.endDocument();
85      } //-- void write( Writer, Assembly )
86  
87      /**
88       * Method write.
89       * 
90       * @param stream
91       * @param assembly
92       * @throws java.io.IOException
93       */
94      public void write( OutputStream stream, Assembly assembly )
95          throws java.io.IOException
96      {
97          XmlSerializer serializer = new MXSerializer();
98          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
99          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
100         serializer.setOutput( stream, assembly.getModelEncoding() );
101         serializer.startDocument( assembly.getModelEncoding(), null );
102         writeAssembly( assembly, "assembly", serializer );
103         serializer.endDocument();
104     } //-- void write( OutputStream, Assembly )
105 
106     /**
107      * Method writeAssembly.
108      * 
109      * @param assembly
110      * @param serializer
111      * @param tagName
112      * @throws java.io.IOException
113      */
114     private void writeAssembly( Assembly assembly, String tagName, XmlSerializer serializer )
115         throws java.io.IOException
116     {
117         if ( this.fileComment != null )
118         {
119         serializer.comment(this.fileComment);
120         }
121         serializer.setPrefix( "", "http://maven.apache.org/ASSEMBLY/2.1.0" );
122         serializer.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
123         serializer.startTag( NAMESPACE, tagName );
124         serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd" );
125         if ( assembly.getId() != null )
126         {
127             serializer.startTag( NAMESPACE, "id" ).text( assembly.getId() ).endTag( NAMESPACE, "id" );
128         }
129         if ( ( assembly.getFormats() != null ) && ( assembly.getFormats().size() > 0 ) )
130         {
131             serializer.startTag( NAMESPACE, "formats" );
132             for ( Iterator iter = assembly.getFormats().iterator(); iter.hasNext(); )
133             {
134                 String format = (String) iter.next();
135                 serializer.startTag( NAMESPACE, "format" ).text( format ).endTag( NAMESPACE, "format" );
136             }
137             serializer.endTag( NAMESPACE, "formats" );
138         }
139         if ( assembly.isIncludeBaseDirectory() != true )
140         {
141             serializer.startTag( NAMESPACE, "includeBaseDirectory" ).text( String.valueOf( assembly.isIncludeBaseDirectory() ) ).endTag( NAMESPACE, "includeBaseDirectory" );
142         }
143         if ( assembly.getBaseDirectory() != null )
144         {
145             serializer.startTag( NAMESPACE, "baseDirectory" ).text( assembly.getBaseDirectory() ).endTag( NAMESPACE, "baseDirectory" );
146         }
147         if ( assembly.isIncludeSiteDirectory() != false )
148         {
149             serializer.startTag( NAMESPACE, "includeSiteDirectory" ).text( String.valueOf( assembly.isIncludeSiteDirectory() ) ).endTag( NAMESPACE, "includeSiteDirectory" );
150         }
151         if ( ( assembly.getContainerDescriptorHandlers() != null ) && ( assembly.getContainerDescriptorHandlers().size() > 0 ) )
152         {
153             serializer.startTag( NAMESPACE, "containerDescriptorHandlers" );
154             for ( Iterator iter = assembly.getContainerDescriptorHandlers().iterator(); iter.hasNext(); )
155             {
156                 ContainerDescriptorHandlerConfig../org/apache/maven/plugins/assembly/model/ContainerDescriptorHandlerConfig.html#ContainerDescriptorHandlerConfig">ContainerDescriptorHandlerConfig o = (ContainerDescriptorHandlerConfig) iter.next();
157                 writeContainerDescriptorHandlerConfig( o, "containerDescriptorHandler", serializer );
158             }
159             serializer.endTag( NAMESPACE, "containerDescriptorHandlers" );
160         }
161         if ( ( assembly.getModuleSets() != null ) && ( assembly.getModuleSets().size() > 0 ) )
162         {
163             serializer.startTag( NAMESPACE, "moduleSets" );
164             for ( Iterator iter = assembly.getModuleSets().iterator(); iter.hasNext(); )
165             {
166                 ModuleSet="../../../../../../../../org/apache/maven/plugins/assembly/model/ModuleSet.html#ModuleSet">ModuleSet o = (ModuleSet) iter.next();
167                 writeModuleSet( o, "moduleSet", serializer );
168             }
169             serializer.endTag( NAMESPACE, "moduleSets" );
170         }
171         if ( ( assembly.getFileSets() != null ) && ( assembly.getFileSets().size() > 0 ) )
172         {
173             serializer.startTag( NAMESPACE, "fileSets" );
174             for ( Iterator iter = assembly.getFileSets().iterator(); iter.hasNext(); )
175             {
176                 FileSetef="../../../../../../../../org/apache/maven/plugins/assembly/model/FileSet.html#FileSet">FileSet o = (FileSet) iter.next();
177                 writeFileSet( o, "fileSet", serializer );
178             }
179             serializer.endTag( NAMESPACE, "fileSets" );
180         }
181         if ( ( assembly.getFiles() != null ) && ( assembly.getFiles().size() > 0 ) )
182         {
183             serializer.startTag( NAMESPACE, "files" );
184             for ( Iterator iter = assembly.getFiles().iterator(); iter.hasNext(); )
185             {
186                 FileItemf="../../../../../../../../org/apache/maven/plugins/assembly/model/FileItem.html#FileItem">FileItem o = (FileItem) iter.next();
187                 writeFileItem( o, "file", serializer );
188             }
189             serializer.endTag( NAMESPACE, "files" );
190         }
191         if ( ( assembly.getDependencySets() != null ) && ( assembly.getDependencySets().size() > 0 ) )
192         {
193             serializer.startTag( NAMESPACE, "dependencySets" );
194             for ( Iterator iter = assembly.getDependencySets().iterator(); iter.hasNext(); )
195             {
196                 DependencySet/../../../../../../../org/apache/maven/plugins/assembly/model/DependencySet.html#DependencySet">DependencySet o = (DependencySet) iter.next();
197                 writeDependencySet( o, "dependencySet", serializer );
198             }
199             serializer.endTag( NAMESPACE, "dependencySets" );
200         }
201         if ( ( assembly.getRepositories() != null ) && ( assembly.getRepositories().size() > 0 ) )
202         {
203             serializer.startTag( NAMESPACE, "repositories" );
204             for ( Iterator iter = assembly.getRepositories().iterator(); iter.hasNext(); )
205             {
206                 Repository"../../../../../../../../org/apache/maven/plugins/assembly/model/Repository.html#Repository">Repository o = (Repository) iter.next();
207                 writeRepository( o, "repository", serializer );
208             }
209             serializer.endTag( NAMESPACE, "repositories" );
210         }
211         if ( ( assembly.getComponentDescriptors() != null ) && ( assembly.getComponentDescriptors().size() > 0 ) )
212         {
213             serializer.startTag( NAMESPACE, "componentDescriptors" );
214             for ( Iterator iter = assembly.getComponentDescriptors().iterator(); iter.hasNext(); )
215             {
216                 String componentDescriptor = (String) iter.next();
217                 serializer.startTag( NAMESPACE, "componentDescriptor" ).text( componentDescriptor ).endTag( NAMESPACE, "componentDescriptor" );
218             }
219             serializer.endTag( NAMESPACE, "componentDescriptors" );
220         }
221         serializer.endTag( NAMESPACE, tagName );
222     } //-- void writeAssembly( Assembly, String, XmlSerializer )
223 
224     /**
225      * Method writeContainerDescriptorHandlerConfig.
226      * 
227      * @param containerDescriptorHandlerConfig
228      * @param serializer
229      * @param tagName
230      * @throws java.io.IOException
231      */
232     private void writeContainerDescriptorHandlerConfig( ContainerDescriptorHandlerConfig containerDescriptorHandlerConfig, String tagName, XmlSerializer serializer )
233         throws java.io.IOException
234     {
235         serializer.startTag( NAMESPACE, tagName );
236         if ( containerDescriptorHandlerConfig.getHandlerName() != null )
237         {
238             serializer.startTag( NAMESPACE, "handlerName" ).text( containerDescriptorHandlerConfig.getHandlerName() ).endTag( NAMESPACE, "handlerName" );
239         }
240         if ( containerDescriptorHandlerConfig.getConfiguration() != null )
241         {
242             ((Xpp3Dom) containerDescriptorHandlerConfig.getConfiguration()).writeToSerializer( NAMESPACE, serializer );
243         }
244         serializer.endTag( NAMESPACE, tagName );
245     } //-- void writeContainerDescriptorHandlerConfig( ContainerDescriptorHandlerConfig, String, XmlSerializer )
246 
247     /**
248      * Method writeDependencySet.
249      * 
250      * @param dependencySet
251      * @param serializer
252      * @param tagName
253      * @throws java.io.IOException
254      */
255     private void writeDependencySet( DependencySet dependencySet, String tagName, XmlSerializer serializer )
256         throws java.io.IOException
257     {
258         serializer.startTag( NAMESPACE, tagName );
259         if ( dependencySet.getOutputDirectory() != null )
260         {
261             serializer.startTag( NAMESPACE, "outputDirectory" ).text( dependencySet.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" );
262         }
263         if ( ( dependencySet.getIncludes() != null ) && ( dependencySet.getIncludes().size() > 0 ) )
264         {
265             serializer.startTag( NAMESPACE, "includes" );
266             for ( Iterator iter = dependencySet.getIncludes().iterator(); iter.hasNext(); )
267             {
268                 String include = (String) iter.next();
269                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
270             }
271             serializer.endTag( NAMESPACE, "includes" );
272         }
273         if ( ( dependencySet.getExcludes() != null ) && ( dependencySet.getExcludes().size() > 0 ) )
274         {
275             serializer.startTag( NAMESPACE, "excludes" );
276             for ( Iterator iter = dependencySet.getExcludes().iterator(); iter.hasNext(); )
277             {
278                 String exclude = (String) iter.next();
279                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
280             }
281             serializer.endTag( NAMESPACE, "excludes" );
282         }
283         if ( dependencySet.getFileMode() != null )
284         {
285             serializer.startTag( NAMESPACE, "fileMode" ).text( dependencySet.getFileMode() ).endTag( NAMESPACE, "fileMode" );
286         }
287         if ( dependencySet.getDirectoryMode() != null )
288         {
289             serializer.startTag( NAMESPACE, "directoryMode" ).text( dependencySet.getDirectoryMode() ).endTag( NAMESPACE, "directoryMode" );
290         }
291         if ( dependencySet.isUseStrictFiltering() != false )
292         {
293             serializer.startTag( NAMESPACE, "useStrictFiltering" ).text( String.valueOf( dependencySet.isUseStrictFiltering() ) ).endTag( NAMESPACE, "useStrictFiltering" );
294         }
295         if ( ( dependencySet.getOutputFileNameMapping() != null ) && !dependencySet.getOutputFileNameMapping().equals( "${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}" ) )
296         {
297             serializer.startTag( NAMESPACE, "outputFileNameMapping" ).text( dependencySet.getOutputFileNameMapping() ).endTag( NAMESPACE, "outputFileNameMapping" );
298         }
299         if ( dependencySet.isUnpack() != false )
300         {
301             serializer.startTag( NAMESPACE, "unpack" ).text( String.valueOf( dependencySet.isUnpack() ) ).endTag( NAMESPACE, "unpack" );
302         }
303         if ( dependencySet.getUnpackOptions() != null )
304         {
305             writeUnpackOptions( (UnpackOptions) dependencySet.getUnpackOptions(), "unpackOptions", serializer );
306         }
307         if ( ( dependencySet.getScope() != null ) && !dependencySet.getScope().equals( "runtime" ) )
308         {
309             serializer.startTag( NAMESPACE, "scope" ).text( dependencySet.getScope() ).endTag( NAMESPACE, "scope" );
310         }
311         if ( dependencySet.isUseProjectArtifact() != true )
312         {
313             serializer.startTag( NAMESPACE, "useProjectArtifact" ).text( String.valueOf( dependencySet.isUseProjectArtifact() ) ).endTag( NAMESPACE, "useProjectArtifact" );
314         }
315         if ( dependencySet.isUseProjectAttachments() != false )
316         {
317             serializer.startTag( NAMESPACE, "useProjectAttachments" ).text( String.valueOf( dependencySet.isUseProjectAttachments() ) ).endTag( NAMESPACE, "useProjectAttachments" );
318         }
319         if ( dependencySet.isUseTransitiveDependencies() != true )
320         {
321             serializer.startTag( NAMESPACE, "useTransitiveDependencies" ).text( String.valueOf( dependencySet.isUseTransitiveDependencies() ) ).endTag( NAMESPACE, "useTransitiveDependencies" );
322         }
323         if ( dependencySet.isUseTransitiveFiltering() != false )
324         {
325             serializer.startTag( NAMESPACE, "useTransitiveFiltering" ).text( String.valueOf( dependencySet.isUseTransitiveFiltering() ) ).endTag( NAMESPACE, "useTransitiveFiltering" );
326         }
327         serializer.endTag( NAMESPACE, tagName );
328     } //-- void writeDependencySet( DependencySet, String, XmlSerializer )
329 
330     /**
331      * Method writeFileItem.
332      * 
333      * @param fileItem
334      * @param serializer
335      * @param tagName
336      * @throws java.io.IOException
337      */
338     private void writeFileItem( FileItem fileItem, String tagName, XmlSerializer serializer )
339         throws java.io.IOException
340     {
341         serializer.startTag( NAMESPACE, tagName );
342         if ( fileItem.getSource() != null )
343         {
344             serializer.startTag( NAMESPACE, "source" ).text( fileItem.getSource() ).endTag( NAMESPACE, "source" );
345         }
346         if ( ( fileItem.getSources() != null ) && ( fileItem.getSources().size() > 0 ) )
347         {
348             serializer.startTag( NAMESPACE, "sources" );
349             for ( Iterator iter = fileItem.getSources().iterator(); iter.hasNext(); )
350             {
351                 String source = (String) iter.next();
352                 serializer.startTag( NAMESPACE, "source" ).text( source ).endTag( NAMESPACE, "source" );
353             }
354             serializer.endTag( NAMESPACE, "sources" );
355         }
356         if ( fileItem.getOutputDirectory() != null )
357         {
358             serializer.startTag( NAMESPACE, "outputDirectory" ).text( fileItem.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" );
359         }
360         if ( fileItem.getDestName() != null )
361         {
362             serializer.startTag( NAMESPACE, "destName" ).text( fileItem.getDestName() ).endTag( NAMESPACE, "destName" );
363         }
364         if ( fileItem.getFileMode() != null )
365         {
366             serializer.startTag( NAMESPACE, "fileMode" ).text( fileItem.getFileMode() ).endTag( NAMESPACE, "fileMode" );
367         }
368         if ( fileItem.getLineEnding() != null )
369         {
370             serializer.startTag( NAMESPACE, "lineEnding" ).text( fileItem.getLineEnding() ).endTag( NAMESPACE, "lineEnding" );
371         }
372         if ( fileItem.isFiltered() != false )
373         {
374             serializer.startTag( NAMESPACE, "filtered" ).text( String.valueOf( fileItem.isFiltered() ) ).endTag( NAMESPACE, "filtered" );
375         }
376         serializer.endTag( NAMESPACE, tagName );
377     } //-- void writeFileItem( FileItem, String, XmlSerializer )
378 
379     /**
380      * Method writeFileSet.
381      * 
382      * @param fileSet
383      * @param serializer
384      * @param tagName
385      * @throws java.io.IOException
386      */
387     private void writeFileSet( FileSet fileSet, String tagName, XmlSerializer serializer )
388         throws java.io.IOException
389     {
390         serializer.startTag( NAMESPACE, tagName );
391         if ( fileSet.isUseDefaultExcludes() != true )
392         {
393             serializer.startTag( NAMESPACE, "useDefaultExcludes" ).text( String.valueOf( fileSet.isUseDefaultExcludes() ) ).endTag( NAMESPACE, "useDefaultExcludes" );
394         }
395         if ( fileSet.getOutputDirectory() != null )
396         {
397             serializer.startTag( NAMESPACE, "outputDirectory" ).text( fileSet.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" );
398         }
399         if ( ( fileSet.getIncludes() != null ) && ( fileSet.getIncludes().size() > 0 ) )
400         {
401             serializer.startTag( NAMESPACE, "includes" );
402             for ( Iterator iter = fileSet.getIncludes().iterator(); iter.hasNext(); )
403             {
404                 String include = (String) iter.next();
405                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
406             }
407             serializer.endTag( NAMESPACE, "includes" );
408         }
409         if ( ( fileSet.getExcludes() != null ) && ( fileSet.getExcludes().size() > 0 ) )
410         {
411             serializer.startTag( NAMESPACE, "excludes" );
412             for ( Iterator iter = fileSet.getExcludes().iterator(); iter.hasNext(); )
413             {
414                 String exclude = (String) iter.next();
415                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
416             }
417             serializer.endTag( NAMESPACE, "excludes" );
418         }
419         if ( fileSet.getFileMode() != null )
420         {
421             serializer.startTag( NAMESPACE, "fileMode" ).text( fileSet.getFileMode() ).endTag( NAMESPACE, "fileMode" );
422         }
423         if ( fileSet.getDirectoryMode() != null )
424         {
425             serializer.startTag( NAMESPACE, "directoryMode" ).text( fileSet.getDirectoryMode() ).endTag( NAMESPACE, "directoryMode" );
426         }
427         if ( fileSet.getDirectory() != null )
428         {
429             serializer.startTag( NAMESPACE, "directory" ).text( fileSet.getDirectory() ).endTag( NAMESPACE, "directory" );
430         }
431         if ( fileSet.getLineEnding() != null )
432         {
433             serializer.startTag( NAMESPACE, "lineEnding" ).text( fileSet.getLineEnding() ).endTag( NAMESPACE, "lineEnding" );
434         }
435         if ( fileSet.isFiltered() != false )
436         {
437             serializer.startTag( NAMESPACE, "filtered" ).text( String.valueOf( fileSet.isFiltered() ) ).endTag( NAMESPACE, "filtered" );
438         }
439         if ( ( fileSet.getNonFilteredFileExtensions() != null ) && ( fileSet.getNonFilteredFileExtensions().size() > 0 ) )
440         {
441             serializer.startTag( NAMESPACE, "nonFilteredFileExtensions" );
442             for ( Iterator iter = fileSet.getNonFilteredFileExtensions().iterator(); iter.hasNext(); )
443             {
444                 String nonFilteredFileExtension = (String) iter.next();
445                 serializer.startTag( NAMESPACE, "nonFilteredFileExtension" ).text( nonFilteredFileExtension ).endTag( NAMESPACE, "nonFilteredFileExtension" );
446             }
447             serializer.endTag( NAMESPACE, "nonFilteredFileExtensions" );
448         }
449         serializer.endTag( NAMESPACE, tagName );
450     } //-- void writeFileSet( FileSet, String, XmlSerializer )
451 
452     /**
453      * Method writeGroupVersionAlignment.
454      * 
455      * @param groupVersionAlignment
456      * @param serializer
457      * @param tagName
458      * @throws java.io.IOException
459      */
460     private void writeGroupVersionAlignment( GroupVersionAlignment groupVersionAlignment, String tagName, XmlSerializer serializer )
461         throws java.io.IOException
462     {
463         serializer.startTag( NAMESPACE, tagName );
464         if ( groupVersionAlignment.getId() != null )
465         {
466             serializer.startTag( NAMESPACE, "id" ).text( groupVersionAlignment.getId() ).endTag( NAMESPACE, "id" );
467         }
468         if ( groupVersionAlignment.getVersion() != null )
469         {
470             serializer.startTag( NAMESPACE, "version" ).text( groupVersionAlignment.getVersion() ).endTag( NAMESPACE, "version" );
471         }
472         if ( ( groupVersionAlignment.getExcludes() != null ) && ( groupVersionAlignment.getExcludes().size() > 0 ) )
473         {
474             serializer.startTag( NAMESPACE, "excludes" );
475             for ( Iterator iter = groupVersionAlignment.getExcludes().iterator(); iter.hasNext(); )
476             {
477                 String exclude = (String) iter.next();
478                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
479             }
480             serializer.endTag( NAMESPACE, "excludes" );
481         }
482         serializer.endTag( NAMESPACE, tagName );
483     } //-- void writeGroupVersionAlignment( GroupVersionAlignment, String, XmlSerializer )
484 
485     /**
486      * Method writeModuleBinaries.
487      * 
488      * @param moduleBinaries
489      * @param serializer
490      * @param tagName
491      * @throws java.io.IOException
492      */
493     private void writeModuleBinaries( ModuleBinaries moduleBinaries, String tagName, XmlSerializer serializer )
494         throws java.io.IOException
495     {
496         serializer.startTag( NAMESPACE, tagName );
497         if ( moduleBinaries.getOutputDirectory() != null )
498         {
499             serializer.startTag( NAMESPACE, "outputDirectory" ).text( moduleBinaries.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" );
500         }
501         if ( ( moduleBinaries.getIncludes() != null ) && ( moduleBinaries.getIncludes().size() > 0 ) )
502         {
503             serializer.startTag( NAMESPACE, "includes" );
504             for ( Iterator iter = moduleBinaries.getIncludes().iterator(); iter.hasNext(); )
505             {
506                 String include = (String) iter.next();
507                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
508             }
509             serializer.endTag( NAMESPACE, "includes" );
510         }
511         if ( ( moduleBinaries.getExcludes() != null ) && ( moduleBinaries.getExcludes().size() > 0 ) )
512         {
513             serializer.startTag( NAMESPACE, "excludes" );
514             for ( Iterator iter = moduleBinaries.getExcludes().iterator(); iter.hasNext(); )
515             {
516                 String exclude = (String) iter.next();
517                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
518             }
519             serializer.endTag( NAMESPACE, "excludes" );
520         }
521         if ( moduleBinaries.getFileMode() != null )
522         {
523             serializer.startTag( NAMESPACE, "fileMode" ).text( moduleBinaries.getFileMode() ).endTag( NAMESPACE, "fileMode" );
524         }
525         if ( moduleBinaries.getDirectoryMode() != null )
526         {
527             serializer.startTag( NAMESPACE, "directoryMode" ).text( moduleBinaries.getDirectoryMode() ).endTag( NAMESPACE, "directoryMode" );
528         }
529         if ( moduleBinaries.getAttachmentClassifier() != null )
530         {
531             serializer.startTag( NAMESPACE, "attachmentClassifier" ).text( moduleBinaries.getAttachmentClassifier() ).endTag( NAMESPACE, "attachmentClassifier" );
532         }
533         if ( moduleBinaries.isIncludeDependencies() != true )
534         {
535             serializer.startTag( NAMESPACE, "includeDependencies" ).text( String.valueOf( moduleBinaries.isIncludeDependencies() ) ).endTag( NAMESPACE, "includeDependencies" );
536         }
537         if ( ( moduleBinaries.getDependencySets() != null ) && ( moduleBinaries.getDependencySets().size() > 0 ) )
538         {
539             serializer.startTag( NAMESPACE, "dependencySets" );
540             for ( Iterator iter = moduleBinaries.getDependencySets().iterator(); iter.hasNext(); )
541             {
542                 DependencySet/../../../../../../../org/apache/maven/plugins/assembly/model/DependencySet.html#DependencySet">DependencySet o = (DependencySet) iter.next();
543                 writeDependencySet( o, "dependencySet", serializer );
544             }
545             serializer.endTag( NAMESPACE, "dependencySets" );
546         }
547         if ( moduleBinaries.isUnpack() != true )
548         {
549             serializer.startTag( NAMESPACE, "unpack" ).text( String.valueOf( moduleBinaries.isUnpack() ) ).endTag( NAMESPACE, "unpack" );
550         }
551         if ( moduleBinaries.getUnpackOptions() != null )
552         {
553             writeUnpackOptions( (UnpackOptions) moduleBinaries.getUnpackOptions(), "unpackOptions", serializer );
554         }
555         if ( ( moduleBinaries.getOutputFileNameMapping() != null ) && !moduleBinaries.getOutputFileNameMapping().equals( "${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}" ) )
556         {
557             serializer.startTag( NAMESPACE, "outputFileNameMapping" ).text( moduleBinaries.getOutputFileNameMapping() ).endTag( NAMESPACE, "outputFileNameMapping" );
558         }
559         serializer.endTag( NAMESPACE, tagName );
560     } //-- void writeModuleBinaries( ModuleBinaries, String, XmlSerializer )
561 
562     /**
563      * Method writeModuleSet.
564      * 
565      * @param moduleSet
566      * @param serializer
567      * @param tagName
568      * @throws java.io.IOException
569      */
570     private void writeModuleSet( ModuleSet moduleSet, String tagName, XmlSerializer serializer )
571         throws java.io.IOException
572     {
573         serializer.startTag( NAMESPACE, tagName );
574         if ( moduleSet.isUseAllReactorProjects() != false )
575         {
576             serializer.startTag( NAMESPACE, "useAllReactorProjects" ).text( String.valueOf( moduleSet.isUseAllReactorProjects() ) ).endTag( NAMESPACE, "useAllReactorProjects" );
577         }
578         if ( moduleSet.isIncludeSubModules() != true )
579         {
580             serializer.startTag( NAMESPACE, "includeSubModules" ).text( String.valueOf( moduleSet.isIncludeSubModules() ) ).endTag( NAMESPACE, "includeSubModules" );
581         }
582         if ( ( moduleSet.getIncludes() != null ) && ( moduleSet.getIncludes().size() > 0 ) )
583         {
584             serializer.startTag( NAMESPACE, "includes" );
585             for ( Iterator iter = moduleSet.getIncludes().iterator(); iter.hasNext(); )
586             {
587                 String include = (String) iter.next();
588                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
589             }
590             serializer.endTag( NAMESPACE, "includes" );
591         }
592         if ( ( moduleSet.getExcludes() != null ) && ( moduleSet.getExcludes().size() > 0 ) )
593         {
594             serializer.startTag( NAMESPACE, "excludes" );
595             for ( Iterator iter = moduleSet.getExcludes().iterator(); iter.hasNext(); )
596             {
597                 String exclude = (String) iter.next();
598                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
599             }
600             serializer.endTag( NAMESPACE, "excludes" );
601         }
602         if ( moduleSet.getSources() != null )
603         {
604             writeModuleSources( (ModuleSources) moduleSet.getSources(), "sources", serializer );
605         }
606         if ( moduleSet.getBinaries() != null )
607         {
608             writeModuleBinaries( (ModuleBinaries) moduleSet.getBinaries(), "binaries", serializer );
609         }
610         serializer.endTag( NAMESPACE, tagName );
611     } //-- void writeModuleSet( ModuleSet, String, XmlSerializer )
612 
613     /**
614      * Method writeModuleSources.
615      * 
616      * @param moduleSources
617      * @param serializer
618      * @param tagName
619      * @throws java.io.IOException
620      */
621     private void writeModuleSources( ModuleSources moduleSources, String tagName, XmlSerializer serializer )
622         throws java.io.IOException
623     {
624         serializer.startTag( NAMESPACE, tagName );
625         if ( moduleSources.isUseDefaultExcludes() != true )
626         {
627             serializer.startTag( NAMESPACE, "useDefaultExcludes" ).text( String.valueOf( moduleSources.isUseDefaultExcludes() ) ).endTag( NAMESPACE, "useDefaultExcludes" );
628         }
629         if ( moduleSources.getOutputDirectory() != null )
630         {
631             serializer.startTag( NAMESPACE, "outputDirectory" ).text( moduleSources.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" );
632         }
633         if ( ( moduleSources.getIncludes() != null ) && ( moduleSources.getIncludes().size() > 0 ) )
634         {
635             serializer.startTag( NAMESPACE, "includes" );
636             for ( Iterator iter = moduleSources.getIncludes().iterator(); iter.hasNext(); )
637             {
638                 String include = (String) iter.next();
639                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
640             }
641             serializer.endTag( NAMESPACE, "includes" );
642         }
643         if ( ( moduleSources.getExcludes() != null ) && ( moduleSources.getExcludes().size() > 0 ) )
644         {
645             serializer.startTag( NAMESPACE, "excludes" );
646             for ( Iterator iter = moduleSources.getExcludes().iterator(); iter.hasNext(); )
647             {
648                 String exclude = (String) iter.next();
649                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
650             }
651             serializer.endTag( NAMESPACE, "excludes" );
652         }
653         if ( moduleSources.getFileMode() != null )
654         {
655             serializer.startTag( NAMESPACE, "fileMode" ).text( moduleSources.getFileMode() ).endTag( NAMESPACE, "fileMode" );
656         }
657         if ( moduleSources.getDirectoryMode() != null )
658         {
659             serializer.startTag( NAMESPACE, "directoryMode" ).text( moduleSources.getDirectoryMode() ).endTag( NAMESPACE, "directoryMode" );
660         }
661         if ( ( moduleSources.getFileSets() != null ) && ( moduleSources.getFileSets().size() > 0 ) )
662         {
663             serializer.startTag( NAMESPACE, "fileSets" );
664             for ( Iterator iter = moduleSources.getFileSets().iterator(); iter.hasNext(); )
665             {
666                 FileSetef="../../../../../../../../org/apache/maven/plugins/assembly/model/FileSet.html#FileSet">FileSet o = (FileSet) iter.next();
667                 writeFileSet( o, "fileSet", serializer );
668             }
669             serializer.endTag( NAMESPACE, "fileSets" );
670         }
671         if ( moduleSources.isIncludeModuleDirectory() != true )
672         {
673             serializer.startTag( NAMESPACE, "includeModuleDirectory" ).text( String.valueOf( moduleSources.isIncludeModuleDirectory() ) ).endTag( NAMESPACE, "includeModuleDirectory" );
674         }
675         if ( moduleSources.isExcludeSubModuleDirectories() != true )
676         {
677             serializer.startTag( NAMESPACE, "excludeSubModuleDirectories" ).text( String.valueOf( moduleSources.isExcludeSubModuleDirectories() ) ).endTag( NAMESPACE, "excludeSubModuleDirectories" );
678         }
679         if ( ( moduleSources.getOutputDirectoryMapping() != null ) && !moduleSources.getOutputDirectoryMapping().equals( "${module.artifactId}" ) )
680         {
681             serializer.startTag( NAMESPACE, "outputDirectoryMapping" ).text( moduleSources.getOutputDirectoryMapping() ).endTag( NAMESPACE, "outputDirectoryMapping" );
682         }
683         serializer.endTag( NAMESPACE, tagName );
684     } //-- void writeModuleSources( ModuleSources, String, XmlSerializer )
685 
686     /**
687      * Method writeRepository.
688      * 
689      * @param repository
690      * @param serializer
691      * @param tagName
692      * @throws java.io.IOException
693      */
694     private void writeRepository( Repository repository, String tagName, XmlSerializer serializer )
695         throws java.io.IOException
696     {
697         serializer.startTag( NAMESPACE, tagName );
698         if ( repository.getOutputDirectory() != null )
699         {
700             serializer.startTag( NAMESPACE, "outputDirectory" ).text( repository.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" );
701         }
702         if ( ( repository.getIncludes() != null ) && ( repository.getIncludes().size() > 0 ) )
703         {
704             serializer.startTag( NAMESPACE, "includes" );
705             for ( Iterator iter = repository.getIncludes().iterator(); iter.hasNext(); )
706             {
707                 String include = (String) iter.next();
708                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
709             }
710             serializer.endTag( NAMESPACE, "includes" );
711         }
712         if ( ( repository.getExcludes() != null ) && ( repository.getExcludes().size() > 0 ) )
713         {
714             serializer.startTag( NAMESPACE, "excludes" );
715             for ( Iterator iter = repository.getExcludes().iterator(); iter.hasNext(); )
716             {
717                 String exclude = (String) iter.next();
718                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
719             }
720             serializer.endTag( NAMESPACE, "excludes" );
721         }
722         if ( repository.getFileMode() != null )
723         {
724             serializer.startTag( NAMESPACE, "fileMode" ).text( repository.getFileMode() ).endTag( NAMESPACE, "fileMode" );
725         }
726         if ( repository.getDirectoryMode() != null )
727         {
728             serializer.startTag( NAMESPACE, "directoryMode" ).text( repository.getDirectoryMode() ).endTag( NAMESPACE, "directoryMode" );
729         }
730         if ( repository.isIncludeMetadata() != false )
731         {
732             serializer.startTag( NAMESPACE, "includeMetadata" ).text( String.valueOf( repository.isIncludeMetadata() ) ).endTag( NAMESPACE, "includeMetadata" );
733         }
734         if ( ( repository.getGroupVersionAlignments() != null ) && ( repository.getGroupVersionAlignments().size() > 0 ) )
735         {
736             serializer.startTag( NAMESPACE, "groupVersionAlignments" );
737             for ( Iterator iter = repository.getGroupVersionAlignments().iterator(); iter.hasNext(); )
738             {
739                 GroupVersionAlignment./../../../../org/apache/maven/plugins/assembly/model/GroupVersionAlignment.html#GroupVersionAlignment">GroupVersionAlignment o = (GroupVersionAlignment) iter.next();
740                 writeGroupVersionAlignment( o, "groupVersionAlignment", serializer );
741             }
742             serializer.endTag( NAMESPACE, "groupVersionAlignments" );
743         }
744         if ( ( repository.getScope() != null ) && !repository.getScope().equals( "runtime" ) )
745         {
746             serializer.startTag( NAMESPACE, "scope" ).text( repository.getScope() ).endTag( NAMESPACE, "scope" );
747         }
748         serializer.endTag( NAMESPACE, tagName );
749     } //-- void writeRepository( Repository, String, XmlSerializer )
750 
751     /**
752      * Method writeUnpackOptions.
753      * 
754      * @param unpackOptions
755      * @param serializer
756      * @param tagName
757      * @throws java.io.IOException
758      */
759     private void writeUnpackOptions( UnpackOptions unpackOptions, String tagName, XmlSerializer serializer )
760         throws java.io.IOException
761     {
762         serializer.startTag( NAMESPACE, tagName );
763         if ( ( unpackOptions.getIncludes() != null ) && ( unpackOptions.getIncludes().size() > 0 ) )
764         {
765             serializer.startTag( NAMESPACE, "includes" );
766             for ( Iterator iter = unpackOptions.getIncludes().iterator(); iter.hasNext(); )
767             {
768                 String include = (String) iter.next();
769                 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
770             }
771             serializer.endTag( NAMESPACE, "includes" );
772         }
773         if ( ( unpackOptions.getExcludes() != null ) && ( unpackOptions.getExcludes().size() > 0 ) )
774         {
775             serializer.startTag( NAMESPACE, "excludes" );
776             for ( Iterator iter = unpackOptions.getExcludes().iterator(); iter.hasNext(); )
777             {
778                 String exclude = (String) iter.next();
779                 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
780             }
781             serializer.endTag( NAMESPACE, "excludes" );
782         }
783         if ( unpackOptions.isFiltered() != false )
784         {
785             serializer.startTag( NAMESPACE, "filtered" ).text( String.valueOf( unpackOptions.isFiltered() ) ).endTag( NAMESPACE, "filtered" );
786         }
787         if ( ( unpackOptions.getNonFilteredFileExtensions() != null ) && ( unpackOptions.getNonFilteredFileExtensions().size() > 0 ) )
788         {
789             serializer.startTag( NAMESPACE, "nonFilteredFileExtensions" );
790             for ( Iterator iter = unpackOptions.getNonFilteredFileExtensions().iterator(); iter.hasNext(); )
791             {
792                 String nonFilteredFileExtension = (String) iter.next();
793                 serializer.startTag( NAMESPACE, "nonFilteredFileExtension" ).text( nonFilteredFileExtension ).endTag( NAMESPACE, "nonFilteredFileExtension" );
794             }
795             serializer.endTag( NAMESPACE, "nonFilteredFileExtensions" );
796         }
797         if ( unpackOptions.getLineEnding() != null )
798         {
799             serializer.startTag( NAMESPACE, "lineEnding" ).text( unpackOptions.getLineEnding() ).endTag( NAMESPACE, "lineEnding" );
800         }
801         if ( unpackOptions.isUseDefaultExcludes() != true )
802         {
803             serializer.startTag( NAMESPACE, "useDefaultExcludes" ).text( String.valueOf( unpackOptions.isUseDefaultExcludes() ) ).endTag( NAMESPACE, "useDefaultExcludes" );
804         }
805         if ( unpackOptions.getEncoding() != null )
806         {
807             serializer.startTag( NAMESPACE, "encoding" ).text( unpackOptions.getEncoding() ).endTag( NAMESPACE, "encoding" );
808         }
809         serializer.endTag( NAMESPACE, tagName );
810     } //-- void writeUnpackOptions( UnpackOptions, String, XmlSerializer )
811 
812 }