Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Simple configurator and bundle uninstall(How to remove bundle from configuration)
Simple configurator and bundle uninstall [message #1405063] Wed, 06 August 2014 13:33 Go to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 149
Registered: March 2010
Senior Member
Hi,

I want to remove an unused bundle at runtime (both uninstall it and remove it from bundles.info configuration file). How do I go about doing that in code?

Currently, what I've done is call (during start-up):

   myNoLongerUsedBundle.uninstall();


This uninstalls the bundle (when I go to Help->About->Plugin Details it is not there) but it is still present in the configuration area (configuration/org.eclipse.equinox.simpleconfigurator/bundles.info).

How do I "properly" remove it from there? I want the P2 garbage collector application (eclipse -application org.eclipse.equinox.p2.garbagecollector.application -profile SDKProfile) to actually end up deleting the bundle altogether. It seems to me that the presence of the bundle in bundles.info prevents that. I understand one is not supposed to "delete files from the plugin folder" and neither should we "edit bundles.info manually".

So how do we I got about updating bundles.info from my code, to remove the bundle? It is no longer required and nothing references it as a dependency...
Re: Simple configurator and bundle uninstall [message #1405123 is a reply to message #1405063] Wed, 06 August 2014 16:29 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 333
Registered: July 2009
Location: Ottawa
Senior Member
To remove the bundles from the running instance, get the instance of the Configurator service and call the applyConfiguration method.
Once this is done you should be able to call p2 GC. You can try to run the application using hte application service, or you can use the internals.
Re: Simple configurator and bundle uninstall [message #1405171 is a reply to message #1405123] Wed, 06 August 2014 19:09 Go to previous message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 149
Registered: March 2010
Senior Member
Hello Pascal,

First off, I really appreciate your pointers. Can you elaborate on how to use the internals? I still get a ClassNotFoundException for the configurator.

What I've done so far based on your instructions is that I added the following after the uninstall call:

	BundleContext context = Activator.getDefault().getContext();
	ServiceReference<?> reference = context.getServiceReference(
		"org.eclipse.equinox.internal.provisional.configurator.Configurator");
	Configurator result = (Configurator) context.getService(reference);


Within the IDE the code works, even though I get the warning:

Discouraged access: The type Configurator is not accessible due to restriction on required project 
	 org.eclipse.equinox.simpleconfigurator


When I launch the application from outside the IDE, I get this error:

Caused by: java.lang.ClassNotFoundException: org.eclipse.equinox.internal.provisional.configurator.Configurator
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 37 more


P.S. To avoid the access restrictions for invoking the P2 garbage-collector, I scan the extension registry and start the application as described here..
Previous Topic:[SOLVED] Using P2 garbage collector
Next Topic:How to load all bundle in a directory with config.ini?
Goto Forum:
  


Current Time: Fri Apr 19 06:10:55 GMT 2024

Powered by FUDForum. Page generated in 0.01956 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top