org.appfuse.tool
Class RenamePackages

java.lang.Object
  extended by org.appfuse.tool.RenamePackages

public class RenamePackages
extends Object

This class is almost a complete copy of replacepackages by Ben Gill. These utility methods can be used in the plugin to change package names of appfuse source contributions. Liberties have been taken to make this open source code just work here. Some methods were removed and logging now uses SystemStreamLog from Apache (Maven)

Author:
David L. Whitehurst

Field Summary
protected  org.apache.maven.plugin.logging.Log log
           
 
Constructor Summary
RenamePackages(String newPackage)
          Constructor
 
Method Summary
 void addFileset(org.apache.tools.ant.types.FileSet fileset)
          simple method to add filesets
 void deleteAll(String fileName)
          This method removes directory structures
 void execute()
          This is the main method that gets invoked when ANT calls this task
 String fromFile(String fileName)
           
 void setBaseDir(String baseDir)
          Set the base directory.
 void setExistingPkgName(String existingPkgName)
          Set the existing package name.
 void setInvalidFileTypes(String invalidFileTypes)
          Override the default set of invalid file types that will be moved to the new package structure.
 void setNewPkgName(String newPkgName)
          Set the new package name.
 void toFile(String fileName, String contents)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final transient org.apache.maven.plugin.logging.Log log
Constructor Detail

RenamePackages

public RenamePackages(String newPackage)
Constructor

Method Detail

addFileset

public void addFileset(org.apache.tools.ant.types.FileSet fileset)
simple method to add filesets

Parameters:
fileset -

setInvalidFileTypes

public void setInvalidFileTypes(String invalidFileTypes)
Override the default set of invalid file types that will be moved to the new package structure.

The invalidFileTypes must be a comma separated list of file extensions for example "class,jar,exe"

Parameters:
invalidFileTypes -

setBaseDir

public void setBaseDir(String baseDir)
Set the base directory. The base directory will be where the Task starts to recursively look for files with the given package name in it. This method will be called by ANT when it invokes the Task.

Parameters:
baseDir -

setExistingPkgName

public void setExistingPkgName(String existingPkgName)
                        throws Exception
Set the existing package name. This will become the string that the Task looks to replace in the files look for files with the given package name in it. This method will be called by ANT when it invokes the Task.

Parameters:
existingPkgName -
Throws:
Exception

setNewPkgName

public void setNewPkgName(String newPkgName)
                   throws Exception
Set the new package name. This will become the package name and replace the existing package name in the source files. This method will be called by ANT when it invokes the Task.

Parameters:
newPkgName -
Throws:
Exception

fromFile

public String fromFile(String fileName)
                throws IOException
Throws:
IOException

toFile

public void toFile(String fileName,
                   String contents)
            throws IOException
Throws:
IOException

deleteAll

public void deleteAll(String fileName)
This method removes directory structures


execute

public void execute()
This is the main method that gets invoked when ANT calls this task



Copyright © 2003-2012. All Rights Reserved.