Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Bundle-ClassPath and resource entries
Bundle-ClassPath and resource entries [message #685815] Mon, 20 June 2011 05:40 Go to next message
Sahoo Missing name is currently offline Sahoo Missing name
Messages: 26
Registered: July 2009
Junior Member
I am new to eclipse and plugin development environment. I wrote a plugin and have configured it to run as "OSGi framework". I see Equinox being launched and my plugin provisioned as shown below:

2	initial@reference:file:../../../../../../../../bugs/libra/plugin1/
  ACTIVE      plugin1_1.0.0.qualifier

I have another bundle which tries to inspect this plugin. It collects all entries in a bundle by recursively calling bundle.getEntry() as shown below:

private void getEntryPaths(Collection<String> entries, String path) {
        Enumeration<String> subPaths = b.getEntryPaths(path);
        if (subPaths != null) {
            while (subPaths.hasMoreElements()) {
                String next = subPaths.nextElement();
                entries.add(next);
                getEntryPaths(entries, next); // recursion
            }
        }
}

For the plugin bundle, the above code reported bundle entries as

bin/
bin/plugin1/
bin/plugin1/Activator.class
META-INF/
META-INF/MANIFEST.MF
src/
...

So far so good. What surprises me is that even though the activator class, plugin1.Activator.class, is inside bin/ folder, the Bundle-ClassPath header is not set in the bundle's metadata and yet Equinox is able to locate the activator. Can anyone please explain how Equinox locates the class from bin/ folder when the Bundle-ClassPath is not set to "bin?" Where is the magic of locating resources from bin folder happening?

Thanks much,
Sahoo

[Updated on: Mon, 20 June 2011 05:42]

Report message to a moderator

Re: Bundle-ClassPath and resource entries [message #685865 is a reply to message #685815] Mon, 20 June 2011 08:48 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas Watson
Messages: 419
Registered: July 2009
Senior Member
There is a configuration option -dev that PDE uses to launch the framework. This option points to a dev.properties file. This file contains configuration data that tells the framework what additional class path entries to add to the bundles class path.

This is a design choice of PDE that provides an approximation of the bundles content when run directly out of the workspace. This is admittedly not 100% accurate with a built (jar'ed) bundle. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=160133

Tom
Re: Bundle-ClassPath and resource entries [message #685912 is a reply to message #685865] Mon, 20 June 2011 13:01 Go to previous message
Sahoo Missing name is currently offline Sahoo Missing name
Messages: 26
Registered: July 2009
Junior Member
Tom,

Thanks for pointing out the bug. That's exactly what I am seeing. I must say I am surprised that the core of Equinox has been changed to handle this specific PDE use case. I guess the same result could be achieved via manifest rewriting using a url handler, but that probably would not have resulted in the kind of optimization that's achieved by avoiding to create a proper jar file in the first place. May I ask one question though? Since internally bin is being treated as a bundle classpath, why is the Bundle.getHeaders().get("Bundle-ClassPath") not reflecting the same?

Thanks,
Sahoo
Previous Topic:Trusted Bundles
Next Topic:can i run p2.process.artifacts from cmd line ant
Goto Forum:
  


Current Time: Tue Jul 22 09:42:31 EDT 2014

Powered by FUDForum. Page generated in 0.10735 seconds