Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Any way to programmatically change OSGi Framework's configuration
Any way to programmatically change OSGi Framework's configuration [message #898492] Thu, 26 July 2012 09:30 Go to next message
Severin Gehwolf is currently offline Severin Gehwolf
Messages: 40
Registered: June 2010
Member
Hi,

We are working on an JVM instrumentation tool[1] and would like to have an Eclipse based client. The problem is that we need certain packages which come from the JVM itself exported in an OSGi sense so that an Eclipse plug-in client would be able to consume packages exported by core thermostat bundles.

The way we are solving this now is to use the org.osgi.framework.system.packages.extra property in order to tell Equinox about which packages to export. However, I would assume there's a bit of an chicken and egg problem involved if we wanted to do this from code (i.e. not requiring eclipse.ini changes). By the time our Eclipse bundle starts, the framework will have started and I don't seem to figure out how to change it's config after it's birth, just before our plug-in is attempted to be resolved.

Is there a way to programmatically change Equinox'es framework config? Thanks for any pointers! We'd like to do something like this (lines 110-123): http://icedtea.classpath.org/hg/thermostat/file/e645fdf087e1/launcher/src/main/java/com/redhat/thermostat/launcher/Thermostat.java


I'm happy to provide more details if I'm unclear.

Thanks!
--Severin


[1] http://icedtea.classpath.org/thermostat/
Re: Any way to programmatically change OSGi Framework's configuration [message #898547 is a reply to message #898492] Thu, 26 July 2012 10:52 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas Watson
Messages: 420
Registered: July 2009
Senior Member
There is no way to directly change the configured org.osgi.framework.system.packages.extra property at runtime, but you can install a "dummy" fragment to the system bundle (symbolic name system.bundle) that exports the extra packages provided by the execution environment. This dummy fragment would be a jar file with a single file being the manifest that would look like this:

Bundle-ManifestVersion: 2
Bundle-SymbolicName: extra.stuff
Bundle-Version: 1.0
Fragment-Host: system.bundle
Export-Package: extra.stuff

Caution the link you provided is GPL code.
Re: Any way to programmatically change OSGi Framework's configuration [message #898718 is a reply to message #898547] Fri, 27 July 2012 06:39 Go to previous message
Severin Gehwolf is currently offline Severin Gehwolf
Messages: 40
Registered: June 2010
Member
Thank you, Thomas. That was exactly what I was looking for. BTW: Thermostat is GPL with Classpath Exception.
Previous Topic:how to run Equinox Framework
Next Topic:[p2] How to update document folder (e.g. pdf-files)
Goto Forum:
  


Current Time: Thu Jul 31 01:38:03 EDT 2014

Powered by FUDForum. Page generated in 0.02525 seconds