Hi,

I've incorporated all of the feedback re maven code style and what we should / 
shouldn't be auto-generating.  I think I've got the pretty printer generating 
code as close as possible to the maven standards.  Let me know if I've got 
anything wrong

All modified files are as patch files.  All new files are for 
jakarta-turbine-maven/src/java/org/apache/maven/sourcedef/

jrefactory.jar can be obtained from here and needs placing in lib.repo
http://prdownloads.sourceforge.net/jrefactory/jrefactory-2.6.36-binary.zip

Outstanding issues:

when methods have static and final modifiers, Jrefactory orders them in a way 
that generates a checksource error. bug has been logged with jrefactory

JRefactory places header above package line.  Am currently investigating 
possible patch / feature request for JRefactory to enable this.

Cheers
Nathan


/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache Maven" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Maven", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 * ====================================================================
 */
package org.apache.maven.sourcedef;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
import java.util.Properties;
import java.util.Hashtable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * task responsible for writing the Jrefactory configuration file. Delegates
 * responsibility for construction of the config file to a {@link
 * SourcedefDirector} configured with a {@link
 * org.apache.maven.sourcedef.JRefactoryPropertyConverter} instance.
 *
 * @created   28 May 2002
 * @author    <A HREF="mailto:[EMAIL PROTECTED]";>Nathan Coast</A>
 */
