View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.8.2,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.scm.providers.gitlib.settings.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.scm.providers.gitlib.settings.Settings;
16  import org.codehaus.plexus.util.xml.pull.MXSerializer;
17  import org.codehaus.plexus.util.xml.pull.XmlSerializer;
18  
19  /**
20   * Class GitXpp3Writer.
21   * 
22   * @version $Revision$ $Date$
23   */
24  @SuppressWarnings( "all" )
25  public class GitXpp3Writer
26  {
27  
28        //--------------------------/
29       //- Class/Member Variables -/
30      //--------------------------/
31  
32      /**
33       * Field NAMESPACE.
34       */
35      private static final String NAMESPACE = null;
36  
37  
38        //-----------/
39       //- Methods -/
40      //-----------/
41  
42      /**
43       * Method write.
44       * 
45       * @param writer
46       * @param settings
47       * @throws java.io.IOException
48       */
49      public void write( Writer writer, Settings settings )
50          throws java.io.IOException
51      {
52          XmlSerializer serializer = new MXSerializer();
53          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
54          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
55          serializer.setOutput( writer );
56          serializer.startDocument( settings.getModelEncoding(), null );
57          writeSettings( settings, "git-settings", serializer );
58          serializer.endDocument();
59      } //-- void write( Writer, Settings )
60  
61      /**
62       * Method write.
63       * 
64       * @param stream
65       * @param settings
66       * @throws java.io.IOException
67       */
68      public void write( OutputStream stream, Settings settings )
69          throws java.io.IOException
70      {
71          XmlSerializer serializer = new MXSerializer();
72          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
73          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
74          serializer.setOutput( stream, settings.getModelEncoding() );
75          serializer.startDocument( settings.getModelEncoding(), null );
76          writeSettings( settings, "git-settings", serializer );
77          serializer.endDocument();
78      } //-- void write( OutputStream, Settings )
79  
80      /**
81       * Method writeSettings.
82       * 
83       * @param settings
84       * @param serializer
85       * @param tagName
86       * @throws java.io.IOException
87       */
88      private void writeSettings( Settings settings, String tagName, XmlSerializer serializer )
89          throws java.io.IOException
90      {
91          serializer.setPrefix( "", "http://maven.apache.org/SCM/GIT/1.0.0" );
92          serializer.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
93          serializer.startTag( NAMESPACE, tagName );
94          serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/SCM/GIT/1.0.0 http://maven.apache.org/xsd/scm-git-1.0.0.xsd" );
95          if ( ( settings.getRevParseDateFormat() != null ) && !settings.getRevParseDateFormat().equals( "yyyy-MM-dd HH:mm:ss" ) )
96          {
97              serializer.startTag( NAMESPACE, "revParseDateFormat" ).text( settings.getRevParseDateFormat() ).endTag( NAMESPACE, "revParseDateFormat" );
98          }
99          if ( ( settings.getTraceGitCommand() != null ) && !settings.getTraceGitCommand().equals( "" ) )
100         {
101             serializer.startTag( NAMESPACE, "traceGitCommand" ).text( settings.getTraceGitCommand() ).endTag( NAMESPACE, "traceGitCommand" );
102         }
103         if ( settings.isCommitNoVerify() != false )
104         {
105             serializer.startTag( NAMESPACE, "commitNoVerify" ).text( String.valueOf( settings.isCommitNoVerify() ) ).endTag( NAMESPACE, "commitNoVerify" );
106         }
107         serializer.endTag( NAMESPACE, tagName );
108     } //-- void writeSettings( Settings, String, XmlSerializer )
109 
110 }