org.jcoderz.phoenix.report
Class AbstractReportReader

java.lang.Object
  extended by org.jcoderz.phoenix.report.AbstractReportReader
All Implemented Interfaces:
ValidationEventHandler, ReportReader
Direct Known Subclasses:
CheckstyleReportReader, CoberturaReportReader, CpdReportReader, EmmaReportReader, FindBugsReportReader, JcoderzReport, JCoverageReportReader, PmdReportReader, SourceDirectoryReader

public abstract class AbstractReportReader
extends Object
implements ReportReader, ValidationEventHandler

Base Report Reader class. Every report reader must extend from this class.

Author:
Michael Griffel

Method Summary
protected abstract  Map<ResourceInfo,List<Item>> getItems()
          Returns the items of the input report as a Map of filename string and of the type Item (org.jcoderz.phoenix.report.jaxb.Item).
 Marshaller getMarshaller()
          Returns a Marshaller for this report reader.
 Unmarshaller getUnmarshaller()
          Returns a Unmarshaller for this report reader.
 boolean handleEvent(ValidationEvent e)
          
 void merge(Map<ResourceInfo,List<Item>> toItems)
          Merges the items of the input report as a Map of filename string and of the type Item (org.jcoderz.phoenix.report.jaxb.Item) into the given item Map.
protected  String normalizeFileName(String filename)
          Normalize the filename (platform dependend).
 Object unmarshall(InputStream in)
          Reads the XML data from the given InputStream in and unmarshal it to the corresponding JAXB object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jcoderz.phoenix.report.ReportReader
parse
 

Method Detail

getMarshaller

public final Marshaller getMarshaller()
                               throws JAXBException
Returns a Marshaller for this report reader.

Returns:
a Marshaller for this report reader.
Throws:
JAXBException - if the creation of the marshaller failed.

getUnmarshaller

public final Unmarshaller getUnmarshaller()
                                   throws JAXBException
Returns a Unmarshaller for this report reader.

Returns:
a Unmarshaller for this report reader.
Throws:
JAXBException - if the creation of the unmarshaller failed.

unmarshall

public final Object unmarshall(InputStream in)
Reads the XML data from the given InputStream in and unmarshal it to the corresponding JAXB object. This method uses a native XMLReader to parse the XML data using a simple EntityResolver that resolves any entity to an empty string.

Parameters:
in - the input stream to read the XML data from.
Returns:
the JAXB object.

merge

public final void merge(Map<ResourceInfo,List<Item>> toItems)
                 throws JAXBException
Merges the items of the input report as a Map of filename string and of the type Item (org.jcoderz.phoenix.report.jaxb.Item) into the given item Map.

Specified by:
merge in interface ReportReader
Parameters:
toItems - the items that should be merged with the report's input items.
Throws:
JAXBException - if an JAXB exception occurs.

getItems

protected abstract Map<ResourceInfo,List<Item>> getItems()
                                                  throws JAXBException
Returns the items of the input report as a Map of filename string and of the type Item (org.jcoderz.phoenix.report.jaxb.Item).

Returns:
the items of the input report as a List of the type Item.
Throws:
JAXBException - if an JAXB exception occures.

handleEvent

public final boolean handleEvent(ValidationEvent e)

Specified by:
handleEvent in interface ValidationEventHandler

normalizeFileName

protected final String normalizeFileName(String filename)
Normalize the filename (platform dependend).

Parameters:
filename - the filename.
Returns:
the normalized filename.


Copyright 2007 The jCoderZ Project.