gov.nasa.pds.validate.report
Class Report

java.lang.Object
  extended by gov.nasa.pds.validate.report.Report
Direct Known Subclasses:
FullReport

public abstract class Report
extends Object

Abstract class that represents a Report for the Vtool command line API. This class handles basic utilities for reporting and calling customized portions of reports.

Author:
pramirez

Constructor Summary
Report()
          Default constructor to initialize report variables.
 
Method Summary
 void addConfiguration(String configuration)
          Adds the string supplied to the configuration section in the heading of the report.
 void addParameter(String parameter)
          Adds the string supplied to the parameter section in the heading of the report.
 gov.nasa.pds.tools.label.ExceptionType getExceptionType()
           
 int getNumFailed()
           
 int getNumPassed()
           
 int getNumSkipped()
           
 int getTotalErrors()
           
 int getTotalInfos()
           
 int getTotalWarnings()
           
 boolean hasErrors()
           
 boolean hasWarnings()
           
 void printFooter()
          Prints out the footer or the report and calls the customized footer section.
protected abstract  void printFooter(PrintWriter writer)
          Allows customization of the footer section of the report
 void printHeader()
          This method will display the default header for the Vtool command line library reports.
protected abstract  void printHeader(PrintWriter writer)
          Allows a Report to customize the header portion of the Report if necessary.
protected abstract  void printRecordMessages(PrintWriter writer, Status status, URI sourceUri, List<gov.nasa.pds.tools.label.LabelException> problems)
          Allows a report to customize how it handles reporting on a particular label.
protected  void printRecordSkip(PrintWriter writer, URI sourceUri, Exception exception)
           
 Status record(URI sourceUri, gov.nasa.pds.tools.label.LabelException problem)
           
 Status record(URI sourceUri, List<gov.nasa.pds.tools.label.LabelException> problems)
          Allows a report to change how they manage reporting on a given file that has been parsed and validated.
 void setExceptionType(gov.nasa.pds.tools.label.ExceptionType ExceptionType)
          Anything at or above the level will be reported.
 void setOutput(File file)
          Handles writing a Report to a File.
 void setOutput(OutputStream os)
          Handle writing a Report to an OutputStream.
 void setOutput(Writer writer)
          Handles writing a Report to the writer interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Report

public Report()
Default constructor to initialize report variables. Initializes default output to System.out if you wish to write the report to a different sourse use the appropriate setOutput method.

Method Detail

setOutput

public final void setOutput(Writer writer)
Handles writing a Report to the writer interface. This is is useful if someone would like to put the contents of the Report to something such as StringWriter.

Parameters:
writer - which the report will be written to

setOutput

public final void setOutput(OutputStream os)
Handle writing a Report to an OutputStream. This is useful to get the report to print to something such as System.out

Parameters:
os - stream which the report will be written to

setOutput

public final void setOutput(File file)
                     throws IOException
Handles writing a Report to a File.

Parameters:
file - which the report will output to
Throws:
IOException - if there is an issue in writing the report to the file

printHeader

public void printHeader()
This method will display the default header for the Vtool command line library reports. This is the standard header across all reports.


addParameter

public void addParameter(String parameter)
Adds the string supplied to the parameter section in the heading of the report.

Parameters:
parameter - in a string form that represents something that was passed in when the tool was run

addConfiguration

public void addConfiguration(String configuration)
Adds the string supplied to the configuration section in the heading of the report.

Parameters:
configuration - in a string form that represents a configuration that was used during parsing and validation

printHeader

protected abstract void printHeader(PrintWriter writer)
Allows a Report to customize the header portion of the Report if necessary.

Parameters:
writer - passed down to write header contents to

record

public Status record(URI sourceUri,
                     gov.nasa.pds.tools.label.LabelException problem)

record

public Status record(URI sourceUri,
                     List<gov.nasa.pds.tools.label.LabelException> problems)
Allows a report to change how they manage reporting on a given file that has been parsed and validated. Also handles generating a status for a file and generating some summary statistics.

Parameters:
sourceUri - reference to the file that is being reported on
problems - the set of issues found with the file. to be reported on
Returns:
status of the file (i.e. PASS, FAIL, or SKIP)

printRecordSkip

protected void printRecordSkip(PrintWriter writer,
                               URI sourceUri,
                               Exception exception)

printRecordMessages

protected abstract void printRecordMessages(PrintWriter writer,
                                            Status status,
                                            URI sourceUri,
                                            List<gov.nasa.pds.tools.label.LabelException> problems)
Allows a report to customize how it handles reporting on a particular label.

Parameters:
writer - passed on to write customized messages to
sourceUri - reference to the file that is being reported on
problems - which to report on for this source

printFooter

public void printFooter()
Prints out the footer or the report and calls the customized footer section.


printFooter

protected abstract void printFooter(PrintWriter writer)
Allows customization of the footer section of the report

Parameters:
writer - passed on to writer customized footer contents

getNumPassed

public int getNumPassed()
Returns:
number of labels that passed (had no errors)

getNumFailed

public int getNumFailed()
Returns:
number of labels that failed (had one or more errors)

getNumSkipped

public int getNumSkipped()
Returns:
number of files that were not recognized as a label

getTotalErrors

public int getTotalErrors()
Returns:
total number of errors that were found across all labels inspected. Will not count errors generated from files that were considered skipped.

getTotalWarnings

public int getTotalWarnings()
Returns:
total number of warning that were found across all labels inspected. Will not count warnings generated from files that were considered skipped.

getTotalInfos

public int getTotalInfos()
Returns:
total number of info messages that were found across all labels inspected. Will not count info messages from files that were considered skipped.

hasErrors

public boolean hasErrors()
Returns:
flag indicating if errors were found in the inspected files

hasWarnings

public boolean hasWarnings()
Returns:
flag indicating if warnings were found in the inspected files

setExceptionType

public void setExceptionType(gov.nasa.pds.tools.label.ExceptionType ExceptionType)
Anything at or above the level will be reported. Default ExceptionType level is info and above

Parameters:
ExceptionType - level on which items will be reported

getExceptionType

public gov.nasa.pds.tools.label.ExceptionType getExceptionType()
Returns:
ExceptionType level of items that will be reported on. Anything at or above this level will be reported on


Copyright © 2010-2013 Planetary Data System. All Rights Reserved.