84334

Uninstall bundles and force a refresh

Question:

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 org.osgi.service.packageadmin.

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>

Recommend

  • How to get current active window while running my java application
  • @UIScope annotation not respected for spring view?
  • javadoc exclude some public methods from class
  • Java Hashtable put method slow down my application
  • How does URLConnection in java reuses the connection from the pool
  • Disabling Selection with CellList
  • Migration solution for singletons in an OSGI environment
  • com.sap.cloud.sdk.frameworks.hystrix.ScpNeoHystrixBootstrapListenerjava.lang.IllegalStateException
  • Eclipse RCP: Problem creating product which needs 2 different versions of a plugin
  • What is the right way to use Java executor?
  • “export as runnable JAR” option is missing
  • When is InputStream.available() useful?
  • ClassNotFoundException: com.mysql.jdbc.Driver not found while using service mix
  • Should ScheduledExecutorService.scheduleAt* methods re-schedule tasks if the task throws RuntimeExce
  • What happened to Guava Constraints? [closed]
  • Is there a way to read an Excel file using Dataflow
  • Java Date object constructor for getting string is deprecated
  • Stacked Bar Chart with percentage composition inside the Bar and total above the Bar in JFreeChart
  • Use allowDiskUse in criteria query with Grails and the MongoDB plugin?
  • How to get the index of element in the List in c#
  • command line of process by name
  • Primefaces lazy datascroller calling load twice
  • Salesforce Different WSDL files and when to use
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • Read text file that is not in the main package in a runnable jar
  • Roxygen error “Skipping invalid path”
  • Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint
  • ImageMagick, replace semi-transparent white with opaque white
  • Cannot connect to cassandra from Spark
  • Is there a amazon webstore API for customers?
  • Java applet as stand-alone Windows application?
  • Cross-Platform Protobuf Serialization
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Jquery - Jquery Wysiwyg return html as a string
  • Circular dependency while pushing http interceptor
  • SQL merge duplicate rows and join values that are different
  • Angular 2 constructor injection vs direct access
  • Linking SubReports Without LinkChild/LinkMaster
  • Reading document lines to the user (python)