Author: brett
Date: Tue Aug 22 20:25:10 2006
New Revision: 433864

URL: http://svn.apache.org/viewvc?rev=433864&view=rev
Log:
[MCLEAN-18] make source checkstyle compliant
Submitted by: Franz Allan Valencia See

Modified:
    
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java
    
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Fileset.java
    
maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java

Modified: 
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java?rev=433864&r1=433863&r2=433864&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java
 Tue Aug 22 20:25:10 2006
@@ -28,11 +28,23 @@
 import java.util.List;
 
 /**
- * Goal which cleans the build.
+ * Goal which cleans the build. 
+ * 
+ * <P>This attempts to clean a project's working directory of the files that 
+ * were generated at build-time. By default, it discovers and deletes the 
+ * directories configured in <code>project.build.directory</code>, 
+ * <code>project.build.outputDirectory</code>, 
+ * <code>project.build.testOutputDirectory</code>, and 
+ * <code>project.reporting.outputDirectory</code>. </P>
+ * 
+ * <P>Files outside the default may also be included in the deletion by 
+ * configuring the <code>filesets</code> tag.</P>
  *
  * @author <a href="mailto:[EMAIL PROTECTED]">Emmanuel Venisse</a>
  * @version $Id$
  * @goal clean
+ * 
+ * @see org.apache.maven.plugin.clean.Fileset.
  */
 public class CleanMojo
     extends AbstractMojo
@@ -76,7 +88,7 @@
     /**
      * Sets whether the plugin runs in verbose mode.
      *
-     * @parameter expression="${clean.verbose}" default=value="false"
+     * @parameter expression="${clean.verbose}" default-value="false"
      */
     private boolean verbose;
 
@@ -90,12 +102,25 @@
     /**
      * Sets whether the plugin should follow Symbolic Links to delete files.
      *
-     * @parameter expression="${clean.followSymLinks}" default=value="false"
+     * @parameter expression="${clean.followSymLinks}" default-value="false"
      */
     private boolean followSymLinks;
 
+    /** 
+     * Finds and retrieves included and excluded files, and handles their 
+     * deletion
+     */
     private FileSetManager fileSetManager;
 
+    
+    /**
+     * Deletes file-sets in the following project build directory order: 
+     * (source) directory, output directory, test directory, report directory, 
+     * and then the additional file-sets.
+     *  
+     * @see org.apache.maven.plugin.Mojo#execute()
+     * @throws MojoExecutionException When 
+     */
     public void execute()
         throws MojoExecutionException
     {
@@ -109,6 +134,11 @@
         removeAdditionalFilesets();
     }
 
+    /**
+     * Deletes additional file-sets specified by the <code>filesets</code> tag.
+     * 
+     * @throws MojoExecutionException When a directory failed to get deleted.
+     */
     private void removeAdditionalFilesets()
         throws MojoExecutionException
     {
@@ -126,13 +156,19 @@
                 }
                 catch ( IOException e )
                 {
-                    throw new MojoExecutionException(
-                        "Failed to delete directory: " + 
fileset.getDirectory() + ". Reason: " + e.getMessage(), e );
+                    throw new MojoExecutionException( "Failed to delete 
directory: " + fileset.getDirectory()
+                        + ". Reason: " + e.getMessage(), e );
                 }
             }
         }
     }
 
+    /**
+     * Deletes a directory and its contents.
+     * 
+     * @param dir The base directory of the included and excluded files.
+     * @throws MojoExecutionException When a directory failed to get deleted.
+     */
     private void removeDirectory( File dir )
         throws MojoExecutionException
     {
@@ -163,39 +199,47 @@
     }
 
     /**
-     * @param directory The directory to set.
+     * Sets the project build directory.
+     * 
+     * @param newDirectory The project build directory to set.
      */
-    protected void setDirectory( File directory )
+    protected void setDirectory( File newDirectory )
     {
-        this.directory = directory;
+        this.directory = newDirectory;
     }
 
     /**
-     * @param outputDirectory The outputDirectory to set.
+     * Sets the project build output directory.
+     * 
+     * @param newOutputDirectory The project build output directory to set.
      */
-    protected void setOutputDirectory( File outputDirectory )
+    protected void setOutputDirectory( File newOutputDirectory )
     {
-        this.outputDirectory = outputDirectory;
+        this.outputDirectory = newOutputDirectory;
     }
 
     /**
-     * @param testOutputDirectory The testOutputDirectory to set.
+     * Sets the project build test output directory.
+     * 
+     * @param newTestOutputDirectory The project build test output directory 
to set.
      */
-    protected void setTestOutputDirectory( File testOutputDirectory )
+    protected void setTestOutputDirectory( File newTestOutputDirectory )
     {
-        this.testOutputDirectory = testOutputDirectory;
+        this.testOutputDirectory = newTestOutputDirectory;
     }
 
     /**
-     * @param reportDirectory The reportDirectory to set.
+     * Sets the project build report directory.
+     * 
+     * @param newReportDirectory The project build report directory to set.
      */
-    protected void setReportDirectory( File reportDirectory )
+    protected void setReportDirectory( File newReportDirectory )
     {
-        this.reportDirectory = reportDirectory;
+        this.reportDirectory = newReportDirectory;
     }
 
     /**
-     * Add a fileset to the list of filesets to clean.
+     * Adds a file-set to the list of file-sets to clean.
      *
      * @param fileset the fileset
      */

Modified: 
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Fileset.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Fileset.java?rev=433864&r1=433863&r2=433864&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Fileset.java
 (original)
+++ 
maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Fileset.java
 Tue Aug 22 20:25:10 2006
