Fine-grained control of service dependencies, constraints and capabilities in OSGi r6 (or r7)

classic Classic list List threaded Threaded
3 messages Options
SvS
Reply | Threaded
Open this post in threaded view
|

Fine-grained control of service dependencies, constraints and capabilities in OSGi r6 (or r7)

SvS
Using the Capabilities and Requirements model in OSGi it’s possible to
control what is needed for a given bundle to be able to do its work.
Presumably this not only works for a bundle, but the mechanism is fully
generic and works for other resources as well(chapter 58: Introduction in
OSGi Core r7 specifications).

Now let’s say we need this Capabilities and Requirements model to work for
services as well, but not by hardcoding the functionality, but by means of
configuring (such as but not restricted to a manifest). A bundle can expose
multiple services, but we could have a situation where services have
different requirements, which can’t be set at the bundle level, so we need
more fine-grained control.
Using the Service Tracker you could try and implement this yourself, but
that is obviously not very flexible and difficult to change in a runtime
situation.

So the question we have: is it possible to control dependencies, constraints
and capabilities at the level of services exposed by a given bundle?

We need this to work for a r6 OSGi framework implementation in the ideal
situation, but if not possible then r7 would be acceptable as well.
The frameworks we need should work in Karaf, so we are restricted to Equinox
and Felix.

We would really like to hear if what we want is possible and if so in what
way.

Thanks in advance!



-----
Regards,
SvS
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Regards,
SvS
Reply | Threaded
Open this post in threaded view
|

Re: Fine-grained control of service dependencies, constraints and capabilities in OSGi r6 (or r7)

jbonofre
Hi,

If you have two services implementation (same interface but two
implementations), the services are packaged in a bundle (single one or
two bundles).

Each bundle will have the requirements corresponding to the services it
provides.

So, I don't see the point.

Can you elaborate a bit ? Or provide a concrete example ?

By the way, Karaf already uses Cap/Req in a very generic way. For
instance, we use this in Pax Web to define several web container
provider (jetty, tomcat, undertow).

Regards
JB

On 03/06/2019 10:19, SvS wrote:

> Using the Capabilities and Requirements model in OSGi it’s possible to
> control what is needed for a given bundle to be able to do its work.
> Presumably this not only works for a bundle, but the mechanism is fully
> generic and works for other resources as well(chapter 58: Introduction in
> OSGi Core r7 specifications).
>
> Now let’s say we need this Capabilities and Requirements model to work for
> services as well, but not by hardcoding the functionality, but by means of
> configuring (such as but not restricted to a manifest). A bundle can expose
> multiple services, but we could have a situation where services have
> different requirements, which can’t be set at the bundle level, so we need
> more fine-grained control.
> Using the Service Tracker you could try and implement this yourself, but
> that is obviously not very flexible and difficult to change in a runtime
> situation.
>
> So the question we have: is it possible to control dependencies, constraints
> and capabilities at the level of services exposed by a given bundle?
>
> We need this to work for a r6 OSGi framework implementation in the ideal
> situation, but if not possible then r7 would be acceptable as well.
> The frameworks we need should work in Karaf, so we are restricted to Equinox
> and Felix.
>
> We would really like to hear if what we want is possible and if so in what
> way.
>
> Thanks in advance!
>
>
>
> -----
> Regards,
> SvS
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Fine-grained control of service dependencies, constraints and capabilities in OSGi r6 (or r7)

David Jencks-2
I don’t understand most of the question but wonder if you are looking for the capabilities of Declarative Services, especially reference target filters, perhaps configured via Configuration Admin.

David Jencks

Sent from my iPhone

> On Jun 3, 2019, at 1:24 AM, Jean-Baptiste Onofré <[hidden email]> wrote:
>
> Hi,
>
> If you have two services implementation (same interface but two
> implementations), the services are packaged in a bundle (single one or
> two bundles).
>
> Each bundle will have the requirements corresponding to the services it
> provides.
>
> So, I don't see the point.
>
> Can you elaborate a bit ? Or provide a concrete example ?
>
> By the way, Karaf already uses Cap/Req in a very generic way. For
> instance, we use this in Pax Web to define several web container
> provider (jetty, tomcat, undertow).
>
> Regards
> JB
>
>> On 03/06/2019 10:19, SvS wrote:
>> Using the Capabilities and Requirements model in OSGi it’s possible to
>> control what is needed for a given bundle to be able to do its work.
>> Presumably this not only works for a bundle, but the mechanism is fully
>> generic and works for other resources as well(chapter 58: Introduction in
>> OSGi Core r7 specifications).
>>
>> Now let’s say we need this Capabilities and Requirements model to work for
>> services as well, but not by hardcoding the functionality, but by means of
>> configuring (such as but not restricted to a manifest). A bundle can expose
>> multiple services, but we could have a situation where services have
>> different requirements, which can’t be set at the bundle level, so we need
>> more fine-grained control.
>> Using the Service Tracker you could try and implement this yourself, but
>> that is obviously not very flexible and difficult to change in a runtime
>> situation.
>>
>> So the question we have: is it possible to control dependencies, constraints
>> and capabilities at the level of services exposed by a given bundle?
>>
>> We need this to work for a r6 OSGi framework implementation in the ideal
>> situation, but if not possible then r7 would be acceptable as well.
>> The frameworks we need should work in Karaf, so we are restricted to Equinox
>> and Felix.
>>
>> We would really like to hear if what we want is possible and if so in what
>> way.
>>
>> Thanks in advance!
>>
>>
>>
>> -----
>> Regards,
>> SvS
>> --
>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>>
>
> --
> Jean-Baptiste Onofré
> [hidden email]
> http://blog.nanthrax.net
> Talend - http://www.talend.com