Your issue here is that your service package did not change version,
thus the difference between the two impls is not seen at the service
level since both implement Service 1.0.
This is how it should be, since the client cannot say it wants impl 1.1,
because then it would fail if impl 1.1 was not available. Besides, two
version numbers between two implementations of the same service do not
have any meaning if the impls come from different vendors, so impl
version is not something that leads to easy comparisons.
However, if you want to specify this you have to rely on OSGi service
ordering, which is based on service rank and bundle ID. In your case,
since you have implemented both version, you can give newer versions of
your service higher service rankings so that it will always prefer the
newest version.
-> richard
McGuire, Tommy M. (MSFC-NNM04AA02C)[SAIC] wrote:
What is the best practice for providing multiple versions of a service?
Say I have four bundles:
* API exports the service API package (including an interface
org.example.Service).
* IMPL-1.0 imports the Service interface and registers a service under
"org.example.Service".
* IMPL-1.1 imports the Service interface and registers another service
under "org.example.Service".
* APP imports the Service interface, and can use either of the services
(but only one). However, I would prefer it to use IMPL-1.1's version.
Versioning handles the similar situation for bundles and packages, but
unless I've completely missed it service references are not versioned.
What would be the best way to handle APP?
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev