Hi Christian,
Yes I'm exporting the DataSource as a service in my db-mysql and
db-derby bundles.
Right now I'm only considering mysql and derby databases. I will check
after for other databases types.
Regards,
Khadija
On 05/22/2013 09:40 AM, Christian Schneider wrote:
Sounds good. Did you export the DataSource as a service in the
db-mysql bundle or how did you connect it to your persistence bundle?
The only thing you need to consider is if this works with pooling. For
some drivers the DataSources are not poolable. In that case you could
use the first option I described and implement the DataSourceFactory
yourself.
Christian
Am 22.05.2013 10:08, schrieb FERJANI:
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
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
Talend Application Integration Divisionhttp://www.talend.com