Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358700 - p2 does not respect non-JAR bundle containers via "Bundle File Factory Hook"
Summary: p2 does not respect non-JAR bundle containers via "Bundle File Factory Hook"
Status: CLOSED WONTFIX
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-23 06:07 EDT by R. Oldenburg CLA
Modified: 2019-09-01 09:26 EDT (History)
2 users (show)

See Also:


Attachments
patches on frameworkadmin.equinox to avoid exceptions on proprietary bundle containers (5.55 KB, patch)
2011-09-23 06:54 EDT, R. Oldenburg CLA
no flags Details | Diff
patches on simpleconfigurator.manipulator to avoid exceptions on proprietary bundle containers (2.76 KB, patch)
2011-09-23 06:54 EDT, R. Oldenburg CLA
no flags Details | Diff
patches on frameworkadmin.equinox to avoid exceptions on proprietary bundle containers (5.72 KB, patch)
2011-09-27 09:22 EDT, R. Oldenburg CLA
no flags Details | Diff
patches on simpleconfigurator.manipulator to avoid exceptions on proprietary bundle containers (3.29 KB, patch)
2011-09-27 09:22 EDT, R. Oldenburg CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description R. Oldenburg CLA 2011-09-23 06:07:28 EDT
Build Identifier: Build id: 20100917-0705

On http://wiki.eclipse.org/Adaptor_Hooks there is a description for "Bundle File Factory Hook" which allows bundle source containers other than directories and JARs.

We use that feature and it is working like a charm.
Now we started to integrate p2 for self-provisioning updates.
We let buckminster build a standard p2.site in which the container format is changed to a custom type (still having file extension "jar" which may be dirty but eases a lot and did not do any harm until now). p2 site is being re-processed (fixing md5 sums, etc.).

Now there is a (as it seems unnecessary) problem:
p2 does not take into account the available bundle file factory hooks.
This causes the installation routine of p2.director / p2.installer to crash when it comes to the "configure" phase.

Funny thing is:
p2 already has the manifest of every bundle from the repository (contents.jar/xml).
It installs all plugins/bundles correctly by copying them to the "plugins" folder.
Then when it comes to generate the configuration data (simpleconfigurators bundles.info) then all bundles are often handled as plain "jars" (utilizing ZipFile or JarFile or "jar:" URL) *just to simply get the manifest*; even more often only the symbolicName or the bundle version is being needed. All these infos are already available in frameworkadmin BundleInfo. (Which is given as a parameter to all these routines)
And still: If it would not be available it could be read from the bundle by using the registered osgi bundle file factory hooks.

My current workaround is:
I debugged the p2.installer run. Stopped on every point, where manifest infos were needed. Changed the code to use the already present BundleInfo manifest string (sometimes it was neccessary to parse the manifest String to a Map).

Result: Installation is successfully completed, although the container format is not readable as a JAR.

I am currently collecting the changes, that I needed to make.
I believe it affected only one class in "org.eclipse.equinox.frameworkadmin.equinox" and one class in "org.eclipse.equinox.simpleconfigurator.manipulator".

Will add the infos as a comment when ready.

Reproducible: Always

Steps to Reproduce:
1. create a bundle file factory hook for proprietary container format
2. create update site with eclipse rcp product
3. convert bundles to proprietary container format
4. reprocess p2 metadata repository to be valid
5. install product as standalone version
Comment 1 R. Oldenburg CLA 2011-09-23 06:54:31 EDT
Created attachment 203890 [details]
patches on frameworkadmin.equinox to avoid exceptions on proprietary bundle containers

patches are marked with XXX comments
Comment 2 R. Oldenburg CLA 2011-09-23 06:54:59 EDT
Created attachment 203891 [details]
patches on simpleconfigurator.manipulator to avoid exceptions on proprietary bundle containers

patches (marked with XXX)
Comment 3 R. Oldenburg CLA 2011-09-23 18:51:54 EDT
In the meantime I encountered some further (or better: additional) problems on using p2 for non-JAR bundle containers.

The inital p2 installation of non-jar bundles is working for me with the attached patches. (Although I am still hoping for a solution which saves me from patching eclipse bundles).
But when *updating* such an installation with some new non-jar-bundles, SimpleConfiguratorManipulator still has problems with creating the "bundles.info".

And this time (within SimpleConfiguratorManipulatorImpl.updateBundles()) the manifest string is empty in the created BundleInfo (which is inevitable as these BundleInfos seem to be created from the already existing initially parsed "bundles.info", which obviously does not contain the manifest info).

I really hoped, it would be possible to instrument the StorageHook (also part of the adaptor hooks) in order to adapt the capabilities at least for the EclipseStorageHook.getManifest() method. (Which seems to be the problem currently)

It's a pity that EclipseStorageHook is implemented as *final*. I tried working around by delegating from my impl of StorageHook. But doing that resulted in some ClassCastExceptions because there are some routines which do a straight cast from StorageHook to EclipseStorageHook...

By the time I am getting short on ideas...
Did I miss something?
Comment 4 R. Oldenburg CLA 2011-09-27 09:20:21 EDT
Ok, I couldn't leave it that way...

So i played around.
As EquinoxBundlesState itself has a BundleContext it is possible to query that instance for all (already known) installed bundles which in fact allows me to get the (current, already loaded and supposedly cached) manifest.

So I re-attach my extended patches to this bug.

I should mention:
I currently work on Helios SR1 because this is our current productive environment. ASAP I will try to get these patches working for Indigo.

Maybe I am doing some major mistakes with this solution ... but ... actually it is working. 

But then again maybe we are currently the only ones using the Base Adaptor Hooks for non-JAR bundle containers.

Any comment is appreciated. :-)
Have fun!
Comment 5 R. Oldenburg CLA 2011-09-27 09:22:03 EDT
Created attachment 204074 [details]
patches on frameworkadmin.equinox to avoid exceptions on proprietary bundle containers
Comment 6 R. Oldenburg CLA 2011-09-27 09:22:30 EDT
Created attachment 204075 [details]
patches on simpleconfigurator.manipulator to avoid exceptions on proprietary bundle containers
Comment 7 Eclipse Genie CLA 2019-09-01 09:26:25 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.