@@ -18,10 +18,29 @@
 
 import org.apache.maven.shared.model.fileset.FileSet;
 
+/**
+ * Customizes the string representation of 
+ * <code>org.apache.maven.shared.model.fileset.FileSet</code> to return the 
+ * included and excluded files from the file-set's directory. Specifically, 
+ * <code>"file-set: <I>[directory]</I> (included: <I>[included files]</I>, 
+ * excluded: <I>[excluded files]</I>)"</code>   
+ *  
+ * @see org.apache.maven.shared.model.fileset.FileSet
+ */
 public class Fileset
     extends FileSet
 {
 
+    /**
+     * Retrieves the included and excluded files from this file-set's 
directory.
+     * Specifically, <code>"file-set: <I>[directory]</I> (included: 
+     * <I>[included files]</I>, excluded: <I>[excluded files]</I>)"</code>   
+     * 
+     * @return The included and excluded files from this file-set's directory.
+     * Specifically, <code>"file-set: <I>[directory]</I> (included: 
+     * <I>[included files]</I>, excluded: <I>[excluded files]</I>)"</code>   
+     * @see java.lang.Object#toString()
+     */
     public String toString()
     {
         return "file-set: " + getDirectory() + " (included: " + getIncludes() 
+ ", excluded: " + getExcludes() + ")";

Modified: 
maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java?rev=433864&r1=433863&r2=433864&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java
 (original)
+++ 
maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java
 Tue Aug 22 20:25:10 2006
@@ -133,9 +133,9 @@
         assertTrue( checkExists( base ) );
         assertTrue( checkExists( base + "/classes" ) );
         assertFalse( checkExists( base + "/classes/file.txt" ) );
-/* TODO: looks like a bug in the file-management library
-        assertTrue( FileUtils.fileExists( base + "/subdir/file.txt" ) );
-*/
+        /* TODO: looks like a bug in the file-management library
+         assertTrue( FileUtils.fileExists( base + "/subdir/file.txt" ) );
+         */
 
         // fileset 2
         assertTrue( checkExists( outputDirectory ) );
@@ -162,59 +162,59 @@
         }
     }
 
-/* Unix will let you get away with it, not sure how to lock the file from Java.
-    public void testOpenFile()
-        throws MojoExecutionException, FileNotFoundException
-    {
-        String path = TARGET_TEST_DIR + "/target/subdir";
-
-        CleanMojo mojo = new CleanMojo();
-        mojo.setDirectory( new File( basedir, path ) );
-
-        FileInputStream fis = new FileInputStream( new File( basedir, path + 
"/file.txt" ) );
-
-        try
-        {
-            mojo.execute();
-
-            fail( "Should fail to delete a file that is open" );
-        }
-        catch ( MojoExecutionException expected )
-        {
-            assertTrue( true );
-        }
-        finally
-        {
-            IOUtil.close( fis );
-        }
-    }
-
-    public void testOpenFileInFileSet()
-        throws MojoExecutionException, FileNotFoundException
-    {
-        String path = TARGET_TEST_DIR + "/target/subdir";
-
-        CleanMojo mojo = new CleanMojo();
-        mojo.addFileset( createFileset( path, "**", "" ) );
-
-        FileInputStream fis = new FileInputStream( new File( basedir, path + 
"/file.txt" ) );
-
-        try
-        {
-            mojo.execute();
-
-            fail( "Should fail to delete a file that is open" );
-        }
-        catch ( MojoExecutionException expected )
-        {
-            assertTrue( true );
-        }
-        finally
-        {
-            IOUtil.close( fis );
-        }
-    }
-*/
+    /* Unix will let you get away with it, not sure how to lock the file from 
Java.
+     public void testOpenFile()
+     throws MojoExecutionException, FileNotFoundException
+     {
+     String path = TARGET_TEST_DIR + "/target/subdir";
+
+     CleanMojo mojo = new CleanMojo();
+     mojo.setDirectory( new File( basedir, path ) );
+
+     FileInputStream fis = new FileInputStream( new File( basedir, path + 
"/file.txt" ) );
+
+     try
+     {
+     mojo.execute();
+
+     fail( "Should fail to delete a file that is open" );
+     }
+     catch ( MojoExecutionException expected )
+     {
+     assertTrue( true );
+     }
+     finally
+     {
+     IOUtil.close( fis );
+     }
+     }
+
+     public void testOpenFileInFileSet()
+     throws MojoExecutionException, FileNotFoundException
+     {
+     String path = TARGET_TEST_DIR + "/target/subdir";
+
+     CleanMojo mojo = new CleanMojo();
+     mojo.addFileset( createFileset( path, "**", "" ) );
+
+     FileInputStream fis = new FileInputStream( new File( basedir, path + 
"/file.txt" ) );
+
+     try
+     {
+     mojo.execute();
+
+     fail( "Should fail to delete a file that is open" );
+     }
+     catch ( MojoExecutionException expected )
+     {
+     assertTrue( true );
+     }
+     finally
+     {
+     IOUtil.close( fis );
+     }
+     }
+     */
 
     public void testMissingDirectory()
         throws MojoExecutionException
@@ -234,8 +234,8 @@
     {
         Fileset fileset = new Fileset();
         fileset.setDirectory( new File( basedir, dir ).getAbsolutePath() );
-        fileset.setIncludes( Arrays.asList( new String[]{includes} ) );
-        fileset.setExcludes( Arrays.asList( new String[]{excludes} ) );
+        fileset.setIncludes( Arrays.asList( new String[] { includes } ) );
+        fileset.setExcludes( Arrays.asList( new String[] { excludes } ) );
         return fileset;
     }
 


Reply via email to