org.virtualmock.taskdef
Class VMTransformTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.virtualmock.taskdef.VMTransformTask

public class VMTransformTask
extends org.apache.tools.ant.Task

Task to perform transformation of class or jar files to be executed with VirtualMock.

Version:
$Revision: 1.18 $
Author:
Chad Woolley

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
VMTransformTask()
          Creates a new VMTransformTask object.
 
Method Summary
 org.apache.tools.ant.types.Path createClasspath()
          Overridden method to handle classpath.
protected  void deleteOutjarFile(java.io.File outjarFile)
          Delete the output jar, if it exists.
 void execute()
          Perform execution of the task, first performing necessary setup to run VirtualMock unit tests.
 java.lang.String getAspectjClassname()
          Gets the classname for the AspectJ compiler.
 java.lang.String getAspectpath()
          Gets jar containing VirtualMock aspect classes to weave.
 java.lang.String getAspectpathJarPrefix()
          Gets string which will be used to search the classpath for the aspectpath jar (using String.indexOf(String)).
 java.lang.String getAspectWerkzClassname()
          Gets the classname for the AspectWerkz compiler.
 org.apache.tools.ant.types.Path getClasspath()
          Gets the currently set classpath.
 org.apache.tools.ant.types.CommandlineJava getCommandline()
          Gets the command line.
 java.lang.String getInjars()
          The input jars which will be woven.
 java.lang.String getOutjar()
          Gets the output jar.
 boolean isUseAspectJ()
          Returns flag which indicates whether AspectJ should be used to weave.
 boolean isUseAspectWerkz()
          Returns the flag which indicates whether AspectWerkz should be used to weave.
protected  void performAspectjPreProcessing()
          Performs preprocessing that is specific to AspectJ.
protected  void performAspectwerkzPreProcessing(java.io.File outjarFile)
          Performs preprocessing that is specific to AspectWerkz.
 void setAspectjClassname(java.lang.String aspectjClassname)
          Sets the classname for the AspectJ compiler.
 void setAspectpath(java.lang.String aspectpath)
          Sets jar containing VirtualMock aspect classes to weave.
 void setAspectpathJarPrefix(java.lang.String aspectpathJarPrefix)
          Sets string which will be used to search the classpath for the aspectpath jar (using String.indexOf(String)).
 void setAspectWerkzClassname(java.lang.String aspectWerkzClassname)
          Sets the classname for the AspectWerkz compiler.
 void setClasspath(org.apache.tools.ant.types.Path classpath)
          Sets the classpath to use.
 void setCommandline(org.apache.tools.ant.types.CommandlineJava commandline)
          Sets the command line.
protected  void setDefaultAspectPath()
          If aspectpath was not set by user, search the classpath for the jar containing the virtualmock aspects and set it in the aspectpath variable.
 void setInjars(java.lang.String injars)
          Setter for the input jars.
 void setOutjar(java.lang.String outjar)
          Sets the output jar.
 void setUseAspectJ(boolean useAspectJ)
          Indicates whether AspectJ should be used as the Aspect-Oriented Programming (AOP) framework.
 void setUseAspectWerkz(boolean useAspectWerkz)
          Sets the flag which indicates whether AspectWerkz should be used to weave.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VMTransformTask

public VMTransformTask()
Creates a new VMTransformTask object.

Method Detail

setAspectWerkzClassname

public void setAspectWerkzClassname(java.lang.String aspectWerkzClassname)
Sets the classname for the AspectWerkz compiler.

Parameters:
aspectWerkzClassname - The aspectWerkzClassname to set.

getAspectWerkzClassname

public java.lang.String getAspectWerkzClassname()
Gets the classname for the AspectWerkz compiler.

Returns:
Returns the aspectWerkzClassname.

setAspectjClassname

public void setAspectjClassname(java.lang.String aspectjClassname)
Sets the classname for the AspectJ compiler.

Parameters:
aspectjClassname - The aspectjClassname to set.

getAspectjClassname

public java.lang.String getAspectjClassname()
Gets the classname for the AspectJ compiler.

Returns:
Returns the aspectjClassname.

setAspectpath

public void setAspectpath(java.lang.String aspectpath)
Sets jar containing VirtualMock aspect classes to weave. If this is not specified, then the aspectpathJarPrefix will be used to search for the aspectjar on the classpath.

