The import range in CNS says it will work with any version 1.x of com.foo. So the resolver is free to resolve CNS to use any 1.x version of the package com.foo. You can control the version sources by limiting which bundles are installed. If you want to get really fancy, you can implement a ResolverHook [1] which can then influence the resolution of CNS. Note: the resolver hook implementation bundle must be started, and its ResolverHookFactory service registered, before the framework attempts to resolve CNS.
 
--

BJ Hargrave
Senior Technical Staff Member, IBM // office: +1 386 848 1781
OSGi Fellow and CTO of the OSGi Alliance // mobile: +1 386 848 3788
hargr...@us.ibm.com
 
 
----- Original message -----
From: Mohamed AFIF via osgi-dev <osgi-dev@mail.osgi.org>
Sent by: osgi-dev-boun...@mail.osgi.org
To: osgi-dev@mail.osgi.org
Cc:
Subject: [osgi-dev] forcing a karaf to use a lower version of two imported packages versions
Date: Mon, Jul 16, 2018 4:48 AM
 
 
hello Everybody,
 
We would like to maintiain a backward compatibility as much as possible of our software , it means if consumer  modifiy a bundle version N, and  if we deliver a new version N+1 , he could keep using his modified bundle until he will be ready to use N+1. So to allow this the only way I've found after many days of brainstorming is to have the same bundle with the many versions on Karaf, so this my real use case and my question:
 
let's have:
 
-  two  bundles (API) <b> API1.0 and    API1.1</b>:     both of them   export package    com.foo.Inetrface  (this interface has been modified by consumer and kept the same name , in the same artifact
- one consumer bundle <b>CNS </b>importing package from API  using this range  [1.0,2)==> will include   API1.0 and    API1.1.
 
 
is there any way to tell CNS ( on   runtime or compile time ) which version of API it should consume ?
Concretely  as CNS will refrence the higer version (1.1) I would like to force if to use 1.0 (in the case when Client will have modified initial version API 0.0 to API 1.0, and after we will deliver to hil a nexw version API 1.1, so the client should continue to use API 1.0 with CNS )
 
i Thought of a kind of bundle proxy which will include  API1.0 and    API1.1,  and than will have the repsonsablity to drive toward 1.0 or 1.1 but , finally it's very hard to develop especially  I shoud touch Classloaders ...
 
Many thans for your help
 
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev
 

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to