org.jcoderz.phoenix.report
Class GenericReportReader

java.lang.Object
  extended by org.jcoderz.phoenix.report.GenericReportReader
All Implemented Interfaces:
ReportReader

public final class GenericReportReader
extends Object
implements ReportReader

Reads reports with format definitions described in the finding-type-format-definition.xds. To find the finding type format definition for requested format the following locations are used: The name is converted to lower case. A file name.xml is searched in the org.jcoderz.phoenix.report.ftf package. If this is not found the file is searched in the ftf directory. The directory must be available through the classpath.

Author:
Andreas Mandel

Method Summary
 Item detectFindingTypeForMessage(String message)
          Reads the given message and tries to find a matching finding type.
static GenericReportReader initialize(Origin findingType)
          Initializes the selected finding type.
 void merge(Map<ResourceInfo,List<Item>> items)
          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.
 void parse(File f)
          Parses the report file/directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

public static GenericReportReader initialize(Origin findingType)
Initializes the selected finding type. Might return null if the initialization fails. CHECKME: Should return a null object?

Parameters:
findingType - the type to load.
Returns:
the loaded finding type.

parse

public void parse(File f)
           throws JAXBException
Parses the report file/directory.

Specified by:
parse in interface ReportReader
Parameters:
f - input XML report or directory.
Throws:
JAXBException - if an JAXB exception occures.

merge

public void merge(Map<ResourceInfo,List<Item>> items)
           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:
items - the items that should be merged with the report's input items.
Throws:
JAXBException - if an JAXB exception occurs.

detectFindingTypeForMessage

public Item detectFindingTypeForMessage(String message)
                                 throws JAXBException
Reads the given message and tries to find a matching finding type.

Parameters:
message - the message to read.
Returns:
the finding type matching to the message, or null if no such type was found.
Throws:
JAXBException - if item creation fails.


Copyright 2007 The jCoderZ Project.