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.starteam.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.starteam.settings.Settings;
019import org.codehaus.plexus.util.xml.pull.MXSerializer;
020import org.codehaus.plexus.util.xml.pull.XmlSerializer;
021
022/**
023 * Class StarteamXpp3Writer.
024 * 
025 * @version $Revision$ $Date$
026 */
027@SuppressWarnings( "all" )
028public class StarteamXpp3Writer
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, "starteam-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/STARTEAM/1.0.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/STARTEAM/1.0.0 http://maven.apache.org/xsd/scm-starteam-1.0.0.xsd" );
081            if ( settings.isCompressionEnable() != false )
082            {
083                serializer.startTag( NAMESPACE, "compressionEnable" ).text( String.valueOf( settings.isCompressionEnable() ) ).endTag( NAMESPACE, "compressionEnable" );
084            }
085            if ( ( settings.getEol() != null ) && !settings.getEol().equals( "on" ) )
086            {
087                serializer.startTag( NAMESPACE, "eol" ).text( settings.getEol() ).endTag( NAMESPACE, "eol" );
088            }
089            serializer.endTag( NAMESPACE, tagName );
090        }
091    } //-- void writeSettings( Settings, String, XmlSerializer )
092
093}