Class ReportConverter


  • public class ReportConverter
    extends Object
    A utility class for converting XML report definitions from the old format to the new format.
    Author:
    Thomas Morgner
    • Constructor Detail

      • ReportConverter

        public ReportConverter()
        Default constructor.
    • Method Detail

      • write

        public void write​(MasterReport report,
                          Writer w,
                          URL contentBase,
                          String encoding)
                   throws IOException,
                          ReportWriterException
        Writes a report in the new XML format.
        Parameters:
        report - the report.
        w - a character stream writer.
        contentBase - the content base for creating relative URLs.
        encoding - the encoding of the generated file.
        Throws:
        IOException - if there is an I/O problem.
        ReportWriterException - if there were problems while serializing the report definition.
      • findReport

        public URL findReport​(String name)
                       throws IOException
        Returns the URL of a report.
        Parameters:
        name - the report name.
        Returns:
        The URL (or null).
        Throws:
        IOException - if there is an I/O problem.
      • convertReport

        public void convertReport​(String inName,
                                  String outFile,
                                  String encoding)
                           throws IOException,
                                  ReportWriterException
        Parses a report from the old version of the XML report format, and writes a file in the new XML report format.
        Parameters:
        inName - the input report file.
        outFile - the output report file.
        encoding - the encoding of the generated file.
        Throws:
        IOException - if there is an I/O problem.
        ReportWriterException - if there is a problem writing the report.
      • convertReport

        public void convertReport​(File in,
                                  File out,
                                  String encoding)
                           throws IOException,
                                  ReportWriterException
        Parses a report from the old version of the XML report format, and writes a file in the new XML report format.
        Parameters:
        in - the input report file.
        out - the output report file.
        encoding - the encoding of the generated file.
        Throws:
        IOException - if there is an I/O problem.
        ReportWriterException - if there is a problem writing the report.
      • convertReport

        public void convertReport​(URL in,
                                  URL contentBase,
                                  Writer w,
                                  String encoding)
                           throws IOException,
                                  ReportWriterException
        Parses a report from the old version of the XML report format, and writes a file in the new XML report format.
        Parameters:
        in - the input resource from where to read the report
        contentBase - the contentbase where the new report will be stored.
        w - the report writer
        encoding - the encoding of the generated file.
        Throws:
        IOException - if there is an I/O problem.
        ReportWriterException - if there is a problem writing the report.
      • main

        public static void main​(String[] args)
                         throws IOException,
                                ReportWriterException
        The starting point for the conversion utility. The utility accepts two command line arguments, the first is the name of the input file (a report in the old format) and the second is the name of the output file (a report in the new format will be written to this file).
        Parameters:
        args - command line arguments.
        Throws:
        Exception - if there is any problem.
        IOException
        ReportWriterException