You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Milen Dyankov <mi...@gmail.com> on 2016/01/13 11:10:22 UTC

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

RE: Specifying dependency between a bundle and a fragment bundle

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
Milen,

I don't really catch the issue, but by "via services" I mean that files inside a fragment are not services. If your UI needs something then it can be expressed via an API. Then you would have one or several implementation bundles which may come and go... as any usual bundle.

JP

[@@ OPEN @@]

-----Message d'origine-----
De : Milen Dyankov [mailto:milendyankov@gmail.com] 
Envoyé : jeudi 14 janvier 2016 12:53
À : users@felix.apache.org
Objet : Re: Specifying dependency between a bundle and a fragment bundle

I'm not sure what you mean by "via services". As for subsystems, my understanding is this is more of a packaging/delivery option. It may help but I still need a soliton that will work for deploying individual bundles.

Anyway, I experimented a bit more and it seams it's fully possible to use requirement and capabilities with fragment bundles.
I don't know why it wasn't working before but my understanding that capabilities related headers in fragment bundle are applied to the host bundle is wrong!

So, by putting

Fragment-Host: original.ui.bundle
Provide-Capability: myUI
Require-Capability: myService

in my UI bundle and then in my service bundle

Provide-Capability: myService
Require-Capability: myUI

I can actually define the dependency I need.
With that in place, I can uninstall (too bad I can not only unresolve) my service bundle if my service fails. There are still some quirks with refreshing the original UI bundle but it generally works.
It's probably not the best solution but I couldn't figure out anything better so far.

Thanks for your help!
Milen


On Wed, Jan 13, 2016 at 3:02 PM, CLEMENT Jean-Philippe < jean-philippe.clement@fr.thalesgroup.com> wrote:

> I would have made this via services, but there might be other ways 
> such as subsystems (?)
>
> JP
>
> [@@ OPEN @@]
>
>
> -----Message d'origine-----
> De : Milen Dyankov [mailto:milendyankov@gmail.com] Envoyé : mercredi 
> 13 janvier 2016 14:49 À : users@felix.apache.org Objet : Re: 
> Specifying dependency between a bundle and a fragment bundle
>
> Conceptually I guess you can put it that way, yes.
>
> On Wed, Jan 13, 2016 at 2:43 PM, CLEMENT Jean-Philippe < 
> jean-philippe.clement@fr.thalesgroup.com> wrote:
>
> > Do you mean ensure that fragments and services are deployed as a 
> > single transaction?
> >
> > JP
> >
> > [@@ OPEN @@]
> >
> >
> > -----Message d'origine-----
> > De : Milen Dyankov [mailto:milendyankov@gmail.com] Envoyé : mercredi
> > 13 janvier 2016 13:57 À : users@felix.apache.org Objet : Re:
> > Specifying dependency between a bundle and a fragment bundle
> >
> > 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.clement@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:milendyankov@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-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > >
> >
> >
> >
> > --
> > http://about.me/milen
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
>
>
> --
> http://about.me/milen
>



--
http://about.me/milen

Re: Specifying dependency between a bundle and a fragment bundle

Posted by Milen Dyankov <mi...@gmail.com>.
I'm not sure what you mean by "via services". As for subsystems, my
understanding is this is more of a packaging/delivery option. It may help
but I still need a soliton that will work for deploying individual bundles.

Anyway, I experimented a bit more and it seams it's fully possible to use
requirement and capabilities with fragment bundles.
I don't know why it wasn't working before but my understanding that
capabilities related headers in fragment bundle are applied to the host
bundle is wrong!

So, by putting

Fragment-Host: original.ui.bundle
Provide-Capability: myUI
Require-Capability: myService

in my UI bundle and then in my service bundle

Provide-Capability: myService
Require-Capability: myUI

I can actually define the dependency I need.
With that in place, I can uninstall (too bad I can not only unresolve) my
service bundle if my service fails. There are still some quirks with
refreshing the original UI bundle but it generally works.
It's probably not the best solution but I couldn't figure out anything
better so far.

Thanks for your help!
Milen


On Wed, Jan 13, 2016 at 3:02 PM, CLEMENT Jean-Philippe <
jean-philippe.clement@fr.thalesgroup.com> wrote:

