org.apache.tools.ant.taskdefs.optional.metamata
Class MMetricsStreamHandler
java.lang.Object
org.apache.tools.ant.taskdefs.optional.metamata.MMetricsStreamHandler
- ExecuteStreamHandler
public class MMetricsStreamHandler
extends java.lang.Object
A handy metrics handler. Most of this code was done only with the
screenshots on the documentation since the evaluation version as
of this writing does not allow to save metrics or to run it via
command line.
This class can be used to transform a text file or to process the
output stream directly.
protected Attributes | createAttributes(org.apache.tools.ant.taskdefs.optional.metamata.MetricsElement elem) - Create all attributes of a MetricsElement skipping those who have an
empty string
|
protected String | getConstructType(org.apache.tools.ant.taskdefs.optional.metamata.MetricsElement elem) - return the construct type of the element.
|
protected void | parseOutput() - read each line and process it
|
protected void | processLine(String line) - Process a metrics line.
|
void | setProcessErrorStream(InputStream p1) - Ignore.
|
void | setProcessInputStream(OutputStream p1) - Ignore.
|
void | setProcessOutputStream(InputStream is) - Set the inputstream
|
void | start() - Start handling of the streams.
|
protected void | startElement(org.apache.tools.ant.taskdefs.optional.metamata.MetricsElement elem) - Start a new construct.
|
void | stop() - Pretty dangerous business here.
|
createAttributes
protected Attributes createAttributes(org.apache.tools.ant.taskdefs.optional.metamata.MetricsElement elem)
Create all attributes of a MetricsElement skipping those who have an
empty string
getConstructType
protected String getConstructType(org.apache.tools.ant.taskdefs.optional.metamata.MetricsElement elem)
return the construct type of the element. We can hardly recognize the
type of a metrics element, so we are kind of forced to do some black
magic based on the name and indentation to recognize the type.
elem
- the metrics element to guess for its type.
- the type of the metrics element, either PACKAGE, FILE, CLASS or
METHOD.
parseOutput
protected void parseOutput()
throws IOException,
SAXException
read each line and process it
processLine
protected void processLine(String line)
throws SAXException
Process a metrics line. If the metrics is invalid and that this is not
the header line, it is display as info.
line
- the line to process, it is normally a line full of metrics.
startElement
protected void startElement(org.apache.tools.ant.taskdefs.optional.metamata.MetricsElement elem)
throws SAXException
Start a new construct. Elements are popped until we are on the same
parent node, then the element type is guessed and pushed on the
stack.
elem
- the element to process.
Copyright B) 2000-2005 Apache Software Foundation. All Rights Reserved.