You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "Jackson, Douglas" <do...@siemens.com> on 2019/03/18 16:38:31 UTC

How to resolve a bundle fragment

Hi!
I am using karaf 4.2.2. I am trying to programmatically resolve a bundle fragment.
I can install the bundle with this:
         Bundle bundle = bundleContext.installBundle(bundlePath);
Then I try to resolve it by doing a refresh on the host bundle:
                    bundle.adapt(FrameworkWiring.class).refreshBundles(Collections.singleton(bundle));
However, the adapt() call returns null.
Do I need to do the adapt() on a particular bundle?
-Doug


Re: How to resolve a bundle fragment

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Doug,

a fragment is attached to a host bundle.

So, you just have to install the fragment, it will attach to the host
(and a fragment is not started, only resolved).
You don't have to do a refresh on the host bundle (you might want to do
a refresh on the bundles using the host bundle packages).

So, basically, you don't need the adapt() call.

Regards
JB

On 18/03/2019 17:38, Jackson, Douglas wrote:
> Hi!
> 
> I am using karaf 4.2.2. I am trying to programmatically resolve a bundle
> fragment.
> 
> I can install the bundle with this:
> 
>          Bundle bundle= bundleContext.installBundle(bundlePath);
> 
> Then I try to resolve it by doing a refresh on the host bundle:
> 
>                    
> bundle.adapt(FrameworkWiring.class).refreshBundles(Collections.singleton(bundle));
> 
> However, the adapt() call returns null.
> 
> Do I need to do the adapt() on a particular bundle?
> 
> -Doug
> 
>  
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com