> I would have made this via services, but there might be other ways such as
> subsystems (?)
>
> JP
>
> [@@ OPEN @@]
>
>
> -----Message d'origine-----
> De : Milen Dyankov [mailto:milendyankov@gmail.com]
> Envoyé : mercredi 13 janvier 2016 14:49
> À : users@felix.apache.org
> Objet : Re: Specifying dependency between a bundle and a fragment bundle
>
> Conceptually I guess you can put it that way, yes.
>
> On Wed, Jan 13, 2016 at 2:43 PM, CLEMENT Jean-Philippe <
> jean-philippe.clement@fr.thalesgroup.com> wrote:
>
> > Do you mean ensure that fragments and services are deployed as a
> > single transaction?
> >
> > JP
> >
> > [@@ OPEN @@]
> >
> >
> > -----Message d'origine-----
> > De : Milen Dyankov [mailto:milendyankov@gmail.com] Envoyé : mercredi
> > 13 janvier 2016 13:57 À : users@felix.apache.org Objet : Re:
> > Specifying dependency between a bundle and a fragment bundle
> >
> > 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.clement@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:milendyankov@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-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > >
> >
> >
> >
> > --
> > http://about.me/milen
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
>
>
> --
> http://about.me/milen
>



-- 
http://about.me/milen

RE: Specifying dependency between a bundle and a fragment bundle

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
I would have made this via services, but there might be other ways such as subsystems (?)

JP
 
[@@ OPEN @@]


-----Message d'origine-----
De : Milen Dyankov [mailto:milendyankov@gmail.com] 
Envoyé : mercredi 13 janvier 2016 14:49
À : users@felix.apache.org
Objet : Re: Specifying dependency between a bundle and a fragment bundle

Conceptually I guess you can put it that way, yes.

On Wed, Jan 13, 2016 at 2:43 PM, CLEMENT Jean-Philippe < jean-philippe.clement@fr.thalesgroup.com> wrote:

> Do you mean ensure that fragments and services are deployed as a 
> single transaction?
>
> JP
>
> [@@ OPEN @@]
>
>
> -----Message d'origine-----
> De : Milen Dyankov [mailto:milendyankov@gmail.com] Envoyé : mercredi 
> 13 janvier 2016 13:57 À : users@felix.apache.org Objet : Re: 
> Specifying dependency between a bundle and a fragment bundle
>
> 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.clement@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:milendyankov@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-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
>
>
> --
> http://about.me/milen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>



--
http://about.me/milen

Re: Specifying dependency between a bundle and a fragment bundle

Posted by Milen Dyankov <mi...@gmail.com>.
Conceptually I guess you can put it that way, yes.

On Wed, Jan 13, 2016 at 2:43 PM, CLEMENT Jean-Philippe <
jean-philippe.clement@fr.thalesgroup.com> wrote:

> Do you mean ensure that fragments and services are deployed as a single
> transaction?
>
> JP
>
> [@@ OPEN @@]
>
>
> -----Message d'origine-----
> De : Milen Dyankov [mailto:milendyankov@gmail.com]
> Envoyé : mercredi 13 janvier 2016 13:57
> À : users@felix.apache.org
> Objet : Re: Specifying dependency between a bundle and a fragment bundle
>
> 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.clement@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:milendyankov@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-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
>
>
> --
> http://about.me/milen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>



-- 
http://about.me/milen

RE: Specifying dependency between a bundle and a fragment bundle

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
Do you mean ensure that fragments and services are deployed as a single transaction?

JP

[@@ OPEN @@]


-----Message d'origine-----
De : Milen Dyankov [mailto:milendyankov@gmail.com] 
Envoyé : mercredi 13 janvier 2016 13:57
À : users@felix.apache.org
Objet : Re: Specifying dependency between a bundle and a fragment bundle

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.clement@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:milendyankov@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-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>



--
http://about.me/milen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

Re: Specifying dependency between a bundle and a fragment bundle

Posted by Milen Dyankov <mi...@gmail.com>.
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.clement@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:milendyankov@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-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>



-- 
http://about.me/milen

RE: Specifying dependency between a bundle and a fragment bundle

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
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:milendyankov@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-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org