public class JRefactoryConfigTask extends Task
{
    /**
     * execute method to combine the maven.jrefactory properties with converted
     * maven.sourcedef properties and write them to the file
     * ${maven.build.dir}/.Refactory/pretty.settings
     *
     * @exception BuildException  thrown if an IOException occurs whilst writing
     *      to the config file.
     */
    public void execute() throws BuildException
    {
        Project project = getProject();
        Hashtable props = project.getProperties();
        PropertyConverter converter = new JRefactoryPropertyConverter();
        SourcedefDirector director = new SourcedefDirector(converter);
        director.readProperties(props);
        Properties config = converter.getProperties();

        String buildDirStr = (String) props.get("maven.build.dir");
        File buildDir = new File(buildDirStr);
        File prettyDir = new File(buildDir, ".Refactory");
        if (!prettyDir.exists())
        {
            if (!prettyDir.mkdir())
            {
                throw new BuildException("unable to create jrefactory " +
                        "pretty print config directory: " + prettyDir);
            }
        }
        File prettySettings = new File(prettyDir, "pretty.settings");
        if (prettySettings.exists())
        {
            prettySettings.delete();
        }

        FileOutputStream fos = null;
        try
        {
            fos = new FileOutputStream(prettySettings);
            config.store(fos, "this is a generated file do not edit");
        }
        catch (IOException e)
        {
            throw new BuildException(e);
        }
        finally
        {
            if (fos != null)
            {
                try
                {
                    fos.close();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
        }
    }
}


/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache Maven" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Maven", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 * ====================================================================
 */
package org.apache.maven.sourcedef;

import org.apache.tools.ant.BuildException;
import java.util.Properties;
import java.io.File;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;

/**
 * Implmentation of PropertyConverter responsible for combining maven.jrefactory
 * and maven.sourcedef properties to a set of jrefactory specific properties.
 *
 * @created   28 May 2002
 * @author    <A HREF="mailto:[EMAIL PROTECTED]";>Nathan Coast</A>
 */
public class JRefactoryPropertyConverter implements PropertyConverter
{

    /**
     * the properties object to contain the JRefactory configuration
     */
    private Properties properties = null;

    /**
     * Constructor for the JRefactoryPropertyConverter object
     */
    JRefactoryPropertyConverter()
    {
        properties = new Properties();
    }

    /**
     * converts the sourcedef property to the corresponding JRefactory property
     * for the location of left brace wrt blocks of code and sets it within the
     * properties.
     *
     * @param blockBraceStyle  the sourcedef property for block brace style.
     */
    public void convertBlockBraceStyle(String blockBraceStyle)
    {
        properties.put("block.style", blockBraceStyle);
    }

    /**
     * converts the sourcedef property to the corresponding JRefactory property
     * for the location of left brace wrt method declarations and sets it within
     * the properties.
     *
     * @param methodBraceStyle  the sourcedef property for method brace style.
     */
    public void convertMethodBraceStyle(String methodBraceStyle)
    {
        properties.put("method.block.style", methodBraceStyle);
    }

    /**
     * converts the sourcedef property to the corresponding JRefactory property
     * for the location of left brace wrt class declarations and sets it within
     * the properties.
     *
     * @param classBraceStyle  the sourcedef property for class brace style.
     */
    public void convertClassBraceStyle(String classBraceStyle)
    {
        properties.put("class.block.style", classBraceStyle);
    }

    /**
     * converts the sourcedef property to the corresponding JRefactory property
     * for the location keywords wrt right braces and sets it within the
     * properties.
     *
     * @param keywordLocation  the sourcedef property for class brace style.
     */
    public void convertKeywordLocationRightBrace(String keywordLocation)
    {
        String convertedLocation = null;
        if (SourcedefDirector.KEYWORD_LOCATION_RIGHT_BRACE_SAME.equals(
                keywordLocation))
        {
            convertedLocation = "false";
        }
        else if (SourcedefDirector.KEYWORD_LOCATION_RIGHT_BRACE_ALONE.equals(
                keywordLocation))
        {
            convertedLocation = "true";
        }
        else
        {
            throw new BuildException("Unrecognised keyword location " +
                    keywordLocation);
        }
        properties.put("catch.start.line", convertedLocation);
        properties.put("else.start.line", convertedLocation);
    }

    /**
     * Sets the max line length within the properties.
     *
     * @param maxLineLength  the maximum allowed line length
     */
    public void convertMaxLineLength(String maxLineLength)
    {
        properties.put("javadoc.wordwrap.max", maxLineLength);
    }

    /**
     * loads the header file into the properties a line at a time with the
     * propety name 'header.[n]' where n is the line number
     *
     * @param headerFilename  filename of the header file to set in the
     *      properties.
     */
    public void convertHeaderFile(String headerFilename)
    {
        if (headerFilename == null)
        {
            return;
        }

        File headerFile = new File(headerFilename);
        if (headerFile.exists())
        {
            FileReader fr = null;
            try
            {
                fr = new FileReader(headerFile);
                BufferedReader br = new BufferedReader(fr);

                String str = null;
                int count = 0;
                while ((str = br.readLine()) != null)
                {
                    count++;
                    String headerLine = "header." + count;
                    properties.put(headerLine, str);
                }
            }
            catch (IOException e)
            {
                throw new BuildException(e);
            }
            finally
            {
                try
                {
                    fr.close();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
        }
    }

    /**
     * Sets whether to use tabs or spaces to indent.
     *
     * @param indentChar  whether to allow tabs.
     */
    public void convertIndentChar(String indentChar)
    {
        properties.put("indent.char", indentChar);
    }

    /**
     * method to insert all other JRefactory configuration in the properties.
     * All properties prefixed with maven.jrefactory are JRefactory properties
     * and have the 'maven.' suffix removed prior to adding to the properties.
     *
     * @param property  the property name
     * @param value     the property value
     */
    public void passThru(String property, String value)
    {
        String prefix = "maven.jrefactory.";
        int length = prefix.length();
        if (property.startsWith(prefix))
        {
            properties.put(property.substring(length), value);
        }
    }

    /**
     * Accessor to the populated properties object.
     *
     * @return   The properties value
     */
    public Properties getProperties()
    {
        return properties;
    }
}


/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache Maven" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Maven", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 * ====================================================================
 */
package org.apache.maven.sourcedef;

import java.util.Properties;

/**
 * PropertyConverter instances convert maven properties to values specific to
 * some 3rd party system. PropertyConverter fulfils the Builder role within the
 * Builder pattern. Instances are responsible for building a Properties object
 * specific to the the end consumer of the Properties.
 *
 * @created   29 May 2002
 * @author    <A HREF="mailto:[EMAIL PROTECTED]";>Nathan Coast</A>
 */
public interface PropertyConverter
{
    /**
     * Method to add the maven block brace style to the underlying properties in
     * the appropriate format for the consumer.
     *
     * @param blockBraceStyle  the maven block brace style
     */
    void convertBlockBraceStyle(String blockBraceStyle);

    /**
     * Method to add the maven method brace style to the underlying properties
     * in the appropriate format for the consumer.
     *
     * @param methodBraceStyle  the maven method brace style
     */
    void convertMethodBraceStyle(String methodBraceStyle);

    /**
     * Method to add the maven class brace style to the underlying properties in
     * the appropriate format for the consumer.
     *
     * @param classBraceStyle  the maven class brace style
     */
    void convertClassBraceStyle(String classBraceStyle);

    /**
     * Method to add the maven keyword location (wrt right brace) to the
     * underlying properties in the appropriate format for the consumer.
     *
     * @param keywordLocation  the maven keyword location style.
     */
    void convertKeywordLocationRightBrace(String keywordLocation);

    /**
     * Method to add the maven max line length underlying properties in the
     * appropriate format for the consumer.
     *
     * @param maxLineLength  the maven max line length
     */
    void convertMaxLineLength(String maxLineLength);

    /**
     * Method to add the maven header file name / file to the underlying
     * properties in the appropriate format for the consumer.
     *
     * @param headerFilename  Description of the Parameter
     */
    void convertHeaderFile(String headerFilename);

    /**
     * Method to add the maven indent char policy to the underlying properties
     * in the appropriate format for the consumer.
     *
     * @param indentChar  the mave allow tabs policy
     */
    void convertIndentChar(String indentChar);

    /**
     * Method to process all other properties (not covered by maven.sourcedef)
     *
     * @param property  the property name
     * @param value     the value of the property
     */
    void passThru(String property, String value);

    /**
     * Accessor to the Product of the Builder, ie the Properties.
     *
     * @return   The properties object built by this builder.
     */
    Properties getProperties();
}



/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache Maven" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Maven", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 * ====================================================================
 */
package org.apache.maven.sourcedef;

import java.util.Hashtable;
import java.util.Iterator;

/**
 * SourcedefDirector fulfils the Director role in the Builder pattern
 * responsible for building Properties instances specific to 3rd party
 * consumers. These Properties instances are built from combining
 * maven.sourcedef properties with properties specific to the 3rd party tool.
 * The actual building of the property objects is delegated to a {@link
 * PropertyConverter} instance used to configure an instance of
 * SourcedefDirector.
 *
 * @created   29 May 2002
 * @author    <A HREF="mailto:[EMAIL PROTECTED]";>Nathan Coast</A>
 */
public class SourcedefDirector
{

    /**
     * constant for 'C' brace style
     */
    public final static String BRACE_STYLE_C = "C";

    /**
     * constant for 'pascal' brace style
     */
    public final static String BRACE_STYLE_PASCAL = "PASCAL";

    /**
     * constant for the same line keyword location
     */
    public final static String KEYWORD_LOCATION_RIGHT_BRACE_SAME = "same";

    /**
     * constant for the new line keywork location
     */
    public final static String KEYWORD_LOCATION_RIGHT_BRACE_ALONE = "alone";

    /**
     * constant for the tab indent character
     */
    public final static String INDENT_TAB = "tab";

    /**
     * constant for the space indent character
     */
    public final static String INDENT_SPACE = "space";

    /**
     * the PropetyConverter instance responsible for Building the Properites
     * object.
     */
    private PropertyConverter converter;

    /**
     * Constructor for the SourcedefDirector object, sets the PropertyConverter
     * instance.
     *
     * @param converter  the Builder to configure this Director with
     */
    SourcedefDirector(PropertyConverter converter)
    {
        this.converter = converter;
    }

    /**
     * Method to build the Properties object from the hashtable of properties
     * passsed in.
     *
     * @param mavenSourceProps  the full set of mave propeties.
     */
    void readProperties(Hashtable mavenSourceProps)
    {
        Iterator it = mavenSourceProps.keySet().iterator();
        while (it.hasNext())
        {
            String property = (String) it.next();
            String value = (String) mavenSourceProps.get(property);

            if (property.equals("maven.sourcedef.block.brace.style"))
            {
                converter.convertBlockBraceStyle(value);
            }
            else if (property.equals("maven.sourcedef.method.brace.style"))
            {
                converter.convertMethodBraceStyle(value);
            }
            else if (property.equals("maven.sourcedef.class.brace.style"))
            {
                converter.convertClassBraceStyle(value);
            }
            else if (property.equals(
                    "maven.sourcedef.keyword.location.right.brace"))
            {
                converter.convertKeywordLocationRightBrace(value);
            }
            else if (property.equals("maven.sourcedef.max.line.len"))
            {
                converter.convertMaxLineLength(value);
            }
            else if (property.equals("maven.sourcedef.header.file"))
            {
                converter.convertHeaderFile(value);
            }
            else if (property.equals("maven.sourcedef.indent.char"))
            {
                converter.convertIndentChar(value);
            }
            else
            {
                converter.passThru(property, value);
            }
        }
    }
}
Index: jakarta-turbine-maven/build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/build.xml,v
retrieving revision 1.37
diff -u -r1.37 build.xml
--- jakarta-turbine-maven/build.xml     19 May 2002 01:41:14 -0000      1.37
+++ jakarta-turbine-maven/build.xml     30 May 2002 15:39:15 -0000
@@ -147,6 +147,10 @@
     <target name="maven:check-source">
       <ant antfile="${maven.home}/plugins/core/build.xml" target="check-source"/>
     </target>
+    
+    <target name="maven:pretty-print">
+      <ant antfile="${maven.home}/plugins/core/build.xml" target="pretty-print"/>
+    </target>
 
     <target name="maven:dist">
       <ant antfile="${maven.home}/plugins/core/build.xml" target="dist"/>
Index: jakarta-turbine-maven/src/templates/build/plugins/core/build.xml
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/core/build.xml,v
retrieving revision 1.4
diff -u -r1.4 build.xml
--- jakarta-turbine-maven/src/templates/build/plugins/core/build.xml    27 May 2002 
07:50:45 -0000      1.4
+++ jakarta-turbine-maven/src/templates/build/plugins/core/build.xml    30 May 2002 
+15:39:48 -0000
@@ -329,6 +329,49 @@
 
   </target>
 
+
+  <!-- ================================================================== -->
+  <!-- JRefactory Pretty Print                                            -->
+  <!-- ================================================================== -->
+
+  <target
+    name="pretty-print"
+    depends="local-init, env"
+    description="modify code according to maven source definition">
+    
+    <taskdef 
+      name="prettyprintconfig"
+      classname="org.apache.maven.sourcedef.JRefactoryConfigTask">
+      <classpath refid="maven-classpath"/>
+    </taskdef>
+    
+    <prettyprintconfig/>
+
+      <taskdef name="filesetfrompath" 
+        classname="org.apache.maven.ant.FileSetFromPath">
+      <classpath>
+        <path refid="maven-classpath"/>
+      </classpath>
+    </taskdef>
+
+    <filesetfrompath pathid="maven.src.set"
+        filesetid="maven.sourceDirectories.fileset"
+        includes="${maven.jrefactory.includes}"
+        excludes="${maven.jrefactory.excludes}"/>
+    
+    <taskdef 
+      name="prettyprint"
+      classname="org.acm.seguin.ant.Pretty">
+      <classpath refid="maven-classpath"/>
+    </taskdef>
+    
+    <prettyprint settingsDir="${maven.build.dir}">
+      <fileset refid="maven.sourceDirectories.fileset" />
+    </prettyprint>
+    
+  </target>
+
+
   <!-- ================================================================== -->
   <!-- C H E C K S O U R C E                                              -->
   <!-- ================================================================== -->
@@ -339,6 +382,13 @@
 
   <target name="do-check-source" if="maven.sourcesPresent">
 
+    <taskdef 
+      name="checkstyleconfig"
+      classname="org.apache.maven.sourcedef.CheckstyleConfigTask">
+      <classpath refid="maven-classpath"/>
+    </taskdef>
+
+
     <taskdef
       name="checkstyle"
       classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
@@ -363,54 +413,21 @@
         includes="${maven.checkstyle.includes}"
         excludes="${maven.checkstyle.excludes}"/>
         
-    <checkstyle
-      lcurlyType="${maven.checkstyle.lcurly.type}"
-      lcurlyMethod="${maven.checkstyle.lcurly.method}"
-      lcurlyOther="${maven.checkstyle.lcurly.other}"
-      rcurly="${maven.checkstyle.rcurly}"
-      parenPad="${maven.checkstyle.paren.pad}"
-      allowTabs="${maven.checkstyle.allow.tabs}"
-      allowProtected="${maven.checkstyle.allow.protected}"
-      allowPackage="${maven.checkstyle.allow.package}"
-      allowNoAuthor="${maven.checkstyle.allow.no.author}"
-      maxLineLen="${maven.checkstyle.max.line.len}"
-      tabWidth="${maven.checkstyle.tab.width}"
-      ignoreLineLengthPattern="${maven.checkstyle.ignore.line.len.pattern}"
-      maxMethodLen="${maven.checkstyle.max.method.len}"
-      maxConstructorLen="${maven.checkstyle.max.constructor.len}"
-      maxFileLen="${maven.checkstyle.max.file.len}"
-      ignoreImportLen="${maven.checkstyle.ignore.import.len}"
-      memberPattern="${maven.checkstyle.member.pattern}"
-      publicMemberPattern="${maven.checkstyle.public.member.pattern}"
-      paramPattern="${maven.checkstyle.param.pattern}"
-      constPattern="${maven.checkstyle.const.pattern}"
-      staticPattern="${maven.checkstyle.static.pattern}"
-      typePattern="${maven.checkstyle.type.pattern}"
-      methodPattern="${maven.checkstyle.method.pattern}"
-      localVarPattern="${maven.checkstyle.local.var.pattern}"
-      headerFile="${maven.checkstyle.header.file}"
-      headerLinesRegexp="${maven.checkstyle.header.lines.regexp}"
-      headerIgnoreLine="${maven.checkstyle.header.ignore.line}"
-      javadocScope="${maven.checkstyle.javadoc.scope}"
-      requirePackageHtml="${maven.checkstyle.require.package.html}"
-      ignoreImports="${maven.checkstyle.ignore.imports}"
-      illegalImports="${maven.checkstyle.illegal.imports}"
-      ignoreWhitespace="${maven.checkstyle.ignore.whitespace}"
-      ignoreCastWhitespace="${maven.checkstyle.ignore.cast.whitespace}"
-      ignoreBraces="${maven.checkstyle.ignore.braces}"
-      ignorePublicInInterface="${maven.checkstyle.ignore.public.in.interface}"
-      failOnViolation="${maven.checkstyle.fail.on.violation}"
-      cacheFile="${maven.checkstyle.cache.file}" >
+    <checkstyleconfig/>
+    
+    <checkstyle 
+        properties="${maven.checkstyle.dir}/CheckstyleConfig.properties" 
+        failOnViolation="${maven.checkstyle.fail.on.violation}">
       <fileset refid="maven.sourceDirectories.fileset" />
-      <formatter type="xml" toFile="${maven.build.dir}/checkstyle-raw-report.xml"/>
-      <formatter type="plain" toFile="${maven.build.dir}/checkstyle-raw-report.txt"/>
+      <formatter type="xml" 
+toFile="${maven.checkstyle.dir}/checkstyle-raw-report.xml"/>
+      <formatter type="plain" 
+toFile="${maven.checkstyle.dir}/checkstyle-raw-report.txt"/>
     </checkstyle>
 
     <dvsl
       basedir="."
       style="${maven.home}/stylesheets/checkstyle.dvsl"
       toolboxfile="${maven.home}/stylesheets/toolbox.props"
-      in="${maven.build.dir}/checkstyle-raw-report.xml"
+      in="${maven.checkstyle.dir}/checkstyle-raw-report.xml"
       out="${maven.gen.docs}/checkstyle-report.xml">
       <!-- Need to add the maven jar to load the toolbox -->
       <classpath>
Index: jakarta-turbine-maven/src/templates/build/plugins/core/default.properties
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/core/default.properties,v
retrieving revision 1.4
diff -u -r1.4 default.properties
--- jakarta-turbine-maven/src/templates/build/plugins/core/default.properties   27 May 
2002 08:02:41 -0000      1.4
+++ jakarta-turbine-maven/src/templates/build/plugins/core/default.properties   30 May 
+2002 15:40:25 -0000
@@ -75,21 +75,29 @@
 maven.jxr.destdir = ${maven.docs.dest}/xref
 
 #
+# source definition properties. if not set, default values below are 
+# set by org.apache.maven.sourcedef.SourceDefinition
+# 
+
+maven.sourcedef.class.brace.style=PASCAL
+maven.sourcedef.method.brace.style=PASCAL
+maven.sourcedef.block.brace.style=PASCAL
+maven.sourcedef.keyword.location.right.brace=alone
+maven.sourcedef.max.line.len=80
+maven.sourcedef.header.file=LICENSE.txt
+maven.sourcedef.indent.char=space
+
+#
 # Checkstyle settings ... default maven settings, these can be
 # overridden in a project specific properties file.
 #
+maven.checkstyle.dir=${maven.build.dir}/checkstyle
 maven.checkstyle.includes = **/*.java
 maven.checkstyle.excludes = 
-maven.checkstyle.lcurly.type = nl
-maven.checkstyle.lcurly.method = nl
-maven.checkstyle.lcurly.other = nl
-maven.checkstyle.rcurly = alone
 maven.checkstyle.paren.pad = nospace
-maven.checkstyle.allow.tabs = false
 maven.checkstyle.allow.protected = false
 maven.checkstyle.allow.package = false
 maven.checkstyle.allow.no.author = false
-maven.checkstyle.max.line.len = 80
 maven.checkstyle.tab.width = 8
 maven.checkstyle.ignore.line.len.pattern = ^$
 maven.checkstyle.max.method.len = 150
@@ -104,9 +112,8 @@
 maven.checkstyle.type.pattern = ^[A-Z][a-zA-Z0-9]*$
 maven.checkstyle.method.pattern = ^[a-z][a-zA-Z0-9]*$
 maven.checkstyle.local.var.pattern = ^[a-z][a-zA-Z0-9]*$
-maven.checkstyle.header.file = LICENSE.txt
 maven.checkstyle.header.lines.regexp = false
-maven.checkstyle.header.ignore.line = 1,6
+maven.checkstyle.header.ignore.line=
 maven.checkstyle.javadoc.scope = private
 maven.checkstyle.require.package.html = false
 maven.checkstyle.ignore.imports = false
@@ -116,7 +123,94 @@
 maven.checkstyle.ignore.braces = false
 maven.checkstyle.ignore.public.in.interface = false
 maven.checkstyle.fail.on.violation = false
-maven.checkstyle.cache.file = ${maven.build.dir}/checkstyle-cachefile
+maven.checkstyle.cache.file = ${maven.checkstyle.dir}/checkstyle-cachefile
+
+#
+# jrefactroy properties
+#
+
+maven.jrefactory.includes=**/*.java
+maven.jrefactory.excludes=
+maven.jrefactory.version=3.8
+maven.jrefactory.indent=4
+maven.jrefactory.indent.char=space
+maven.jrefactory.expr.space=false
+maven.jrefactory.lines.between=1
+maven.jrefactory.cast.space=true
+maven.jrefactory.cast.force.nospace=false
+maven.jrefactory.surprise.return=double
+maven.jrefactory.throws.newline=false
+maven.jrefactory.field.name.indent=-1
+maven.jrefactory.end.line=CRNL
+maven.jrefactory.variable.spacing=single
+maven.jrefactory.dynamic.variable.spacing=1
+maven.jrefactory.variable.align.with.block=false
+maven.jrefactory.case.indent=4
+maven.jrefactory.keyword.space=true
+maven.jrefactory.insert.space.around.local.variables=false
+maven.jrefactory.lines.after.package=1
+maven.jrefactory.maintain.newlines.around.imports=true
+maven.jrefactory.lines.before.class=0
+maven.jrefactory.indent.in.initializer=false
+maven.jrefactory.bang.space=false
+maven.jrefactory.method.space=false
+maven.jrefactory.cast.inside.space=false
+maven.jrefactory.space.around.ops=true
+maven.jrefactory.force.block=true
+maven.jrefactory.empty.block.single.line=true
+maven.jrefactory.remove.excess.blocks=false
+maven.jrefactory.singleline.comment.ownline=true
+maven.jrefactory.singleline.comment.absoluteindent=0
+maven.jrefactory.singleline.comment.incrementalindent=0
+maven.jrefactory.singleline.comment.indentstyle.shared=incremental
+maven.jrefactory.singleline.comment.indentstyle.ownline=code
+maven.jrefactory.c.style.format=align.star
+maven.jrefactory.c.style.indent=2
+maven.jrefactory.method.minimum=none
+maven.jrefactory.field.minimum=none
+maven.jrefactory.class.minimum=none
+maven.jrefactory.javadoc.star=1
+maven.jrefactory.javadoc.wordwrap.min=40
+maven.jrefactory.space.before.javadoc=true
+maven.jrefactory.javadoc.id.lineup=true
+maven.jrefactory.javadoc.indent=1
+maven.jrefactory.reformat.comments=true
+maven.jrefactory.exception.tag.name=@exception
+maven.jrefactory.document.nested.classes=true
+maven.jrefactory.allow.singleline.javadoc=false
+maven.jrefactory.keep.all.javadoc=false
+maven.jrefactory.class.descr=Description of the Class
+maven.jrefactory.interface.descr=Description of the Interface
+maven.jrefactory.constructor.descr=Constructor for the {0} object
+maven.jrefactory.method.descr=Description of the Method
+maven.jrefactory.getter.descr=Gets the {3} attribute of the {1} {2}
+maven.jrefactory.getter.return.descr=The {3} value
+maven.jrefactory.setter.descr=Sets the {3} attribute of the {1} {2}
+maven.jrefactory.setter.param.descr=The new {3} value
+maven.jrefactory.field.descr=Description of the Field
+maven.jrefactory.run.descr=Main processing method for the {1} {2}
+maven.jrefactory.main.descr=The main program for the {1} {2}
+maven.jrefactory.main.param.descr=The command line arguments
+maven.jrefactory.adder.descr=Adds a feature to the {0} attribute of the {1} {2}
+maven.jrefactory.adder.param.descr=The feature to be added to the {0} attribute
+maven.jrefactory.junit.setUp.descr=The JUnit setup method
+maven.jrefactory.junit.test.descr=A unit test for JUnit
+maven.jrefactory.junit.tearDown.descr=The teardown method for JUnit
+maven.jrefactory.junit.suite.descr=A unit test suite for JUnit
+maven.jrefactory.junit.suite.return.descr=The test suite
+maven.jrefactory.author.descr={0}
+maven.jrefactory.created.descr={1}
+maven.jrefactory.param.descr=Description of the Parameter
+maven.jrefactory.return.descr=Description of the Return Value
+maven.jrefactory.exception.descr=Description of the Exception
+maven.jrefactory.class.tags=created
+maven.jrefactory.method.tags=param,return,exception
+maven.jrefactory.field.tags=
+maven.jrefactory.char.stream.type=1
+maven.jrefactory.pretty.printer.backup.ext=
+maven.jrefactory.sort.top=false
+maven.jrefactory.import.sort.important=
+maven.jrefactory.import.sort.neighbourhood=0
 
 #
 # UI Color Prefs
Index: jakarta-turbine-maven/jars.list
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/jars.list,v
retrieving revision 1.9
diff -u -r1.9 jars.list
--- jakarta-turbine-maven/jars.list     12 May 2002 15:18:08 -0000      1.9
+++ jakarta-turbine-maven/jars.list     30 May 2002 15:40:55 -0000
@@ -39,3 +39,4 @@
 regexp-1.2.jar
 velocity-1.3-dev.jar
 velocity-dvsl-0.43.jar
+jrefactory.jar
Index: jakarta-turbine-maven/project.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/project.xml,v
retrieving revision 1.80
diff -u -r1.80 project.xml
--- jakarta-turbine-maven/project.xml   26 May 2002 16:17:36 -0000      1.80
+++ jakarta-turbine-maven/project.xml   30 May 2002 15:41:24 -0000
@@ -327,6 +327,15 @@
       <url>http://www.clarkware.com/software/JDepend.html</url>
     </dependency>
 
+    <dependency>
+      <name>jrefactory</name>
+      <type>required</type>
+      <version>2.6.36</version>
+      <jar>jrefactory.jar</jar>
+      <url>http://jrefactory.sourceforge.net/chrissoft.html</url>
+    </dependency>
+
+
     <!-- maven:pdf requirements
     <dependency>
       <name>fop</name>


/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache Maven" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Maven", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 * ====================================================================
 */
package org.apache.maven.sourcedef;

import java.io.File;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.Project;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Properties;

/**
 * task responsible for writing the checkstyle configuration file. Delegates
 * responsibility for construction of the config file to a {@link
 * SourcedefDirector} configured with a {@link
 * org.apache.maven.sourcedef.CheckstylePropertyConverter} instance.
 *
 * @created   28 May 2002
 * @author    <A HREF="mailto:[EMAIL PROTECTED]";>Nathan Coast</A>
 */
public class CheckstyleConfigTask extends Task
{

    /**
     * execute method to combine the maven.checkstyle properties with converted
     * maven.sourcedef properties and write them to
     * ${maven.checkstyle.dir}/CheckstyleConfig.properties
     *
     * @exception BuildException  thrown if an IOException occurs whilst
     *      attempting to write to the config file.
     */
    public void execute() throws BuildException
    {
        Project project = getProject();
        Hashtable props = project.getProperties();
        PropertyConverter converter = new CheckstylePropertyConverter();
        SourcedefDirector director = new SourcedefDirector(converter);
        director.readProperties(props);
        Properties config = converter.getProperties();

        String checkstyleDirStr = (String) props.get("maven.checkstyle.dir");
        File checkstyleDir = new File(checkstyleDirStr);
        if (!checkstyleDir.exists())
        {
            if (!checkstyleDir.mkdir())
            {
                throw new BuildException(
                        "unable to create checkstyle directory: "
                        + checkstyleDir);
            }
        }
        File configFile = new File(checkstyleDir,
                "CheckstyleConfig.properties");

        FileOutputStream fos = null;
        try
        {
            fos = new FileOutputStream(configFile);
            config.store(fos, "this is a generated file do not edit");
        }
        catch (IOException e)
        {
            throw new BuildException(e);
        }
        finally
        {
            if (fos != null)
            {
                try
                {
                    fos.close();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
        }
    }
}


/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache Maven" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Maven", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 * ====================================================================
 */
package org.apache.maven.sourcedef;

import org.apache.tools.ant.BuildException;
import java.util.Properties;

/**
 * Implmentation of PropertyConverter responsible for combining maven.checkstyle
 * and maven.sourcedef properties to a set of checkstyle specific properties.
 *
 * @created   28 May 2002
 * @author    <A HREF="mailto:[EMAIL PROTECTED]";>Nathan Coast</A>
 */
public class CheckstylePropertyConverter implements PropertyConverter
{
    /**
     * the properties object to contain the Checkstyle configuration
     */
    private Properties properties = null;

    /**
     * Constructor for the CheckstylePropertyConverter object
     */
    CheckstylePropertyConverter()
    {
        properties = new Properties();
    }

    /**
     * converts the sourcedef property to the corresponding checkstyle property
     * for the location of left brace wrt blocks of code and sets it within the
     * properties.
     *
     * @param blockBraceStyle  the sourcedef property for block brace style.
     */
    public void convertBlockBraceStyle(String blockBraceStyle)
    {
        String braceStyle = convertLeftBraceType(blockBraceStyle);
        properties.put("checkstyle.lcurly.other", braceStyle);
    }

    /**
     * converts the sourcedef property to the corresponding checkstyle property
     * for the location of left brace wrt method declarations and sets it within
     * the properties.
     *
     * @param methodBraceStyle  the sourcedef property for method brace style.
     */
    public void convertMethodBraceStyle(String methodBraceStyle)
    {
        String braceStyle = convertLeftBraceType(methodBraceStyle);
        properties.put("checkstyle.lcurly.method", braceStyle);
    }

    /**
     * converts the sourcedef property to the corresponding checkstyle property
     * for the location of left brace wrt class declarations and sets it within
     * the properties.
     *
     * @param classBraceStyle  the sourcedef property for class brace style.
     */
    public void convertClassBraceStyle(String classBraceStyle)
    {
        String braceStyle = convertLeftBraceType(classBraceStyle);
        properties.put("checkstyle.lcurly.type", braceStyle);
    }

    /**
     * converts the sourcedef property to the corresponding checkstyle property
     * for the location keywords wrt right braces and sets it within the
     * properties.
     *
     * @param keywordLocation  the sourcedef property for class brace style.
     */
    public void convertKeywordLocationRightBrace(String keywordLocation)
    {
        properties.put("checkstyle.rcurly", keywordLocation);
    }

    /**
     * Sets the max line length within the properties.
     *
     * @param maxLineLength  the maximum allowed line length
     */
    public void convertMaxLineLength(String maxLineLength)
    {
        properties.put("checkstyle.maxlinelen", maxLineLength);
    }

    /**
     * Sets the name of the header file within the properties.
     *
     * @param headerFilename  the header filename to set in the properties.
     */
    public void convertHeaderFile(String headerFilename)
    {
        if (headerFilename == null)
        {
            return;
        }
        properties.put("checkstyle.header.file", headerFilename);
    }

    /**
     * Sets whether or not tabs are allowed into the properties.
     *
     * @param indentChar  Description of the Parameter
     */
    public void convertIndentChar(String indentChar)
    {
        String value;
        if (SourcedefDirector.INDENT_TAB.equals(indentChar))
        {
            value = "true";
        }
        else if (SourcedefDirector.INDENT_SPACE.equals(indentChar))
        {
            value = "false";
        }
        else
        {
            throw new BuildException(
                    "indent char " + indentChar + " not recognised");
        }
        properties.put("checkstyle.allow.tabs", value);
    }

    /**
     * method to insert all other checkstyle configuration in the properties.
     * All properties prefixed with maven.checkstyle are checkstyle properties
     * and have the 'maven.' suffix removed prior to adding to the properties.
     *
     * @param property  the property name
     * @param value     the property value
     */
    public void passThru(String property, String value)
    {
        int length = "maven.".length();
        if (property.startsWith("maven.checkstyle."))
        {
            properties.put(property.substring(length), value);
        }
    }

    /**
     * Accessor to the populated properties object.
     *
     * @return   The properties value
     */
    public Properties getProperties()
    {
        return properties;
    }

    /**
     * utility to convert between maven.sourcedef properties and checkstyle.
     * properties for the left brace style. if 'C' return 'eol' if 'PASCAL'
     * return 'nl'
     *
     * @param type  the maven.sourcedef property to convert
     * @return      the maven.sourcedef property converted to checkstyle
     *      property.
     */
    private static String convertLeftBraceType(String type)
    {
        String convertedType = null;
        if (SourcedefDirector.BRACE_STYLE_C.equals(type))
        {
            convertedType = "eol";
        }
        else if (SourcedefDirector.BRACE_STYLE_PASCAL.equals(type))
        {
            convertedType = "nl";
        }
        else
        {
            throw new BuildException("Unknown left brace type " + type);
        }
        return convertedType;
    }
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to