Ok, let's review the situation:
Bundle A
-----------
Bundle-Version: 1.0.0
Export-Package: packageA; version=1.0.0
Bundle A
-----------
Bundle-Version: 2.0.0
Export-Package: packageA; version=2.0.0
Bundle B
-----------
Import-Package: packageA
Which package Bundle B is wired to will depend on whether it specifies a
version. Clearly, it can only be wired to packages that are in its
specified version range. In this case, if B specifies no version for
packageA, then it is the same as specifying [0.0.0, infinity). Which
means that it can wire to either version of packageA that is available.
In a clean system, B would resolve to version 2.0.0 because the higher
version would be preferred. However, if someone else was already using
version 1.0.0, then it would prefer this package instead and wire B to
it since it wants to avoid creating incompatible class spaces.
If there are two bundles that export the same version of packageA, then
it would prefer the one exported by the bundle with the lower bundle ID
or the one that is already in use.
That is pretty much it.
-> richard
Martin Ahrer wrote:
I'm currently trying to get an idea about how exactly OSGi works and what
support it offers. I have played with OSGi services and seen how cool it is
to have references to services from different versions of bundles.
Now I have also been thinking of directly instantiating classes (not using
OSGi service) by calling a class's constructor in a client bundle.
So I have a bundle "a" exporting packageA.ClassA, I have 2 different
versions of bundle "a" deployed in my OSGi container (both versions have
different implementations of ClassA). I also have bundle b importing
packageA and trying to instantiate ClassA (through constructor invocation).
So I was wondering what instance (especially what version) of ClassA bundle
b would get depending on which version of bundle a ist active. The samples I
created are kind of confusing to me and not showing what I'd expect.
I haven't found specific details for this in the OSGi reference. Maybe I'm
trying to do something totally wrong/unsupported. So I'd be glad is somebody
could clarify this or give a hint where such a secenario is explained.
thanks
-----
http://www.martinahrer.at/blog http://www.martinahrer.at/blog
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]