问题
Greetings, we are currently trying to integrate BIRT in our desktop standalone application, using samples from here.
The question is - how to avoid using the OSGi framework. Can we put all the required libraries and plugins in the resulting EAR without having to set the report engine home? Because our clients will not be happy about having to download additional runtime. And is there really a need for such a huge runtime (about 100 megabytes, I guess).
回答1:
Sorry, but there is really no way to run BIRT reports without running OSGi. It is possible to trim some of the modules if you are not using them. Charting for instance could be removed, but Charts won't work. Obviously you can remove the sample database, and the derby plugins that support it.
After those obvious items, it gets a lot more difficult to remove plugins.
回答2:
Since Birt 3.7, you can use the Birt POJO Runtime (you can check the Birt website for it).
The only thing you have to do is to not call EngineConfig.setEngineHome(engineHome)
If you follow the Birt website, your code will look like this:
try{
final EngineConfig config = new EngineConfig( );
//As of 3.7.2, BIRT now provides an OSGi and a POJO Runtime.
//config.setEngineHome( "C:\\birt-runtime-2_6_2\\birt-runtime-2_6_2\\ReportEngine" );
config.setLogConfig("c:/temp", Level.FINE);
Platform.startup( config );
//If using RE API in Eclipse/RCP application this is not needed.
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
IReportEngine engine = factory.createReportEngine( config );
engine.changeLogLevel( Level.WARNING );
}catch( Exception ex){
ex.printStackTrace();
}
// Run reports, etc.
...
// destroy the engine.
try
{
engine.destroy();
Platform.shutdown();
//Bugzilla 351052
RegistryProviderFactory.releaseDefault();
}catch ( EngineException e1 ){
// Ignore
}
来源:https://stackoverflow.com/questions/3598753/birt-without-osgi-framework