The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

ErikEngerd (11) [Avatar] Offline
#1
Hi,

On p. 82 I read "... the framework only allows one bundle with a given symbolic name and version to be installed at a time..."

Now I have a question about how to realize a Java EE like Datasource. A datasource could in practice just be a bundle with configuration data for driver class name, database connection URL, username, and password. The distinction of different instances of the datasource would be through an attribute of the bundle, much like the JNDI name in Java EE does. I

How does OSGI support such a deployment?

Cheers
Erik
stuart.mcculloch (29) [Avatar] Offline
#2
Re: General question/ch. 3/ p 82/bundle symbolic name and version..
Just a quick followup on this issue - the OSGi Enterprise Spec (going through final drafting at the moment) provides a solution for this. The basic approach is that datasources should be registered as OSGi services, which side-steps the issue you mention above and allows fine-grained searching of datasource providers.

With a service-based approach you could have a host datasource bundle, to which you attach multiple fragments with different datasource configurations - these would then be scanned by the host bundle, which would register the relevant datasources as services.