org.apache.tools.ant.taskdefs.optional.sitraka
Class XMLReport

java.lang.Object
  |
  +--org.apache.tools.ant.taskdefs.optional.sitraka.XMLReport

public class XMLReport
extends java.lang.Object

Little hack to process XML report from JProbe. It will fix some reporting errors from JProbe 3.0 and makes use of a reference classpath to add classes/methods that were not reported by JProbe as being used (ie loaded)

Author:
Stephane Bailliez

Field Summary
protected  java.util.Hashtable classMap
          mapping classname / class node for faster access
protected  java.io.File file
          the XML file to process just from CovReport
protected  ReportFilters filters
          method filters
protected  java.io.File jprobeHome
          jprobe home path.
protected  java.util.Hashtable pkgMap
          mapping package name / package node for faster access
protected  org.w3c.dom.Document report
          parsed document
protected  Task task
          task caller, can be null, used for logging purpose
 
Constructor Summary
XMLReport(java.io.File file)
          create a new XML report, logging will be on stdout
XMLReport(Task task, java.io.File file)
          create a new XML report, logging done on the task
 
Method Summary
protected  org.w3c.dom.Element createClassElement(ClassFile classFile)
          create an empty class element with its default cov.data (0)
 org.w3c.dom.Document createDocument(java.lang.String[] classPath)
          create the whole new document
protected  org.w3c.dom.Element createMethodElement(MethodInfo method)
          create an empty method element with its cov.data values
protected  void createNodeMaps()
          create node maps so that we can access node faster by their name
protected  org.w3c.dom.Element createPackageElement(java.lang.String pkgname)
          create an empty package element with its default cov.data (0)
protected  org.w3c.dom.Element[] getClasses(org.w3c.dom.Element pkg)
           
protected  org.w3c.dom.Element getCovDataChild(org.w3c.dom.Element parent)
           
protected  java.util.Vector getFilteredMethods(ClassFile classFile)
           
protected  java.util.Hashtable getMethods(org.w3c.dom.Element clazz)
           
protected  java.lang.String getMethodSignature(ClassFile clazz, MethodInfo method)
          Convert to a CovReport-like signature ie, .()
protected  java.lang.String getMethodSignature(MethodInfo method)
          JProbe does not put the java.lang prefix for classes in this package, so used this nice method so that I have the same signature for methods
protected  org.w3c.dom.Element[] getPackages(org.w3c.dom.Element snapshot)
           
 void log(java.lang.String message)
           
static void main(java.lang.String[] args)
           
protected  void removeAbstractMethods(ClassFile classFile, org.w3c.dom.Element classNode)
          Do additional work on an element to remove abstract methods that are reported by JProbe 3.0
protected  void serializeClass(ClassFile classFile)
          serialize a classfile into XML
 void setJProbehome(java.io.File home)
          set the JProbe home path.
 void setReportFilters(ReportFilters filters)
          set the
protected  void update()
          update the count of the XML, that is accumulate the stats on methods, classes and package so that the numbers are valid according to the info that was appended to the XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

task

protected Task task
task caller, can be null, used for logging purpose

file

protected java.io.File file
the XML file to process just from CovReport

jprobeHome

protected java.io.File jprobeHome
jprobe home path. It is used to get the DTD

report

protected org.w3c.dom.Document report
parsed document

pkgMap

protected java.util.Hashtable pkgMap
mapping package name / package node for faster access

classMap

protected java.util.Hashtable classMap
mapping classname / class node for faster access

filters

protected ReportFilters filters
method filters
Constructor Detail

XMLReport

public XMLReport(java.io.File file)
create a new XML report, logging will be on stdout

XMLReport

public XMLReport(Task task,
                 java.io.File file)
create a new XML report, logging done on the task
Method Detail

setJProbehome

public void setJProbehome(java.io.File home)
set the JProbe home path. Used to get the DTD

setReportFilters

public void setReportFilters(ReportFilters filters)
set the

createNodeMaps

protected void createNodeMaps()
create node maps so that we can access node faster by their name

createDocument

public org.w3c.dom.Document createDocument(java.lang.String[] classPath)
                                    throws java.lang.Exception
create the whole new document

getMethodSignature

protected java.lang.String getMethodSignature(MethodInfo method)
JProbe does not put the java.lang prefix for classes in this package, so used this nice method so that I have the same signature for methods

getMethodSignature

protected java.lang.String getMethodSignature(ClassFile clazz,
                                              MethodInfo method)
Convert to a CovReport-like signature ie, .()

removeAbstractMethods

protected void removeAbstractMethods(ClassFile classFile,
                                     org.w3c.dom.Element classNode)
Do additional work on an element to remove abstract methods that are reported by JProbe 3.0

createMethodElement

protected org.w3c.dom.Element createMethodElement(MethodInfo method)
create an empty method element with its cov.data values

createPackageElement

protected org.w3c.dom.Element createPackageElement(java.lang.String pkgname)
create an empty package element with its default cov.data (0)

createClassElement

protected org.w3c.dom.Element createClassElement(ClassFile classFile)
create an empty class element with its default cov.data (0)

serializeClass

protected void serializeClass(ClassFile classFile)
serialize a classfile into XML

getFilteredMethods

protected java.util.Vector getFilteredMethods(ClassFile classFile)

update

protected void update()
update the count of the XML, that is accumulate the stats on methods, classes and package so that the numbers are valid according to the info that was appended to the XML.

getCovDataChild

protected org.w3c.dom.Element getCovDataChild(org.w3c.dom.Element parent)

getMethods

protected java.util.Hashtable getMethods(org.w3c.dom.Element clazz)

getClasses

protected org.w3c.dom.Element[] getClasses(org.w3c.dom.Element pkg)

getPackages

protected org.w3c.dom.Element[] getPackages(org.w3c.dom.Element snapshot)

log

public void log(java.lang.String message)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.