org.apache.tools.ant.taskdefs.optional.jdepend
Class JDependTask

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask

public class JDependTask
extends Task

Ant task to run JDepend tests.

JDepend is a tool to generate design quality metrics for each Java package. It has been initially created by Mike Clark. JDepend can be found at http://www.clarkware.com/software/JDepend.html. The current implementation spawn a new Java VM.

Author:
Jerome Lacoste

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
JDependTask()
           
 
Method Summary
 Path createClasspath()
          Maybe creates a nested classpath element.
 Commandline.Argument createJvmarg()
          Create a new JVM argument.
 Path createSourcespath()
          Maybe creates a nested classpath element.
protected  ExecuteWatchdog createWatchdog()
           
 void execute()
          Called by the project to let the task do it's work.
 int executeAsForked(ExecuteWatchdog watchdog)
          Execute the task by forking a new JVM.
 int executeInVM()
          Execute inside VM.
 Path getClasspath()
          Gets the classpath to be used for this compilation.
 java.io.File getDir()
           
 boolean getFork()
           
 boolean getHaltonerror()
           
 java.io.File getOutputFile()
           
 Path getSourcespath()
          Gets the sourcepath.
 void setClasspath(Path classpath)
          Set the classpath to be used for this compilation.
 void setClasspathRef(Reference r)
          Adds a reference to a CLASSPATH defined elsewhere.
 void setDir(java.io.File dir)
          The directory to invoke the VM in.
 void setFork(boolean value)
          Tells whether a JVM should be forked for the task.
 void setHaltonerror(boolean value)
          Halt on Failure? default: false.
 void setJvm(java.lang.String value)
          Set a new VM to execute the task.
 void setOutputFile(java.io.File outputFile)
           
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDependTask

public JDependTask()
Method Detail

setOutputFile

public void setOutputFile(java.io.File outputFile)

getOutputFile

public java.io.File getOutputFile()

setHaltonerror

public void setHaltonerror(boolean value)
Halt on Failure? default: false.

getHaltonerror

public boolean getHaltonerror()

setFork

public void setFork(boolean value)
Tells whether a JVM should be forked for the task. Default: false.
Parameters:
value - true if a JVM should be forked, otherwise false

getFork

public boolean getFork()

setJvm

public void setJvm(java.lang.String value)
Set a new VM to execute the task. Default is java. Ignored if no JVM is forked.
Parameters:
value - the new VM to use instead of java
See Also:
setFork(boolean)

createSourcespath

public Path createSourcespath()
Maybe creates a nested classpath element.

getSourcespath

public Path getSourcespath()
Gets the sourcepath.

setDir

public void setDir(java.io.File dir)
The directory to invoke the VM in. Ignored if no JVM is forked.
Parameters:
dir - the directory to invoke the JVM from.
See Also:
setFork(boolean)

getDir

public java.io.File getDir()

setClasspath

public void setClasspath(Path classpath)
Set the classpath to be used for this compilation.

getClasspath

public Path getClasspath()
Gets the classpath to be used for this compilation.

createClasspath

public Path createClasspath()
Maybe creates a nested classpath element.

createJvmarg

public Commandline.Argument createJvmarg()
Create a new JVM argument. Ignored if no JVM is forked.
Returns:
create a new JVM argument so that any argument can be passed to the JVM.
See Also:
setFork(boolean)

setClasspathRef

public void setClasspathRef(Reference r)
Adds a reference to a CLASSPATH defined elsewhere.

execute

public void execute()
             throws BuildException
Description copied from class: Task
Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.
Overrides:
execute in class Task
Following copied from class: org.apache.tools.ant.Task
Throws:
BuildException - if someting goes wrong with the build

executeInVM

public int executeInVM()
                throws BuildException
Execute inside VM.

executeAsForked

public int executeAsForked(ExecuteWatchdog watchdog)
                    throws BuildException
Execute the task by forking a new JVM. The command will block until it finishes. To know if the process was destroyed or not, use the killedProcess() method of the watchdog class.
Parameters:
watchdog - the watchdog in charge of cancelling the test if it exceeds a certain amount of time. Can be null, in this case the test could probably hang forever.

createWatchdog

protected ExecuteWatchdog createWatchdog()
                                  throws BuildException
Returns:
null if there is a timeout value, otherwise the watchdog instance.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.