I have an Eclipse plugin and want to stop, uninstall bundles from the Eclipse instance and then refresh. Stop and uninstall is no problem, but the refresh part of the code is now deprecated and I want to find an alternative. Currently I'm doing this through
Documentation points to
org.osgi.framework.wiring package. And from the <a href="http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/wiring/FrameworkWiring.html" rel="nofollow">JavaDoc</a>
org.osgi.framework.wiring.FrameworkWiring.refreshBundles(..) seems to be exactly what I want. But the only class that implements this interface is
org.eclipse.osgi.framework.internal.core.PackageAdminImpl, i.e an internal class.
Quite possibly this means my approach is wrong. What is the typical way to dynamically uninstall bundles?Answer1:
If you read the javadoc description for the <a href="http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/wiring/FrameworkWiring.html" rel="nofollow">FrameworkWiring</a> type, you will see:<blockquote>
The framework wiring object for the framework can be obtained by calling <a href="http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#adapt%28java.lang.Class%29" rel="nofollow">bundle.adapt(FrameworkWiring.class)</a> on the system bundle. Only the system bundle can be adapted to a FrameworkWiring object.</blockquote>