You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Charbel el kaed <el...@gmail.com> on 2010/09/03 13:10:54 UTC

Retrieve Subscribed Services

Hi,

I would like to know if I can retrieve in OSGi a list of all the
services subscribed to a specific service.

Let's say I have a UPnP Binary light service on the framework,
and two Services subscribed or are tracking a binary light and its
service SwitchPower

"(& (UPnP.device.type=urn:schemas-upnp-org:device:BinaryLight:1)
(UPnP.service.type= urn:schemas-upnp-org:service:SwitchPower:1))"

Is there any way I can retrieve such information from the framework
without modifying OSGi?

Regards,
Charbel

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


Re: Retrieve Subscribed Services

Posted by David Bosschaert <da...@gmail.com>.
Hi Charbel,

You can easily find out who is using a service using the
ServiceReference.getUsingBundles() API.
If you want to know who is listening for a particular service, you can
use the Service Registry Hooks (chapter 12 of the core specification).
The ListenerHook and FindHook are particularly of use here.

I once wrote a blog article about how you can use the registry hooks,
you can find it here:
http://coderthoughts.blogspot.com/2009/11/altering-osgi-service-lookups-with.html

Hope this helps,

David

On 3 September 2010 12:10, Charbel el kaed <el...@gmail.com> wrote:
> Hi,
>
> I would like to know if I can retrieve in OSGi a list of all the
> services subscribed to a specific service.
>
> Let's say I have a UPnP Binary light service on the framework,
> and two Services subscribed or are tracking a binary light and its
> service SwitchPower
>
> "(& (UPnP.device.type=urn:schemas-upnp-org:device:BinaryLight:1)
> (UPnP.service.type= urn:schemas-upnp-org:service:SwitchPower:1))"
>
> Is there any way I can retrieve such information from the framework
> without modifying OSGi?
>
> Regards,
> Charbel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

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