Search in sources :

Example 6 with ReportGenerator

use of org.pentaho.reporting.engine.classic.core.modules.parser.base.ReportGenerator in project pentaho-platform by pentaho.

the class JFreeReportLoadComponent method getReportFromJar.

private MasterReport getReportFromJar() throws Exception {
    MasterReport report;
    final IActionSequenceResource resource = getResource(AbstractJFreeReportComponent.DATACOMPONENT_JARINPUT);
    final ClassLoader loader = ReportUtils.createJarLoader(getSession(), resource);
    if (loader == null) {
        throw new Exception(Messages.getInstance().getString(// $NON-NLS-1$
        "JFreeReportLoadComponent.ERROR_0035_COULD_NOT_CREATE_CLASSLOADER"));
    }
    String reportLocation = getInputStringValue(AbstractJFreeReportComponent.REPORTLOAD_REPORTLOC);
    URL resourceUrl = loader.getResource(reportLocation);
    if (resourceUrl == null) {
        throw new Exception(// $NON-NLS-1$
        Messages.getInstance().getErrorString(// $NON-NLS-1$
        "JFreeReport.ERROR_0016_REPORT_RESOURCE_INVALID", reportLocation, resource.getAddress()));
    }
    try {
        ReportGenerator generator = ReportGenerator.getInstance();
        report = generator.parseReport(resourceUrl, getDefinedResourceURL(resourceUrl));
    } catch (Exception ex) {
        throw new Exception(Messages.getInstance().getErrorString("JFreeReport.ERROR_0007_COULD_NOT_PARSE", reportLocation), // $NON-NLS-1$
        ex);
    }
    return report;
}
Also used : MasterReport(org.pentaho.reporting.engine.classic.core.MasterReport) ReportGenerator(org.pentaho.reporting.engine.classic.core.modules.parser.base.ReportGenerator) ResourceException(org.pentaho.reporting.libraries.resourceloader.ResourceException) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) URL(java.net.URL) IActionSequenceResource(org.pentaho.platform.api.engine.IActionSequenceResource)

Aggregations

ReportGenerator (org.pentaho.reporting.engine.classic.core.modules.parser.base.ReportGenerator)6 MasterReport (org.pentaho.reporting.engine.classic.core.MasterReport)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 IOException (java.io.IOException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 URL (java.net.URL)4 IActionSequenceResource (org.pentaho.platform.api.engine.IActionSequenceResource)4 ResourceException (org.pentaho.reporting.libraries.resourceloader.ResourceException)4 InputSource (org.xml.sax.InputSource)4 FileNotFoundException (java.io.FileNotFoundException)2 PrintException (javax.print.PrintException)2 IActionResource (org.pentaho.actionsequence.dom.IActionResource)2 JFreeReportAction (org.pentaho.actionsequence.dom.actions.JFreeReportAction)2 IPentahoRequestContext (org.pentaho.platform.api.engine.IPentahoRequestContext)2 ReportProcessingException (org.pentaho.reporting.engine.classic.core.ReportProcessingException)2 ContentIOException (org.pentaho.reporting.libraries.repository.ContentIOException)2 ActionResource (org.pentaho.actionsequence.dom.ActionResource)1 IActionParameter (org.pentaho.platform.api.engine.IActionParameter)1