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;
}
Aggregations