karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hervé BARRAULT <herve.barra...@gmail.com>
Subject Re: Starting/Stopping Programmatically Bundles
Date Mon, 16 Jan 2012 17:23:16 GMT
I haven't register the Bundle Listener, as i thought exposing a
BundleListener as an OSGI service does something like this.

Is this bundleContext linked to the current bundle or all bundle ?

My Bundle "Checker" shall listener to other bundle and manipulate
them. I will try the BundleActivator to get the BundleContext.

Regards
Hervé

On 1/16/12, Jean-Baptiste Onofré <jb@nanthrax.net> wrote:
> Hi Hervé,
>
> Did you register your listener in the bundle context, with something like ?:
>
> getBundleContext().addBundleListener(myBundleListener);
>
> To start/stop bundle, you can do:
>
> getBundleContext().getBundle(id).stop()...
>
> Regards
> JB
>
> On 01/16/2012 06:07 PM, Hervé BARRAULT wrote:
>> HI, i'm using Karaf 2.0.0 and i'm trying to find a way to start/stop a
>> bundle with java code.
>>
>> I have difficulties to find the right API to use (and which service to
>> import).
>>
>> I have tried to create a BundleListener and expose it as an osgi
>> service (in order to being notified of bundles start/stop) but i'm not
>> notified.
>> I thought getting data about bundles and being able to manipulate it.
>>
>> What are the correct steps to do this ?
>>
>> Regards
>> Hervé
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Mime
View raw message