Parameters:
aspectpath - the aspectpath to set

getAspectpath

public java.lang.String getAspectpath()
Gets jar containing VirtualMock aspect classes to weave. If this is not specified, then the aspectpathJarPrefix will be used to search for the aspectjar on the classpath.

Returns:
Returns the aspectpath.

setAspectpathJarPrefix

public void setAspectpathJarPrefix(java.lang.String aspectpathJarPrefix)
Sets string which will be used to search the classpath for the aspectpath jar (using String.indexOf(String)). If this is not specified, it will default to "virtualmock-aspect-".

Parameters:
aspectpathJarPrefix - the aspectpathJarPrefix to set

getAspectpathJarPrefix

public java.lang.String getAspectpathJarPrefix()
Gets string which will be used to search the classpath for the aspectpath jar (using String.indexOf(String)). If this is not specified, it will default to "virtualmock-aspect-".

Returns:
Returns the aspectpathJarPrefix.

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path classpath)
Sets the classpath to use.

Parameters:
classpath - The classpath to set.

getClasspath

public org.apache.tools.ant.types.Path getClasspath()
Gets the currently set classpath.

Returns:
Returns the classpath.

setCommandline

public void setCommandline(org.apache.tools.ant.types.CommandlineJava commandline)
Sets the command line.

Parameters:
commandline - The commandline to set.

getCommandline

public org.apache.tools.ant.types.CommandlineJava getCommandline()
Gets the command line.

Returns:
Returns the commandline.

setInjars

public void setInjars(java.lang.String injars)
Setter for the input jars. Accept as source bytecode any .class files inside the specified .jar files. The output will include these classes, possibly as woven with any applicable aspects. Like classpath, this is a single argument containing a list of paths to jar files, delimited by the platform- specific classpath delimiter.

Parameters:
injars - the injars to set

getInjars

public java.lang.String getInjars()
The input jars which will be woven.

Returns:
Returns the injars.

setOutjar

public void setOutjar(java.lang.String outjar)
Sets the output jar. This is the transformed jar which will be created by this task.

Parameters:
outjar - the outjar to set

getOutjar

public java.lang.String getOutjar()
Gets the output jar. This is the transformed jar which will be created by this task.

Returns:
Returns the outjar.

setUseAspectJ

public void setUseAspectJ(boolean useAspectJ)
Indicates whether AspectJ should be used as the Aspect-Oriented Programming (AOP) framework.

Parameters:
useAspectJ - flag indicating whether AspectJ should be used.

isUseAspectJ

public boolean isUseAspectJ()
Returns flag which indicates whether AspectJ should be used to weave.

Returns:
Returns the flag which indicates whether AspectJ should be used to weave.

setUseAspectWerkz

public void setUseAspectWerkz(boolean useAspectWerkz)
Sets the flag which indicates whether AspectWerkz should be used to weave.

Parameters:
useAspectWerkz - flag indicating whether AspectWerkz should be used to weave.

isUseAspectWerkz

public boolean isUseAspectWerkz()
Returns the flag which indicates whether AspectWerkz should be used to weave.

Returns:
Returns the flag indicating whether AspectWerkz should be used to weave.

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Overridden method to handle classpath. It will take the classpath that is currently specified, and append all elements required to support the VirtualMock environment.

Returns:
the modified classpath

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Perform execution of the task, first performing necessary setup to run VirtualMock unit tests.

Throws:
org.apache.tools.ant.BuildException - DOCUMENT ME! (Constructor Exception)

setDefaultAspectPath

protected void setDefaultAspectPath()
If aspectpath was not set by user, search the classpath for the jar containing the virtualmock aspects and set it in the aspectpath variable.


deleteOutjarFile

protected void deleteOutjarFile(java.io.File outjarFile)
Delete the output jar, if it exists.

Parameters:
outjarFile - the File object representing the outjar

performAspectjPreProcessing

protected void performAspectjPreProcessing()
Performs preprocessing that is specific to AspectJ.


performAspectwerkzPreProcessing

protected void performAspectwerkzPreProcessing(java.io.File outjarFile)
Performs preprocessing that is specific to AspectWerkz.

Parameters:
outjarFile - the File object represented by outjar


Copyright © 2003-2005 Virtual Mock. All Rights Reserved.