001/*
002 =================== DO NOT EDIT THIS FILE ====================
003 Generated by Modello 1.1 on 2014-01-07 00:11:24,
004 any modifications will be overwritten.
005 ==============================================================
006 */
007
008package org.apache.maven.scm.providers.svn.settings.io.xpp3;
009
010  //---------------------------------/
011 //- Imported classes and packages -/
012//---------------------------------/
013
014import java.io.Writer;
015import java.text.DateFormat;
016import java.util.Iterator;
017import java.util.Locale;
018import org.apache.maven.scm.providers.svn.settings.Settings;
019import org.codehaus.plexus.util.xml.pull.MXSerializer;
020import org.codehaus.plexus.util.xml.pull.XmlSerializer;
021
022/**
023 * Class SvnXpp3Writer.
024 * 
025 * @version $Revision$ $Date$
026 */
027@SuppressWarnings( "all" )
028public class SvnXpp3Writer
029{
030
031      //--------------------------/
032     //- Class/Member Variables -/
033    //--------------------------/
034
035    /**
036     * Field NAMESPACE.
037     */
038    private static final String NAMESPACE = null;
039
040
041      //-----------/
042     //- Methods -/
043    //-----------/
044
045    /**
046     * Method write.
047     * 
048     * @param writer
049     * @param settings
050     * @throws java.io.IOException
051     */
052    public void write( Writer writer, Settings settings )
053        throws java.io.IOException
054    {
055        XmlSerializer serializer = new MXSerializer();
056        serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
057        serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
058        serializer.setOutput( writer );
059        serializer.startDocument( settings.getModelEncoding(), null );
060        writeSettings( settings, "svn-settings", serializer );
061        serializer.endDocument();
062    } //-- void write( Writer, Settings )
063
064    /**
065     * Method writeSettings.
066     * 
067     * @param settings
068     * @param serializer
069     * @param tagName
070     * @throws java.io.IOException
071     */
072    private void writeSettings( Settings settings, String tagName, XmlSerializer serializer )
073        throws java.io.IOException
074    {
075        if ( settings != null )
076        {
077            serializer.setPrefix( "", "http://maven.apache.org/SCM/SVN/1.1.0" );
078            serializer.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
079            serializer.startTag( NAMESPACE, tagName );
080            serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/SCM/SVN/1.1.0 http://maven.apache.org/xsd/svn-settings-1.1.0.xsd" );
081            if ( settings.getConfigDirectory() != null )
082            {
083                serializer.startTag( NAMESPACE, "configDirectory" ).text( settings.getConfigDirectory() ).endTag( NAMESPACE, "configDirectory" );
084            }
085            if ( settings.isUseCygwinPath() != false )
086            {
087                serializer.startTag( NAMESPACE, "useCygwinPath" ).text( String.valueOf( settings.isUseCygwinPath() ) ).endTag( NAMESPACE, "useCygwinPath" );
088            }
089            if ( ( settings.getCygwinMountPath() != null ) && !settings.getCygwinMountPath().equals( "/cygwin" ) )
090            {
091                serializer.startTag( NAMESPACE, "cygwinMountPath" ).text( settings.getCygwinMountPath() ).endTag( NAMESPACE, "cygwinMountPath" );
092            }
093            if ( settings.isUseNonInteractive() != true )
094            {
095                serializer.startTag( NAMESPACE, "useNonInteractive" ).text( String.valueOf( settings.isUseNonInteractive() ) ).endTag( NAMESPACE, "useNonInteractive" );
096            }
097            if ( settings.isUseAuthCache() != false )
098            {
099                serializer.startTag( NAMESPACE, "useAuthCache" ).text( String.valueOf( settings.isUseAuthCache() ) ).endTag( NAMESPACE, "useAuthCache" );
100            }
101            if ( settings.isTrustServerCert() != false )
102            {
103                serializer.startTag( NAMESPACE, "trustServerCert" ).text( String.valueOf( settings.isTrustServerCert() ) ).endTag( NAMESPACE, "trustServerCert" );
104            }
105            serializer.endTag( NAMESPACE, tagName );
106        }
107    } //-- void writeSettings( Settings, String, XmlSerializer )
108
109}