I have a equinox based application. I need to update a bundle and rewire the OSGi bundles corresponding to the updated bundle.
I updated the bundle using,
bundle.update(new FileInputStream(new File(filePath)));
I need to refresh the affected bundles in order the update to be affected.
How can I do this?...
BundleContext bcx = bundle.getBundleContext();
Bundle systemBundle = bcx.getBundle(0);
bundle.update(new FileInputStream(new File(filePath)));
FrameworkWiring frameworkWiring = systemBundle.adapt(FrameworkWiring.class);
frameworkWiring.refreshBundles(null);
Please note that refreshBundles is an asynchron function call. Therefore if you want to catch the event when the bundles are refreshed, you must pass a FrameworkListener as the second parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With