Hello Christian,

I tried something that seems working but I'd like a confirmation that I'm not writing a bomb-code :)

I separated my persistence bundle (META-INF/persistence.xml, Entity classes,..) (db-common) from the blueprint.xml file. I created a bundle database-mysql that only contains a blueprint file for the mysql DB configuration (db-mysql), and I'm thinking of creating a similar bundle with a blueprint.xml file for a derby DB configuration (db-derby). After that, I'd have to install one of those bundles (db-mysql or db-derby) with my initial bundle (db-common) to make it work.

Right know, I tested this with the bundles db-mysql and db-common and it seems working.

Is it an OSGi compliant implementation ?

Best regards,
Khadija



On 05/22/2013 08:12 AM, Christian Schneider wrote:
This is possible in two ways.

You can use the http://www.osgi.org/javadoc/r4v42/org/osgi/service/jdbc/DataSourceFactory.html sepcified in the OSGi spec if your drivers supports it.

If not then you can try this tutorial:
http://www.liquid-reality.de/x/LYBk
Basically the idea is to publish a DataSource as an OSGi service using a separate blueprint file and using the service in your user bundle. This way you can have the filter to reference the OSGi service in a config of your user bundle. So you can switch db types.

Christian

Am 21.05.2013 17:40, schrieb FERJANI:
Hello everyone,

I'd like to configure the database type (mysql, derby,..) from an external configuration type. Is this possible using blueprint ?

Regards,
Khadija


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Divisionhttp://www.talend.com

Reply via email to