Well you could create a ManagedService Factory with blueprint. With that you have the ability to create different instances of the same Driver with different properties. To find the right service you probably need to ad a filtering attribute. A pretty good description of how to use Managed Service Factories can be found at [1].
Regards, Achim [1] - http://www.eclipse.org/gemini/blueprint/documentation/reference/1.0.0.RELEASE/html/compendium.html#compendium:cm:managed-service-factories 2012/8/14 Christian Schneider <[email protected]>: > You could create one bundle per datasource. Inside you would use maven to > embed the mysql driver you need. > Using the config admin service you could externalize the db details like > url, user, password. > > It would lack the simplicity of the standalone blueprints but should work. > If you want to go the factory way you could define your own factory > interface for now and then create one bundle per driver. Later you then can > switch to the osgi jdbc spec. > Perhaps you could even define the interface according to the spec so you > would not have to change your clients later. > > Christian > > Am 14.08.2012 06:01, schrieb Gareth: > >> Hi Christian, >> >> I saw that. It sort of doesn't meet my needs because I can't just do >> something like this: >> >> <bean id="dataSource" >> class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"> >> <property name="url" value="jdbc:mysql://localhost:3306/world"/> >> <property name="user" value="test"/> >> <property name="password" value="test"/> >> </bean> >> >> as I am required to have multiple versions of >> com.mysql.jdbc.jdbc2.optional.MysqlDataSource accessible (I need to >> install >> multiple mysql drivers to communicate with multiple mysql versions). >> Instead, rather than making the JDBC drivers stand-alone bundles, I am >> wrapping my JDBC drivers in DataSourceFactories which allow me to choose >> the >> correct data source factory via OSGi service parameters (which also means >> the mapping JDBC URL to JDBC data source is configurable rather than being >> defined by import-package). >> >> Gareth >> >> >> >> -- >> View this message in context: >> http://karaf.922171.n3.nabble.com/org-osgi-service-jdbc-and-Karaf-tp4025573p4025580.html >> Sent from the Karaf - User mailing list archive at Nabble.com. > > > > -- > Christian Schneider > http://www.liquid-reality.de > > Open Source Architect > Talend Application Integration Division http://www.talend.com > -- Apache Karaf <http://karaf.apache.org/> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project Lead blog <http://notizblog.nierbeck.de/>
