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