1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
public static synchronized IReportEngine getReportEngine()
throws Exception {
if (reportEngine == null) {
try {
EngineConfig config = new EngineConfig();
config.setLogConfig(Configuration.BIRT_LOG_DIRECTORY,
getBIRTLogLevel(Configuration.BIRT_LOG_LEVEL));
config.setResourcePath(Configuration.BIRT_RESOURCE_PATH);
config.setLogRollingSize(Configuration.BIRT_LOG_ROLLING_SIZE);
config.setLogMaxBackupIndex(Configuration.BIRT_LOG_MAX_BACKUP_INDEX);
config.getAppContext().put(EngineConstants.WEBAPP_CLASSPATH_KEY,"");
config.getAppContext().put(EngineConstants.APPCONTEXT_DATASET_CACHE_OPTION,true);
config.getAppContext().put(DataEngine.DATASET_CACHE_OPTION,true);
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
reportEngine = factory.createReportEngine(config);
log.debug("BIRT report engine was created");
} catch (Exception e) {
log.error("BIRT report engine creation failed");
throw e;
}
if (reportEngine == null) {
log.error("BIRT report engine is null after its creation.");
}
}
return reportEngine;
} |
Partager