Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.taskdefs.optional.metamata
Class MMetricsStreamHandler

    java.lang.Object
      |
      +--org.apache.tools.ant.taskdefs.optional.metamata.MMetricsStreamHandler

All Implemented Interfaces:
  ExecuteStreamHandler

public class MMetricsStreamHandler
extends java.lang.Object
implements ExecuteStreamHandler

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.

Method Summary
`protected org.xml.sax.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 java.lang.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(java.lang.String line)` Process a metrics line.
`void` | `setProcessErrorStream(java.io.InputStream p1)` Ignore.
`void` | `setProcessInputStream(java.io.OutputStream p1)` Ignore.
`void` | `setProcessOutputStream(java.io.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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### setProcessInputStream

    public void setProcessInputStream(java.io.OutputStream p1)
                               throws java.io.IOException

  Ignore.

  Specified by:
    `setProcessInputStream` in interface `ExecuteStreamHandler`
  Parameters:
    `p1` - output stream to write to the standard input stream of the subprocess
    `java.io.IOException`

### setProcessErrorStream

    public void setProcessErrorStream(java.io.InputStream p1)
                               throws java.io.IOException

  Ignore.

  Specified by:
    `setProcessErrorStream` in interface `ExecuteStreamHandler`
  Parameters:
    `p1` - input stream to read from the error stream from the subprocess
    `java.io.IOException`

### setProcessOutputStream

    public void setProcessOutputStream(java.io.InputStream is)
                                throws java.io.IOException

  Set the inputstream

  Specified by:
    `setProcessOutputStream` in interface `ExecuteStreamHandler`
  Parameters:
    `is` - input stream to read from the error stream from the subprocess
    `java.io.IOException`

### start

    public void start()
               throws java.io.IOException

  Description copied from interface: `ExecuteStreamHandler`
  Start handling of the streams.

  Specified by:
    `start` in interface `ExecuteStreamHandler`
    `java.io.IOException`

### stop

    public void stop()

  Pretty dangerous business here.

  Specified by:
    `stop` in interface `ExecuteStreamHandler`

### parseOutput

    protected void parseOutput()
                        throws java.io.IOException,
                               org.xml.sax.SAXException

  read each line and process it

    `java.io.IOException`
    `org.xml.sax.SAXException`

### processLine

    protected void processLine(java.lang.String line)
                        throws org.xml.sax.SAXException

  Process a metrics line. If the metrics is invalid and that this is not the header line, it is display as info.

  Parameters:
    `line` - the line to process, it is normally a line full of metrics.
    `org.xml.sax.SAXException`

### startElement

    protected void startElement(org.apache.tools.ant.taskdefs.optional.metamata.MetricsElement elem)
                         throws org.xml.sax.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.

  Parameters:
    `elem` - the element to process.
  Throws:
    `org.xml.sax.SAXException` - thrown if there is a problem when sending SAX events.

### getConstructType

    protected java.lang.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.

  Parameters:
    `elem` - the metrics element to guess for its type.
  Returns:
    the type of the metrics element, either PACKAGE, FILE, CLASS or METHOD.

### createAttributes

    protected org.xml.sax.Attributes createAttributes(org.apache.tools.ant.taskdefs.optional.metamata.MetricsElement elem)

  Create all attributes of a MetricsElement skipping those who have an empty string

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.