Home
Analytics
Changing the location of plugins folder from WEB-INF to WEB-INF/Birt??
kiranv
Hello All,<br />
<br />
I have a web application which is generating BIRT reports in different formats. It is working perfectly fine. <br />
I have placed the <strong class='bbc'><em class='bbc'>"platform"</em></strong> folder in <strong class='bbc'><em class='bbc'>"/WEB-INF"</em></strong> folder. However now I want the plugins folder to be moved from <strong class='bbc'><em class='bbc'>"/WEB-INF"</em></strong> to <strong class='bbc'><em class='bbc'>"/WEB-INF/BIRT "</em></strong> folder. Kindly let me know what changes I need to make in the Birt engine source code.<br />
<br />
My source code to instantiate BirtEngine is the usual way- (where platform folder is in WEB-INF )<br />
<br />
public static synchronized void initBirtEngine(ServletContext servletContext)<br />
{<br />
if (birtEngine == null) {<br />
IPlatformContext context = new PlatformServletContext(servletContext);<br />
EngineConfig config = new EngineConfig();<br />
HashMap appContext = config.getAppContext();<br />
<br />
appContext.put("PARENT_CLASSLOADER", BirtEngine.class.getClassLoader());<br />
config.setEngineHome("");<br />
config.setPlatformContext(context);<br />
config.setResourcePath(BirtEngine.class.getResource("/").getPath());<br />
config.setAppContext(appContext);<br />
try<br />
{<br />
Platform.startup(config);<br />
} catch (BirtException e) {<br />
// logger.error(e.getMessage(), e);<br />
}<br />
<br />
IReportEngineFactory factory = (IReportEngineFactory)Platform.createFactoryObject("org.eclipse.birt.report.engine.ReportEngineFactory");<br />
<br />
birtEngine = factory.createReportEngine(config);<br />
birtEngine.changeLogLevel(Level.WARNING);<br />
}<br />
}<br />
Find more posts tagged with
Comments
JasonW
Currently that is hardcoded in the PlatformServletContext class.
Either create your own implementation of the IPlatformContext interface (which is easy because it only needs one method - getHome which is the location of the plugins) or modify the existing one. Use the PlatformServletContext class as an example to implement in a web enviornment.
You can also use the PlatformFileContext but it does not handle web deployment in the same fashion as the PlatformServletContext class.
Once you implement your own, just set it in your code like:
IPlatformContext context = new MyPlatformServletContext( sc );
config.setPlatformContext( context );
Jason
kiranv
Hello Jason,
Sorry for the late reply. I was successful with both the approaches.
thnx for that..
My main intention was to run two separate engines -one with tribix and one without tribix. I tried many approaches but was unable to...
I have now stopped attempting it.
If you ever stumble upon an approach to implement xls charts in birt without tribix do let me know.
Thanks for all the help.
-Kiran
JasonW
Kiran,
Did you try changing the plugin.xml for the tribix emitter to set the type differently?
Jason
kiranv
I am not exactly sure what you mean by - <em class='bbc'>"changing the plugin.xml for the tribix emitter to set the type differently?"</em> <br />
<br />
I did the following though i am not sure whether thats what you want to say-<br />
<br />
1) Unzipped the <em class='bbc'>org.uguess.birt.report.engine.emitter.xls_2.5.1.201001221050.jar</em> located in the plugins folder.<br />
2) The plugin.xml reads-<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<?eclipse version="3.0"?><br />
<plugin><br />
<extension<br />
point="org.eclipse.birt.report.engine.emitters"><br />
<emitter<br />
class="org.uguess.birt.report.engine.emitter.xls.XlsEmitter"<br />
format="xls"<br />
id="org.uguess.birt.report.engine.emitter.xls"<br />
mimeType="application/vnd.ms-excel"<br />
pagination="paper-size-pagination"/><br />
</extension><br />
<br />
</plugin><br />
<br />
I changed the format="xls" to format ="xlsx"<br />
3)Zipped the emitter folder again into a jar file and copied in plugins folder.<br />
<br />
However with this approach still it doesnt show the chart image in the excel report. <br />
<br />
Is this the approach you were suggesting?? If not, then kindly let me know which approach you suggested me.<br />
<br />
Regards,<br />
Kiran Vaidya
kiranv
Hello Jason,
Kindly assist me and expain in detail what exactly you meant by changing the plugins.xml
Regards,
Kiran
JasonW
That was the approach I wanted you to try. When you deployed it does xlsx show up in the export menu from the viewer? Do search on the workspace folder for .log and see if any errors show up.
Jason