Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Birt is not OSGi ready? [SOLVED](How can I deploy it inside a OSGi Ready Container)
Birt is not OSGi ready? [SOLVED] [message #1122306] Tue, 01 October 2013 12:29 Go to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 118
Registered: January 2012
Senior Member
Hi all!

I'm new to Birt, and I want to deploy it on a OSGi Ready container: Eclipse Virgo

Virgo have's a structure of "repositories", where the Birt runtime becomes a library avaliable to all bundles. I can import packages, etc.

But, even downloading the Birt OSGi Runtime (4.3.1), I note that the bundle export packages have no versions, and inside the report library directory, the genReport.sh deployment example add to classpath some non bundle libraries, like chartengineapi.jar and coreapi.jar that exists inside the lib folder.

So, i have some doubts about Birt support of OSGi.

The Birt Runtime OSGi. brings their own OSGi runtime, with Equinox extension configs, bundle activators, and normal jars to be used on the System ClassPath. So, I can assume that Birt is not 100% OSGi ready, right?. I mean, the OSGi release is not indeed to be used as bundles and coexist inside a running osgi framework? When I try to do that, I see a lot of missing dependencies from Birt bundles, etc.

Any help will be so mutch appreciated!


[Updated on: Wed, 02 October 2013 20:40]

Report message to a moderator

Re: Birt is not OSGi ready? [message #1123684 is a reply to message #1122306] Wed, 02 October 2013 20:40 Go to previous messageGo to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 118
Registered: January 2012
Senior Member
In fact, Birt is not OSGi friendly, despite its OSGi runtime.
The new POJO Runtime, uses a flat classpath model.

To use it in my enviroment, I need to encapsulate the report generation in a service bundle that carry all birt runtime and library jars, declaring them on the Bundle-ClassPath.
Re: Birt is not OSGi ready? [message #1129095 is a reply to message #1123684] Tue, 08 October 2013 09:29 Go to previous messageGo to next message
donino donino is currently offline donino doninoFriend
Messages: 165
Registered: July 2011
Senior Member
Hi,

this is an interesting topic! I don't know much about OSGi and i would just like to know once we have designed a such bundle, how can we access the report engine API:
Do we have to implement a kind of service API for each birt method we need to apply through this OSGi bundle? For example a service to open a report design, a service to invoke a runTask, another one to invoke a renderTask etc. Or can we use the BIRT API like if it was in a "regular" classpath once the bundle is loaded?

Thanks!
Re: Birt is not OSGi ready? [message #1129640 is a reply to message #1129095] Tue, 08 October 2013 21:11 Go to previous messageGo to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 118
Registered: January 2012
Senior Member
Hi Donino!

The Birt API is not OSGi ready. The API jars aren't OSGi bundles, as they does not have OSGi Manifest headers, etc.

Birt dependencies are OSGi Bundles, but theirs Manifest have some issues, like no package export versions, etc.

To make birt Work in a OSGi enviroment, when you will can in any bundle, handle their classes, you need to OSGIfy Birt, creating the Manifest Headers, and possibly fixing some dependency issues, or, you can publish the Birt API on the System ClassLoader, so, you will can import the API Packages, and have access on the classes. (the same thing that is done with "javax" for example).

The last approach is by far, more easy, but is not the best choice.
The first can work, and is the recommended way, but you will have many artefacts to mantain.

So, I try a different thing. You can embbed any JAR inside a OSGi bundle, as each bundle, have their own classpath. You can make this JAR's, part of the bundle classpath with the "Bundle-ClassPath:" manifest directive.

So, I've added all the Birt runtime inside my bundle, and as I need only simple features of Birt, I can hide the Birt API behind a simple service Facade:



public enum RenderMode {

	PDF("pdf", "application/pdf"),
	XLS("xls", "application/vnd.ms-excel"),
	HTML("html", "text/html");
	
	private RenderMode(String extension, String mimeType) {
		this.extension = extension;
		this.mimeType = mimeType;
	}
	 
	private final String extension;
	private final String mimeType;
	
	public String getExtension() {
		return extension;
	}
	
	public String getMimeType() {
		return mimeType;
	}
	
}




import java.io.InputStream;

/**
 * A Report
 * @author Eduardo Frazao
 *
 */
public interface Report {
	
	/**
	 * 
	 * @return The rptdesign input stream
	 */
	InputStream getReportDesignFor(RenderMode mode);
	
}




import java.io.InputStream;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

/**
 * Report Sertice
 * @author Eduardo Frazao
 *
 */
public interface ReportService {
	
	/**
	 * A Collection of registered reports (Via OSGI Service Registry)
	 * @return
	 */
	public Collection<Report> getAllReports();
	
	public Future<InputStream> generate(Report report, RenderMode renderMode);
	
	public Future<InputStream> generate(Report report, RenderMode renderMode, Map<String, Object> params);
	
	public FutureTask<InputStream> generate(Report report, RenderMode renderMode, TaskHandler<InputStream> taskHandler);
	
	public FutureTask<InputStream> generate(Report report, RenderMode renderMode, Map<String, Object> params, TaskHandler<InputStream> taskHandler);

}



Latter, I expose a implementation of this service, that exists inside the Birt API Report Bundle. This services handle the "Report" objects, that can come from any bundle, process it, and returns the generated report as an InputStream.

I know that this is a very simplistic approach, but for now, its fine for my needs!
Re: Birt is not OSGi ready? [message #1129693 is a reply to message #1129640] Tue, 08 October 2013 22:29 Go to previous messageGo to next message
donino donino is currently offline donino doninoFriend
Messages: 165
Registered: July 2011
Senior Member
Great! Thank you very much for this very clear explanation. This OSGI approach with a single bundle looks quite easy to implement, i look forward to give it a try! I need a such solution because im tired of JARs conflicts when using the BIRT runtime with regular ClassLoaders. OSGI is supposed to solve all this! Now we have a better picture of the situation,

Thanks again Eduardo
Re: Birt is not OSGi ready? [message #1129739 is a reply to message #1129693] Tue, 08 October 2013 23:32 Go to previous messageGo to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 118
Registered: January 2012
Senior Member
No problem!! I'm glad to help!
If you want, I can post the ReportService implementation, or even post the entire bundle, with manifest, etc...
Re: Birt is not OSGi ready? [message #1137109 is a reply to message #1129739] Mon, 14 October 2013 09:09 Go to previous messageGo to next message
donino donino is currently offline donino doninoFriend
Messages: 165
Registered: July 2011
Senior Member
Hi Eduardo,

I (and probably many other BIRT developers!) would be very interested to see an example of a manifest file of an OSGI bundle embedding the birt runtime! It would be great!
Re: Birt is not OSGi ready? [message #1139663 is a reply to message #1137109] Tue, 15 October 2013 23:08 Go to previous messageGo to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 118
Registered: January 2012
Senior Member
Hi Donino!

Here is the Manifest File. Its from the Birt 4.3.1.

Manifest-Version: 1.0
Bundle-Version: 1.0.0
Bundle-Name: Report API
Bundle-ManifestVersion: 2
Bundle-Description: Birt API Facade
Bundle-SymbolicName: br.com.bundleName
Export-Package: br.com.bundlename.report;version="1.0.0"
Bundle-ClassPath: lib/birt/axis-ant.jar,
 lib/birt/axis.jar,
 lib/birt/com.ibm.icu_50.1.1.v201304230130.jar,
 lib/birt/com.lowagie.text_2.1.7.v201004222200.jar,
 lib/birt/commons-cli-1.0.jar,
 lib/birt/commons-discovery-0.2.jar,
 lib/birt/derby.jar,
 lib/birt/flute.jar,
 lib/birt/javax.wsdl_1.5.1.v201012040544.jar,
 lib/birt/javax.xml.stream_1.0.1.v201004272200.jar,
 lib/birt/jaxrpc.jar,
 lib/birt/js.jar,
 lib/birt/org.apache.batik.bridge_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.css_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.dom_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.dom.svg_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.ext.awt_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.parser_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.pdf_1.6.0.v201105071520.jar,
 lib/birt/org.apache.batik.svggen_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.transcoder_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.util_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.util.gui_1.6.0.v201011041432.jar,
 lib/birt/org.apache.batik.xml_1.6.0.v201011041432.jar,
 lib/birt/org.apache.commons.codec_1.3.0.v201101211617.jar,
 lib/birt/org.apache.commons.logging_1.1.1.v201101211721.jar,
 lib/birt/org.apache.poi_3.9.0.v201303080712.jar,
 lib/birt/org.apache.xerces_2.9.0.v201101211617.jar,
 lib/birt/org.apache.xml.resolver_1.2.0.v201005080400.jar,
 lib/birt/org.apache.xml.serializer_2.7.1.v201005080400.jar,
 lib/birt/org.eclipse.birt.runtime_4.3.1.v20130918-1142.jar,
 lib/birt/org.eclipse.core.contenttype_3.4.200.v20130326-1255.jar,
 lib/birt/org.eclipse.core.expressions_3.4.500.v20130515-1343.jar,
 lib/birt/org.eclipse.core.filesystem_1.4.0.v20130514-1240.jar,
 lib/birt/org.eclipse.core.jobs_3.5.300.v20130429-1813.jar,
 lib/birt/org.eclipse.core.resources_3.8.101.v20130717-0806.jar,
 lib/birt/org.eclipse.core.runtime_3.9.0.v20130326-1255.jar,
 lib/birt/org.eclipse.datatools.connectivity_1.2.9.v201307261105.jar,
 lib/birt/org.eclipse.datatools.connectivity.apache.derby_1.0.103.v201212070447.jar,
 lib/birt/org.eclipse.datatools.connectivity.apache.derby.dbdefinition_1.0.2.v201107221459.jar,
 lib/birt/org.eclipse.datatools.connectivity.console.profile_1.0.10.v201109250955.jar,
 lib/birt/org.eclipse.datatools.connectivity.db.generic_1.0.1.v201107221459.jar,
 lib/birt/org.eclipse.datatools.connectivity.dbdefinition.genericJDBC_1.0.1.v201107221459.jar,
 lib/birt/org.eclipse.datatools.connectivity.oda_3.4.1.v201308160907.jar,
 lib/birt/org.eclipse.datatools.connectivity.oda.consumer_3.2.6.v201305170644.jar,
 lib/birt/org.eclipse.datatools.connectivity.oda.design_3.3.6.v201212070447.jar,
 lib/birt/org.eclipse.datatools.connectivity.oda.flatfile_3.1.6.v201308131104.jar,
 lib/birt/org.eclipse.datatools.connectivity.oda.profile_3.2.9.v201307270622.jar,
 lib/birt/org.eclipse.datatools.connectivity.sqm.core_1.2.7.v201308160952.jar,
 lib/birt/org.eclipse.datatools.enablement.hsqldb_1.0.0.v201107221502.jar,
 lib/birt/org.eclipse.datatools.enablement.hsqldb.dbdefinition_1.0.0.v201107221502.jar,
 lib/birt/org.eclipse.datatools.enablement.ibm.db2.luw_1.0.2.v201107221502.jar,
 lib/birt/org.eclipse.datatools.enablement.ibm.db2.luw.dbdefinition_1.0.4.v201107221502.jar,
 lib/birt/org.eclipse.datatools.enablement.ibm.informix_1.0.1.v201107221502.jar,
 lib/birt/org.eclipse.datatools.enablement.ibm.informix.dbdefinition_1.0.4.v201107221502.jar,
 lib/birt/org.eclipse.datatools.enablement.msft.sqlserver_1.0.3.v201308161009.jar,
 lib/birt/org.eclipse.datatools.enablement.msft.sqlserver.dbdefinition_1.0.1.v201201240505.jar,
 lib/birt/org.eclipse.datatools.enablement.mysql_1.0.4.v201212120617.jar,
 lib/birt/org.eclipse.datatools.enablement.mysql.dbdefinition_1.0.4.v201109022331.jar,
 lib/birt/org.eclipse.datatools.enablement.oda.ws_1.2.6.v201307051812.jar,
 lib/birt/org.eclipse.datatools.enablement.oda.xml_1.2.5.v201305031101.jar,
 lib/birt/org.eclipse.datatools.enablement.oracle_1.0.0.v201107221506.jar,
 lib/birt/org.eclipse.datatools.enablement.oracle.dbdefinition_1.0.103.v201206010214.jar,
 lib/birt/org.eclipse.datatools.enablement.postgresql_1.1.1.v201205252207.jar,
 lib/birt/org.eclipse.datatools.enablement.postgresql.dbdefinition_1.0.2.v201110070445.jar,
 lib/birt/org.eclipse.datatools.modelbase.dbdefinition_1.0.2.v201107221519.jar,
 lib/birt/org.eclipse.datatools.modelbase.derby_1.0.0.v201107221519.jar,
 lib/birt/org.eclipse.datatools.modelbase.sql_1.0.6.v201208230744.jar,
 lib/birt/org.eclipse.datatools.modelbase.sql.query_1.1.4.v201212120619.jar,
 lib/birt/org.eclipse.emf_2.6.0.v20130902-0605.jar,
 lib/birt/org.eclipse.emf.common_2.9.1.v20130827-0309.jar,
 lib/birt/org.eclipse.emf.ecore_2.9.1.v20130827-0309.jar,
 lib/birt/org.eclipse.emf.ecore.change_2.9.0.v20130827-0309.jar,
 lib/birt/org.eclipse.emf.ecore.xmi_2.9.1.v20130827-0309.jar,
 lib/birt/org.eclipse.equinox.app_1.3.100.v20130327-1442.jar,
 lib/birt/org.eclipse.equinox.common_3.6.200.v20130402-1505.jar,
 lib/birt/org.eclipse.equinox.preferences_3.5.100.v20130422-1538.jar,
 lib/birt/org.eclipse.equinox.registry_3.5.301.v20130717-1549.jar,
 lib/birt/org.eclipse.orbit.mongodb_2.10.1.v20130422-1135.jar,
 lib/birt/org.eclipse.osgi_3.9.1.v20130814-1242.jar,
 lib/birt/org.eclipse.osgi.services_3.3.100.v20130513-1956.jar,
 lib/birt/org.eclipse.update.configurator_3.3.200.v20130326-1319.jar,
 lib/birt/org.w3c.css.sac_1.3.0.v200805290154.jar,
 lib/birt/org.w3c.dom.smil_1.0.0.v200806040011.jar,
 lib/birt/org.w3c.dom.svg_1.1.0.v201011041433.jar,
 lib/birt/saaj.jar,
 lib/birt/Tidy.jar,
 lib/birt/viewservlets.jar,
 lib/postgresql-9.2-1002.jdbc4.jar,
 .

Re: Birt is not OSGi ready? [message #1386269 is a reply to message #1139663] Mon, 16 June 2014 09:25 Go to previous messageGo to next message
gustavo monarin is currently offline gustavo monarinFriend
Messages: 5
Registered: September 2013
Junior Member
Hi Eduardo,

Could you share the snippet where you create the IReportEngineFactory?

In some samples i found to integrate birt they startup the osgi platform in order to create the reportenginefactory but once I already have one osgi platform context running it fails.

Thanks in advance.
Re: Birt is not OSGi ready? [message #1386722 is a reply to message #1386269] Thu, 19 June 2014 20:00 Go to previous message
Kent Johnson is currently offline Kent JohnsonFriend
Messages: 11
Registered: December 2013
Junior Member
Hello guys, I think I want to use BIRT like you are doing, using OSGi. I tried to run it through a REST Interface using a Spring container but I am hitting NoClassDefFoundErrors.

I'd like to learn how to use BIRT with OSGi. Do either of you know a good resource or tutorial I can use to help me do what you are doing?

Thanks,

Kent
Previous Topic:Cascading parameters default value problem
Next Topic:iDataExtract.getResultSetList() gives empty list
Goto Forum:
  


Current Time: Thu Dec 18 02:27:42 GMT 2014

Powered by FUDForum. Page generated in 0.16359 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software