Skip to main content

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


> In that document, in the section "The Hook Registry", we find this
> paragraph:
>
> ,----[  hookconfigurators.properties files ]
> | Extension bundles may provide their own hookconfigurators.properties
> | file to specify additional hook configurators. The hook registry will
> | discover all hookconfigurator.properties files on its classpath and
> | will merge all declared configurator classes into one list.
> `----
>
> Note the phrase "on /its/ classpath". What is /it/ here?


Here /it/ means the classpath of the framework implementation.

>
> I ask because I created an extension bundle with a
> hookconfigurator.properties file as specified, located at the root
> directory within the extension bundle jar. The extension bundle gets
> loaded just fine, but it doesn't look like the bundle gets searched by
> HookRegistry.mergeFileHookConfigurators()¹. My bundle's
> hookconfigurators.properties files is never found, and hence my hook
> doesn't get registered.
>
> Should I be able to provide a hookconfigurators.properties file in my
> extension bundle? If so, what do I have to do make it discoverable?
>
>
> Footnotes:
> ¹ On line 108, where ClassLoader.getResources() is called.

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).  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.

If you are not using the equinox launcher to start the Framework then
you will have to add your extension jars to the classpath along
with the org.eclipse.osgi when you are launching the Framework.

Tom


Back to the top