On Tue, Jul 14, 2009 at 10:46 AM, Andrea Zoppello<[email protected]> wrote: > Hi, > I'm just trying to address how to address the problem of developing > components that needs access to > database using the javax.sql.Datasource object.. > > Unfortunately JNDI integration is still not complete and not usable at the > moment.... > > Actually i've managed this situation using a DS component factory that > provide javax.sql.Datasource services > into the OSGi registry. > > This DS factory is just used by a deployment service that provide to > deploy/undeploy datasources upon files deployed on a particular filesystem > folder, using commons-dbcp bundle. > > BTW to make this wroking i've use the Dynamic-Import directive into the > bundle of commons-dbcp because if this is > not present dbcp does not work because it's not able to create the driver > class... > > I think this is a very common problems and i'd like to know and share > within the community which could be the best approach, when you need to work > with Datasource in OSGi enviroment... > > Any thoughts??
Hi Andrea, I actually did pretty much the same thing you have done: * a managed service factory that register services under " javax.sql.Datasource" * the Apache Felix FileInstall bundle watches a folder in the filesystem for new configuration files defining datasources. When it finds a new file, sends the configuration dictionary to the managed service factory As for the Dynamic-Import directive, I did the same thing, but I suppose (I haven't tried, though) it should be possible to do that adding a bundle fragment. The osgi spec in fact says that a bundle fragment can add additional imports to the host bundle; so if you create a bundle fragment importing, let's say, the oracle.jdbc package, and you attach it to the common-dbcp bundle, it should work. If you try this approach, let me know if it works! -- Filippo Diotalevi _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
