How it Works

Applying jMetra to a software product is done in three distinct phases. The following outlines each phases:

Step 1. Collect Code Metrics

Collecting metrics for a set of source code and JSPs. You tell jMetra where to find your JSPs and Java code and it produces a single XML file that contains all the metrics for your project source code. Typically this would be done in conjunction is with a build process. Over time you can build up a number of these "build" metrics files. You can explicitly give them labels, or time-based labels may also be generated. So, over time you may have a number of metrics XML files for different metrics collections during your project. For example,

2001.03.25.214020metrics.xml
2001.03.28.092310metrics.xml
2001.04.10.151401metrics.xml
2001.04.15.161909metrics.xml

would show examples for metrics across four different points in time. If no label or timestamp is specified, the default action is to use the current time, and automatically label the metrics file with a timestamp name. Within these xml files one can see the straightforward xml format used for the metrics.

Step 2. Aggregate Metrics over Time

To analyze metrics through time, all the metrics data is best organized so metrics for a particular class or package through time are grouped together in the same file. jMetra provides the capability to aggregate metrics from different points in time into an "aggregate format". This format has a metrics XML file for every class where each file holds all the metrics for that class across all the specified build files. That way the information is better suited for viewing and analyzing the evolution of each coded class over time. The individual files are produced in a directory structure that corresponds to the package for the classes, the same as it works for java classes. Example files for what gets produced would be

HelloWorldmetrics.xml
HelloHelpermetrics.xml

Where the HelloWorldmetrics.xml and HelloHelpermetrics.xml would correspond to metrics across builds for Java source code for HelloWorld.java and HelloHelper.java. The metrics.xml file would contain metrics across all the build files for the package that the HelloWord.java and HelloHelper.java are in. Typically, all the aggregate files are located under a subdirectory within the a root metrics directory where you have chosen to output everything jMetra generates for your project.

Step 3. Produce HTML documentation for Metrics

The final step in using jMetra is producing documentation that can be easily browsered for analysis. The utility JMetraDoc is used to take the aggregate metrics files and produce a collection of HTML files layed out in a JavaDoc style for viewing metrics. Metrics are viewed as a collection of graphs for each class and package in the project. As with JavaDoc, the index page is entitled overview-summary.html.