Thank you for your thoughts regarding replacing the service. However that is not really my concern. There are 2 aspects in the picture - the service itself and the UI to communicate with it. In traditional layered architecture one would refer to those as service layer an UI layer. Both are developed independenty and in more complex scenarios there could be N bundles providing UIs for working with M bundles providing services. In non-OSGi environment if I start application having correct modules (jar files and resources on the classpath) at runtime, I am kind of guaranteed to have a consistent change in both layers. In OSGi (or any dynamic modular system I guess) one change can be applied and the other one not (due to configuration, resolve issues, removed dependencies, ...) which can lead to UI functionality not matching the actual underlying services providing it. So what I'm struggling with is finding a way to keep the changes consistent across both layers. As in this particular case the changes to the UI layer are applied via fragment bundles and the changes to the service layer are applied by providing "regular" bundles, I'm looking for a way to express the relationship between those. I guess using Requirements and Capabilities would be perfect but to my understanding you can not use it for fragments.
On Wed, Jan 13, 2016 at 1:24 PM, CLEMENT Jean-Philippe < jean-philippe.clem...@fr.thalesgroup.com> wrote: > I'm not too sure what you need, but I would say first that you consider > what you have (a text file) rather than what you need (a service or > services). It seems you see things through the provider instead of the > consumer. > > So, you have a button which calls a service S. Fine. Then you want S to be > the best service. So you just have to implement a service S which is a > proxy to T services and which will forward calls to the best T service. > > You can even reuse S instead of another T service. So, S is a proxy to > other S services. The proxy has the better ranking in order the button to > "find it". The proxy has to exclude itself from S service candidates. > > ...just a quick thought... > > JP > > [@@ OPEN @@] > > -----Message d'origine----- > De : Milen Dyankov [mailto:milendyan...@gmail.com] > Envoyé : mercredi 13 janvier 2016 11:10 > À : users@felix.apache.org > Objet : Specifying dependency between a bundle and a fragment bundle > > Lets say I have a UI bundle that renders a button from template. The > template is just a text file(s) inside UI bundle. Clicking the button calls > a service (for the purpose of this example say one with the highest rank). > > The requirement is: change both the service that is called and the button > in consistent manner. > > The first part is easy: > - To change the service one can simply provide a new bundle (call it S) > containing the new service implementation (with higher rank or whatever > else it takes to make it the one that service registry will give to the UI > bundle). > - To change the button (or even replace it with something else) one can > provide a fragment bundle (call it FB) with updated template file(s). > > The question is, how to keep those consistent? That is, make sure that > either both S and FB are applied or none of them (lets assume S will > somehow ensure the service is registered or stop itself if it can't do so)! > > It seams one needs to somehow declare a bidirectional dependency (I hate > the way it sounds, but that's what it in fact is, isn't it) between a > bundle and a fragment bundle. AFAIK this is not really possible as anything > specified in fragment is applied to the host! Has anyone faced similar > challenge before? > > > -- > http://about.me/milen > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org > For additional commands, e-mail: users-h...@felix.apache.org > -- http://about.me/milen