org.apache.tools.ant.taskdefs.optional.metamata

Class MMetrics

public class MMetrics extends AbstractMetamataTask

Computes the metrics of a set of Java files and write the results to an XML file. As a convenience, a stylesheet is given in etc directory, so that an HTML report can be generated from the XML file.

You will not be able to use this task with the evaluation version since as of Metamata 2.0, Metrics does not support command line :-(

Nested Class Summary
static classMMetrics.GranularityAttribute
Attributes for granularity.
Constructor Summary
MMetrics()
default constructor
Method Summary
protected voidcheckOptions()
protected voidcleanUp()
cleanup the temporary txt report
PathcreatePath()
Set a new path (directory) to measure metrics from.
protected ExecuteStreamHandlercreateStreamHandler()
if the report is transform via a temporary txt file we should use a a normal logger here, otherwise we could use the metrics handler directly to capture and transform the output on stdout to XML.
protected voidexecute0(ExecuteStreamHandler handler)
protected VectorgetOptions()
voidsetGranularity(MMetrics.GranularityAttribute granularity)
set the granularity of the audit.
voidsetTofile(File file)
Set the output XML file
protected voidtransformFile()
transform the generated file via the handler This function can either be called if the result is written to the output file via -output or we could use the handler directly on stdout if not.

Constructor Detail

MMetrics

public MMetrics()
default constructor

Method Detail

checkOptions

protected void checkOptions()

cleanUp

protected void cleanUp()
cleanup the temporary txt report

createPath

public Path createPath()
Set a new path (directory) to measure metrics from.

Returns: the path instance to use.

createStreamHandler

protected ExecuteStreamHandler createStreamHandler()
if the report is transform via a temporary txt file we should use a a normal logger here, otherwise we could use the metrics handler directly to capture and transform the output on stdout to XML.

execute0

protected void execute0(ExecuteStreamHandler handler)

getOptions

protected Vector getOptions()

setGranularity

public void setGranularity(MMetrics.GranularityAttribute granularity)
set the granularity of the audit. Should be one of 'files', 'methods' or 'types'.

Parameters: granularity the audit reporting mode.

setTofile

public void setTofile(File file)
Set the output XML file

Parameters: file the xml file to write the XML report to.

transformFile

protected void transformFile()
transform the generated file via the handler This function can either be called if the result is written to the output file via -output or we could use the handler directly on stdout if not.

See Also: createStreamHandler

Copyright