|
Re: How to deploy BIRT without an application server? [message #506658 is a reply to message #506573] |
Fri, 08 January 2010 14:55 |
|
Kunal,
If you are just using a POJO you should be able to start the OSGI
platform which will have to be located somewhere on your system and call
the report engine. Like:
IRunAndRenderTask task=null;
IReportEngine engine=null;
EngineConfig config = null;
try{
config = new EngineConfig( );
config.setBIRTHome(" C:\\birt\\birt-runtime-2_5_1\\birt-runtime-2_5_1\\ReportEngi ne ");
//very expensive, should only be done once
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(
IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign("Reports/JsInclude.rptdesign");
//Create task to run and render the report,
task = engine.createRunAndRenderTask(design);
task.setLocale(new Locale("en", "US"));
task.setParameterValue("parm1", "value2");
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFileName("output/resample/includejs.html");
options.setOutputFormat("HTML");
task.setRenderOption(options);
task.run();
task.close();
engine.destroy();
}catch( Exception ex){
ex.printStackTrace();
}
finally
{
Platform.shutdown( );
}
The only issue with this approach is that Platform startup and shutdown
is very expensive, so if you are can start it when it starts and shut it
down when its finished that is the best approach, then each POJO can
just create a new task, execute it and then close the task. Let you
startup code start the platform and create the engine.
Kunal Ashar wrote:
> Please forgive the newbie question.
>
> I'm attempting to use/deploy BIRT into my current web-based Java
> application. I'm using Eclipse as my development environment.
>
> However, my application *does not* use an application server. Instead,
> it relies on JSPs served by a traditional web server (Apache) with
> backend POJOs. Ideally, I'd like my JSPs to gather data from form field
> variables in a browser, pass them back to the POJOs, which would run the
> reporting tool, generate an HTML report file and serve it back to the
> the browser.
>
> Is it possible to integrate BIRT into such an environment? If so how? Is
> there a tutorial or a detailed set of instructions somewhere?
>
> Thanks in advance.
|
|
|
Powered by
FUDForum. Page generated in 0.04943 seconds