[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Re: Embedding Equinox OSGi and EclipseStarter

Thomas Watson <tjwatson@xxxxxxxxxx> writes:

> There is a chicken and egg issue here when loading hook
> configurators.  In order to get your hook configurator loaded your
> framework extension bundle must be on the framework's classpath
> before the framework is launched.  In a typical eclipse environement
> this is done by the org.eclipse.equinox.launcher (or startup.jar in
> <= 3.2.x).

At present, I'm using my own launcher program that calls on
EclipseStarter.run(), but it sets up the
EclipseStarter.PROP_EXTENSIONS (osgi.framework.extensions) property

> The launcher reads the "osgi.framework.extensions" property and
> discovers the extensions listed in that property.  These extension
> jars must be colocated with the org.eclipse.osgi jar.  If you do not
> do this then the extension jar will get loaded after all the hook
> configurators have run.  At this point it is too late.

Well, my extension bundle is collocated with the org.eclipse.osgi JAR,
and I've traced through the startup with the debugger and seen my
extension bundle get discovered by way of the property mentioned above
and loaded. I can run the "ss" command at the console and see my
bundle there, noted as a fragment to the system bundle.

> If you are not using the equinox launcher to start the Framework

Just to be sure, is it correct that EclipseStarter is not the same
thing as the Equinox Launcher?

> then you will have to add your extension jars to the classpath along
> with the org.eclipse.osgi when you are launching the Framework.

I just tried that and my hooks were discovered and activated. You were
right: Though my extension bundle was in the right location, it was
not on the classpath. This kind of classpath configuration is easy to
set up when running in an IDE, but less for in a delivered

It sounds like I need to implement something similar to
org.eclipse.equinox.launcher's dynamic configuration of the classpath
at start time, or give up on using the bundle-specific
hookconfigurators.property file. I just went and looked at the source
for launcher.Main, and it made my head swim. The
readFrameworkExtensions() method is just the tip of the iceberg.

Steven E. Harris