Class Report

    • Field Detail

      • parameters

        protected final List<String> parameters
      • configurations

        protected final List<String> configurations
    • 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​(File source,
                             List<gov.nasa.pds.tools.LabelParserException> problems)
      • record

        public Status record​(URI sourceUri,
                             List<gov.nasa.pds.tools.LabelParserException> 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)
      • filterProblems

        protected List<gov.nasa.pds.tools.LabelParserException> filterProblems​(List<gov.nasa.pds.tools.LabelParserException> problems)
      • record

        public Status record​(List<String> sourceUris,
                             List<gov.nasa.pds.tools.LabelParserException> 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:
        sourceUris - 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)
      • printRecordMessages

        protected abstract void printRecordMessages​(PrintWriter writer,
                                                    Status status,
                                                    URI sourceUri,
                                                    List<gov.nasa.pds.tools.LabelParserException> 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
      • printRecordMessages

        protected abstract void printRecordMessages​(PrintWriter writer,
                                                    Status status,
                                                    List<String> sourceUris,
                                                    List<gov.nasa.pds.tools.LabelParserException> problems)
      • 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
      • setLevel

        public void setLevel​(gov.nasa.pds.tools.constants.Constants.Severity severity)
        Anything at or above the level will be reported. Default severity level is info and above
        Parameters:
        severity - level on which items will be reported
      • getLevel

        public gov.nasa.pds.tools.constants.Constants.Severity getLevel()
        Returns:
        severity level of items that will be reported on. Anything at or above this level will be reported on