sbailliez 01/08/01 03:32:28
Added: docs/manual/OptionalTasks maudit.html mmetrics.html
Log:
documentation for metamata tasks MMetrics and MAudit
Revision Changes Path
1.1 jakarta-ant/docs/manual/OptionalTasks/maudit.html
Index: maudit.html
===================================================================
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>MAudit Task</title>
</head>
<body>
<h2><a name="maudit">MAudit</a></h2>
<p>by</p>
<ul>
<li>Stephane Bailliez (<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>)</li>
</ul>
<h3>Requirements</h3>
<p>This task requires Metamata Development environment 2.0/Webgain Quality
Analyzer 2.0.
An evaluation version is available at <a
href="http://www.webgain.com/products/quality_analyzer">Webgain</a>.
, <a href="http://jakarta.apache.org/oro">Jakarta Oro</a> and a XML parser
(via JAXP).</p>
<h3>Description</h3>
<p>
Invokes the Metamata Audit/ Webgain Quality Analyzer on a set of Java files.
</p>
<p>
<i>maudit</i> performs static analysis of the Java source code and byte
code files to find and report
errors of style and potential problems related to performance, maintenance
and robustness.
. As a convenience, a stylesheet is given in <tt>etc</tt> directory, so that
an HTML report can be generated from the XML file.
</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">tofile</td>
<td valign="top">The XML file to which the Audit result should be written
to.</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">metamatahome</td>
<td valign="top">The home directory containing the Metamata
distribution.</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">fix</td>
<td valign="top">
Automatically fix certain errors (those marked as fixable in the
manual).
</td>
<td valign="top" align="center">No.Default to false.</td>
</tr>
<tr>
<td valign="top">list</td>
<td valign="top">
Creates listing file for each audited file. A .maudit file will be
generated in the
same location as the source file.
</td>
<td valign="top" align="center">No. Default to false.</td>
</tr>
<tr>
<td valign="top">unused</td>
<td valign="top">
Finds declarations unused in search paths. It will look for unused
global declarations
in the source code within a use domain specified by the
<tt>searchpath</tt> element.
</td>
<td valign="top" align="center">No. Default to false.</td>
</tr>
<tr>
<td valign="top">maxmemory</td>
<td valign="top">Set the maximum memory for the JVM. this is a convenient
way to set the -mx or -Xmx argument.</td>
<td valign="top" align="center">No</td>
</tr>
</table>
<h3>Nested elements</h3>
<h4>jvmarg</h4>
<p>Additional parameters may be passed to the VM via nested
<code><jvmarg></code>
attributes. <code><jvmarg></code> allows all attributes described in <a
href="index.html#arg">Command
line arguments</a>.</p>
<h4>classpath</h4>
<p>Sets class path (also source path unless one explicitly set). Overrides
METAPATH/CLASSPATH environment variables. The <tt>classpath</tt> element
represents a <a href="../#path">PATH like
structure</a>.</p>
<h4>sourcepath</h4>
<p>Sets source path. Overrides the SOURCEPATH environment variable. The
<tt>sourcepath</tt> element represents a <a
href="../coreTypes/fileset.htmlindex.html#path">PATH like
structure</a>.</p>
<h4>sourcepath</h4>
<p>Sets the search path to use as the use domain when looking for unused
global declarations. The <tt>searchpath</tt> element represents a <a
href="../coreTypes/fileset.htmlindex.html#path">PATH like
structure</a>.</p>
<h4>fileset</h4>
<p>Sets the Java files to audit via a <a
href="index.html#fileset">FILESET</a> structure.
Whatever the filter is, only the files that ends with <i>.java</i> will be
included for processing.
Note that the base directory used for the fileset MUST be the root of the
source files otherwise
package names deduced from the file path will be incorrect.
</p>
<h3>Example</h3>
<pre> <maudit
tofile="c:/metamata/examples/auditexamples/audit.xml"
metamatahome="c:/metamata" fix="yes">
<classpath>
<pathelement
location="c:/metamata/examples/auditexamples"/>
</classpath>
<sourcepath>
<pathelement
location="c:/metamata/examples/auditexamples"/>
</classpath>
<fileset dir="c:/metamata/examples/auditexamples">
<include name="*.java"/>
<fileset>
</maudit></pre>
<p>
This invokes Metamata Audit installed in <tt>c:/metamata</tt> on the audit
examples
and fix automatically the fixable errors.
</p>
<h3>Generating a report</h3>
As a convenience, there is an XSL file(maudit-frames.xsl) that allows you to
generate a full framed HTML report of the metrics.
You can find it in the <i>etc</i> directory of Ant. As it uses the Xalan
extensions, you will need
BSF, Xalan and Xerces to run it. The stylesheet takes an <i>output.dir</i>
parameter (otherwise it will be generated
in the current directory), it can be run in Ant as follows:
<pre>
<java classname="org.apache.xalan.xslt.Process">
<param value="-IN"/>
<param value="${metrics.xml}"/>
<param value="-XSL"/>
<param value="maudit-frames.xsl"/>
<param value="-PARAM"/>
<param value="output.dir"/>
<param value="&quot;'${report.dir}'&quot;"/>
</java>
</pre>
<hr>
<hr>
1.1 jakarta-ant/docs/manual/OptionalTasks/mmetrics.html
Index: mmetrics.html
===================================================================
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>MMetrics Task</title>
</head>
<body>
<h2>MMetrics</h2>
<p>by</p>
<ul>
<li>Stephane Bailliez (<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>)</li>
</ul>
<h3>Requirements</h3>
<p>This task requires Metamata Development environment 2.0/Webgain Quality
Analyzer 2.0.
An evaluation version is available at <a
href="http://www.webgain.com/products/quality_analyzer">Webgain</a>.
(Though you will not be able to use Metrics from the command line if you do
not have a registered version).
You also need a TRaX compliant processor(such as <a
href="http://xml.apache.org/xalan-j">Xalan 2.x</a>) via JAXP 1.1</p>
<h3>Description</h3>
<p>
Invokes the Metamata Metrics / WebGain Quality Analyzer</a> source code
analyzer on a set of Java files.
</p>
<p>
<i>mmetrics</i> will compute the metrics of a set of Java files and write
the results to an XML
file. As a convenience, a stylesheet is given in <tt>etc</tt> directory,
so that an HTML report can be generated from the XML file.
</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">metamatahome</td>
<td valign="top">The home directory containing the Metamata
distribution.</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">tofile</td>
<td valign="top">The XML were the resulting metrics will be written
to.</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">granularity</td>
<td valign="top">Metrics granularity of the source files. Must be either
<i>files</i> (compilation-units), <i>types</i> (types and
compilation-units) or <i>methods</i>
(methods, types and compilation-units).
</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">maxmemory</td>
<td valign="top">Set the maximum memory for the JVM. this is a convenient
way to set the -mx or -Xmx argument.</td>
<td valign="top" align="center">No</td>
</tr>
</table>
<h3>Nested elements</h3>
For specifying the source code to analyze, you can either use a <tt>path</tt>
or <tt>fileset</tt> elements (though a single path element is preferred, see
note below).</i>
<h4>jvmarg</h4>
<p>Additional parameters may be passed to the VM via nested
<code><jvmarg></code>
attributes. <code><jvmarg></code> allows all attributes described in <a
href="index.html#arg">Command
line arguments</a>.</p>
<h4>classpath</h4>
<p>Sets class path (also source path unless one explicitly set). Overrides
METAPATH/CLASSPATH environment variables. The <tt>classpath</tt> element
represents a <a href="index.html#path">PATH like
structure</a>.</p>
<h4>sourcepath</h4>
<p>Sets source path. Overrides the SOURCEPATH environment variable. The
<tt>sourcepath</tt> element represents a <a href="index.html#path">PATH like
structure</a>.</p>
<h4>path</h4>
<p>Sets the list of directories to analyze the code for metrics.;It
represents a <a href="index.html#path">PATH structure</a>.</p>
<h4>fileset</h4>
<p>Sets a set of files to analyze for metrics.source It represents a <a
href="index.html#fileset">FILESET structure</a>.</p>
<p>
<font color="#FF0000">
Note: For the sake of readability, it is highly recommended to analyze for a
single unique directory instead than
using filesets or several directories. Otherwise there will be multiple
metrics outputs without any way to know
what metrics refers to what source. Chance are also that the XML handler that
does some heuristic will be confused
by the different outputs.
</font>
</p>
<h3>Example</h3>
<pre> <mmetrics target="mmetrics.xml"
metamatahome="c:/metamata"
granularity="methods">
<classpath>
<pathelement
location="c:/metamata/examples/metricsexamples"/>
</classpath>
<sourcepath>
<pathelement
location="c:/metamata/examples/metricsexamples"/>
</sourcepath>
<path>
<pathelement
location="c:/metamata/examples/metricsexamples"/>
</path>
</mmetrics></pre>
<p>
This invokes Metamata Metrics installed in <tt>c:/metamata</tt> on the
metrics example.
(Note that here, classpath and sourcepath are not normally not needed)
</p>
<h3>Generating a report</h3>
As a convenience, there is an XSL file(mmetrics-frames.xsl) that allows you
to generate a full framed HTML report of the metrics.
You can find it in the <i>etc</i> directory of Ant. As it uses the Xalan
extensions, you will need
BSF, Xalan and Xerces to run it. The stylesheet takes an <i>output.dir</i>
parameter (otherwise it will be generated
in the current directory), it can be run in Ant as follows:
<pre>
<java classname="org.apache.xalan.xslt.Process">
<param value="-IN"/>
<param value="${metrics.xml}"/>
<param value="-XSL"/>
<param value="mmetrics-frames.xsl"/>
<param value="-PARAM"/>
<param value="output.dir"/>
<param value="&quot;'${report.dir}'&quot;"/>
</java>
</pre>
<hr>