karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad Beck <BB...@peoplenetonline.com>
Subject RE: Inspecting referenced services for a bundle...
Date Wed, 08 Dec 2010 21:58:16 GMT
Thanks!

The following worked for me in 2.1.0...

bundlesProvidingServices = { services = (getBundle $1)  servicesInUse ; bundles = new java.util.LinkedHashSet
; each $services { $bundles  add ($it  bundle)  } ; $bundles }

-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com] 
Sent: Wednesday, December 08, 2010 3:41 PM
To: user@karaf.apache.org
Subject: Re: Inspecting referenced services for a bundle...

Not directly, but if you iterate through those ServiceReference, you
could build such a list.
You can easily create such a function using the following:

root@karaf> bundlesProvidingServices = { services = ($.context .
getBundle $1) . servicesInUse ; bundles = new java.util.LinkedHashSet
; each $services { $bundles . add ($it . bundle)  } ; $bundles }

and then use it:

root@karaf> bundlesProvidingServices 46
   46|Active     |   60|org.ops4j.pax.web.pax-web-runtime (0.8.1)
   56|Active     |   60|org.apache.felix.webconsole (3.1.6)

the output is actually a list of bundles that you can also store in a
variable if you want more infos.
Note that the syntax is for 2.2-SNAPSHOT and it may have sligtly
changed from 2.1.x.  If that's the case, let me know i can help you
port it if you want.

On Wed, Dec 8, 2010 at 22:17, Brad Beck <BBeck@peoplenetonline.com> wrote:
> Is there a way (using the karaf shell) to inspect a bundle (e.g. 123) to determine which
other bundles are providing services to it?
>
> "bundle 123" shows ServicesInUse, but it doesn't list the bundles providing the services.
>
> Thanks,
> -Brad
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Mime
View raw message