Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Difference between various bundle location url protocols.
Difference between various bundle location url protocols. [message #520637] Sat, 13 March 2010 15:25 Go to next message
Suraj  is currently offline Suraj Friend
Messages: 16
Registered: November 2009
Location: Bangalore
Junior Member
While installing a bundle we can pass a url with a prefix of "initial:" or "reference:".

I was wondering what exactly is each of these prefix protocols supposed to be.

Basically following this discussion, I decided that I am going to prefix all my bundle urls with a "reference:". So I want to know that by making this change what all can be affected or can be affected.
Re: Difference between various bundle location url protocols. [message #520825 is a reply to message #520637] Mon, 15 March 2010 14:03 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
The reference: protocol only supports a nested file: protocol (e.g. reference:file:<path to bundle>). As stated in the previous thread this causes the framework to load and run the bundle "in place" and will prevent the framework from making its own copy of the bundle content within the framework cache.

This is useful when your management agent has control over its own storage area on disk for downloading and managing the bundles it wants to install. This is what p2 uses to manage the content of the bundles in Eclipse. Keep in mind that if you want to update the content of a bundle this forces you to use a file naming strategy for the different versions of bundles. This is why you may have noticed that the names of the bundle jars in Eclipse use a file name like: <bundle.symbolic.name>_<version>.jar. This is so p2 can down load a new version of the bundle and place it in p2's bundle pool without overwriting a previous version of the bundle. This is required because you cannot simply overwrite a bundle jar which is installed by reference into an Equinox framework instance.

You then need to use Bundle.update(InputStream) method by opening a stream to a new reference: URL or uninstall the old version and install the new version with a new reference URL.

HTH

Tom.
Re: Difference between various bundle location url protocols. [message #521001 is a reply to message #520825] Tue, 16 March 2010 07:35 Go to previous messageGo to next message
Suraj  is currently offline Suraj Friend
Messages: 16
Registered: November 2009
Location: Bangalore
Junior Member
Thanks, I now got the pretty much clear in my head. Using reference scheme helps in reducing our startup time upto 40%.

But I have seen some places with "initial" url/scheme too. What is this "initial" url?
Re: Difference between various bundle location url protocols. [message #521140 is a reply to message #521001] Tue, 16 March 2010 14:46 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Keep in mind that the location string is an opaque string. The framework implementation just happens to interpret it as a URL string if the method BundleContext.installBundle(String location) method is used. This is not actually mandated by the OSGi specification, but it is a general convention that is recommended and implemented as such by most all framework implementations that I know of.

But agents are free to use any format they want when installing a bundle. To do so they can use the BundleContext.installBundle(String location, InputStream content) method. In this case the Equinox launcher uses the "initial" tag in the locations for the bundles it installs as the initial set of bundles configured into the framework (what is specified with the osgi.bundles configuration property). The launcher uses code like this:

URL initialURL = new URL("reference:file:<path to initial bundle>");
String initialLoc = "initial:<path to initial bundle>";
Bundle intialBundle
= context.installBundle(initialLoc, initialURL.openStream();

The use of "initial" in the location stream is simply a way for the launcher to mark the bundles it things it is managing from the osgi.bundles configuration property.

HTH

Tom.
icon14.gif  Re: Difference between various bundle location url protocols. [message #521274 is a reply to message #520825] Wed, 17 March 2010 01:56 Go to previous message
Suraj  is currently offline Suraj Friend
Messages: 16
Registered: November 2009
Location: Bangalore
Junior Member
Thanks Tom, I have some clarity now.
Previous Topic:Enforcing arbitrary bundle requirements
Next Topic:automatic update of workspace bundles
Goto Forum:
  


Current Time: Thu Sep 26 10:51:52 GMT 2024

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

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

Back to the top