edu.ucsb.ccs.jcontractor.extras
Class jContractorTask

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.Java
                    |
                    +--edu.ucsb.ccs.jcontractor.extras.jContractorTask

public class jContractorTask
extends org.apache.tools.ant.taskdefs.Java

Ant task definition for jContractor. This task accepts all the options that the Java task does. (Note, however, that jContractor has never been tested with a Jar, and probably wouldn't work in this case.)

Parameters:

   Attribute   Description                         Required
   ---------   -----------                         --------
   none        A package that is not to be         no
               instrumented. (Nested element.)
   pre         A package to be instrumented with   no
               precondition checks. (Nested
               element.)
   post        A package to be instrumented with   no
               pre and postcondition checks.
               (Nested element.)
   all         A package to be instrumented with   no
               all checks (pre, post, invariant).
               (Nested element.)
   verbose     Toggles verbose logging.  When      no
               verbose logging is enabled,
               jInstrument prints the name of
               each class as it is instrumented. 
 
The arguments to "none", "pre", "post", and "all" are the names of packages, with class names or wildcards. A "*" instead a class name (as in "edu.*") means to match any class in that package or a subpackage. To match all classes in any package, simply pass "*". If only a class name is given the default package is assumed ("jInstrument" is the same as ".jInstrument"). The example below should make every thing clear. The task also accepts all parameters that the Java task accepts.

Example:

   <jContractor classname="MainClass" verbose="false">
        <none package="*"/>
        <pre  package="mypackage.*"/>
        <all  package="mypackage.MyReallyImportantClass"/>
        <arg value="cmd_line_arg1"/>
        <arg value="cmd_line_arg2"/>
   </jContractor>
 

Version:
$Id: jContractorTask.java,v 1.3 2002/03/29 07:37:04 parkera Exp $
Author:
Parker Abercrombie
See Also:
jInstrumentTask

Constructor Summary
jContractorTask()
          Create a new jContractorTask.
 
Method Summary
 void clearArgs()
          Clear the arguments that will be passed to the task that jContractor invokes.
 PackageLevelInstrumentationFilterType createAll()
          Create a <all package="..."/> tag.
 org.apache.tools.ant.types.Commandline.Argument createArg()
          Creates a nested arg element.
 PackageLevelInstrumentationFilterType createNone()
          Create a <none package="..."/> tag.
 PackageLevelInstrumentationFilterType createPost()
          Create a <post package="..."/> tag.
 PackageLevelInstrumentationFilterType createPre()
          Create a <pre package="..."/> tag.
 void execute()
          Execute jContractor to instrument and run the class named classname, with the specified command line arguments.
 java.lang.String getClassname()
          Get the name of the class that jContractor will invoke.
 boolean getVerbose()
          Get the value of the verbose flag.
 void setArgs(java.lang.String s)
          Set the arguments that will be passed to the class that jContractor invokes.
 void setClassname(java.lang.String name)
          Set the name of the class that jContractor will invoke.
 void setVerbose(boolean flag)
          Set the verbose flag.
 
Methods inherited from class org.apache.tools.ant.taskdefs.Java
addEnv, addSysproperty, createClasspath, createJvmarg, executeJava, setAppend, setClasspath, setClasspathRef, setDir, setFailonerror, setFork, setJar, setJvm, setJvmargs, setJVMVersion, setMaxmemory, setNewenvironment, setOutput, setTimeout
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, init, 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

jContractorTask

public jContractorTask()
Create a new jContractorTask.

Method Detail

setClassname

public void setClassname(java.lang.String name)
Set the name of the class that jContractor will invoke.

Overrides:
setClassname in class org.apache.tools.ant.taskdefs.Java
Parameters:
name - the new class name.

getClassname

public java.lang.String getClassname()
Get the name of the class that jContractor will invoke.

Returns:
the name of the class that jContractor invokes.

createArg

public org.apache.tools.ant.types.Commandline.Argument createArg()
Creates a nested arg element.

Overrides:
createArg in class org.apache.tools.ant.taskdefs.Java

setArgs

public void setArgs(java.lang.String s)
Set the arguments that will be passed to the class that jContractor invokes.

Overrides:
setArgs in class org.apache.tools.ant.taskdefs.Java

clearArgs

public void clearArgs()
Clear the arguments that will be passed to the task that jContractor invokes.

Overrides:
clearArgs in class org.apache.tools.ant.taskdefs.Java

setVerbose

public void setVerbose(boolean flag)
Set the verbose flag.

Parameters:
flag - the new value of the flag.

getVerbose

public boolean getVerbose()
Get the value of the verbose flag.

Returns:
the verbose flag.

createNone

public PackageLevelInstrumentationFilterType createNone()
Create a <none package="..."/> tag.


createPre

public PackageLevelInstrumentationFilterType createPre()
Create a <pre package="..."/> tag.


createPost

public PackageLevelInstrumentationFilterType createPost()
Create a <post package="..."/> tag.


createAll

public PackageLevelInstrumentationFilterType createAll()
Create a <all package="..."/> tag.


execute

public void execute()
             throws org.apache.tools.ant.BuildException
Execute jContractor to instrument and run the class named classname, with the specified command line arguments.

Overrides:
execute in class org.apache.tools.ant.taskdefs.Java
Throws:
org.apache.tools.ant.BuildException - if both "classname" and "jar" attributes are given, or if neither is present.