Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.ucsb.ccs.jcontractor.extras
Class jInstrumentTask  view jInstrumentTask download jInstrumentTask.java

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byedu.ucsb.ccs.jcontractor.extras.jInstrumentTask

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

Ant task definition for jInstrument.

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.)
   srcdir      A directory containing Java class   yes
               files to instrument.  All classes
               in this directory and all
               subdirectories will be processed.
   destdir     The directory to which instrumented no
               files will be written. Default is
               the directory of the build file.
   verbose     Toggles verbose logging.  When      no
               verbose logging is enabled,
               jInstrument prints the name of
               each class as it is instrumented. 
   strip       Instructs jInstrument to remove     no
               contract methods from bytecode, in
               order to decrease the file size.
 
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.

Example:

   <jInstrument srcdir="${build.dest}" verbose="false">

      <none package="*"/>
      <pre  package="mypackage.*"/>
      <all  package="mypackage.MyReallyImportantClass"/>
   </jInstrument>
 

Version:
$Id: jInstrumentTask.java,v 1.13 2003/01/26 10:49:58 parkera Exp $

Field Summary
protected  ClassFileFilter classFileFilter
          A FileFilter to find class files.
protected  edu.ucsb.ccs.jcontractor.CompositeInstrumentationFilter filter
          Instrumentation filter build from "none", "pre", "post", and "all" tags.
protected  java.util.Vector instrumentationFilters
          Vector of PackageLevelInstrumentationFilterType that will hold the parameters needed to construct a bunch of PackageLevelInstrumentationFilters.
protected  edu.ucsb.ccs.jcontractor.jInstrument instrumentor
          An instance of jInstrument to use for instrumenting classes.
protected  org.apache.tools.ant.types.Path srcdir
          The directory to instrument.
protected  boolean stripMode
          Flag to signal that jInstrument is to be run to strip contract code, rather than add contract checks.
 
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
jInstrumentTask()
          Create a new jInstrumentTask.
 
Method Summary
 PackageLevelInstrumentationFilterType createAll()
          Create a <all package="..."/> tag.
 PackageLevelInstrumentationFilterType createNone()
          Create a <none package="..."/> tag.
 PackageLevelInstrumentationFilterType createPost()
          Create a <post package="..."/> tag.
 PackageLevelInstrumentationFilterType createPre()
          Create a <pre package="..."/> tag.
 void execute()
          Execute jInstrument to instrument each class file in the directory specified by srcdir.
protected  boolean findClassFiles_Precondition(java.io.File srcFile, java.util.Vector srcVec)
           
protected  void findClassFiles(java.io.File srcFile, java.util.Vector srcVec)
          Find all the class files in a directory and all subdirectories, and collect their names in a Vector.
 java.lang.String getDestdir()
          Get the destination directory of instrumented class files.
 org.apache.tools.ant.types.Path getSrcdir()
          Get the source directory.
 boolean getStrip()
          Get the value of the strip mode flag.
 boolean getVerbose()
          Get the value of the verbose flag.
protected  boolean setDestdir_Precondition(java.lang.String destination)
           
 void setDestdir(java.lang.String destination)
          Set the destination directory of instrumented class files.
protected  boolean setSrcdir_Postcondition(org.apache.tools.ant.types.Path newSrcdir, java.lang.Void RESULT)
           
protected  boolean setSrcdir_Precondition(org.apache.tools.ant.types.Path newSrcdir)
           
 void setSrcdir(org.apache.tools.ant.types.Path newSrcdir)
          Set the source directory.
 void setStrip(boolean flag)
          Set the value of the strip mode flag.
 void setVerbose(boolean flag)
          Set the verbose flag.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
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
 

Field Detail

instrumentor

protected edu.ucsb.ccs.jcontractor.jInstrument instrumentor
An instance of jInstrument to use for instrumenting classes.


srcdir

protected org.apache.tools.ant.types.Path srcdir
The directory to instrument. All class files in this directory and its subdirectories will be processed.


classFileFilter

protected ClassFileFilter classFileFilter
A FileFilter to find class files. This filter is used by the findClassFiles(File, Vector) method.


filter

protected edu.ucsb.ccs.jcontractor.CompositeInstrumentationFilter filter
Instrumentation filter build from "none", "pre", "post", and "all" tags.


instrumentationFilters

protected java.util.Vector instrumentationFilters
Vector of PackageLevelInstrumentationFilterType that will hold the parameters needed to construct a bunch of PackageLevelInstrumentationFilters. Built from "none", "pre", "post", and "all" tags.


stripMode

protected boolean stripMode
Flag to signal that jInstrument is to be run to strip contract code, rather than add contract checks.

Constructor Detail

jInstrumentTask

public jInstrumentTask()
Create a new jInstrumentTask.

Method Detail

setSrcdir

public void setSrcdir(org.apache.tools.ant.types.Path newSrcdir)
Set the source directory. jInstrument will be run to instrument all the class files in this directory and all subdirectories.


setSrcdir_Precondition

protected boolean setSrcdir_Precondition(org.apache.tools.ant.types.Path newSrcdir)

setSrcdir_Postcondition

protected boolean setSrcdir_Postcondition(org.apache.tools.ant.types.Path newSrcdir,
                                          java.lang.Void RESULT)

getSrcdir

public org.apache.tools.ant.types.Path getSrcdir()
Get the source directory.


setDestdir

public void setDestdir(java.lang.String destination)
Set the destination directory of instrumented class files.


setDestdir_Precondition

protected boolean setDestdir_Precondition(java.lang.String destination)

getDestdir

public java.lang.String getDestdir()
Get the destination directory of instrumented class files.


setVerbose

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


getVerbose

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


setStrip

public void setStrip(boolean flag)
Set the value of the strip mode flag. When this flag is set, jInstrument is run to remove contract methods from bytecode.


getStrip

public boolean getStrip()
Get the value of the strip mode flag. When this flag is set, jInstrument is run to remove contract methods from bytecode.


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 jInstrument to instrument each class file in the directory specified by srcdir.


findClassFiles

protected void findClassFiles(java.io.File srcFile,
                              java.util.Vector srcVec)
Find all the class files in a directory and all subdirectories, and collect their names in a Vector.


findClassFiles_Precondition

protected boolean findClassFiles_Precondition(java.io.File srcFile,
                                              java.util.Vector srcVec)