Bug 331926

Summary: Allow PLAN-artifact-property to append manifest headers instead of replacing them
Product: [RT] Virgo Reporter: Amit Kumar <allahamit>
Component: unknownAssignee: Project Inbox <virgo-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: eclipse, nobody, zteve.powell
Version: unspecifiedKeywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Amit Kumar CLA 2010-12-06 12:03:26 EST
Build Identifier: Spring DM Server 2.0.0.RELEASE/Virgo Latest

Background Discussion : http://www.eclipse.org/forums/index.php?t=rview&th=201215&notify=1&opt=off

The idea is to allow appending a MANIFEST header value as dictated during deployment of a bundle to the already existing header value in the bundle MANIFEST.MF. e.g.

If a bundle 'foo.jar [1.0.0]' has a MANIFEST.MF with following entry -

Import-Package: com.org.bundle.package;version="1.0.0"

and this bundle is deployed using following PLAN entry -

<!-- The intention here is to append the specified package to the existing Import-Package header in the bundle Manifest. -->

<artifact type="bundle" name="foo" version="1.0.0">
<property name="header:Import-Package" value="com.org.anotherbundle.anotherpackage;version=1.0.0"/>
</artifact>

Then, the expansion of 'Import-Package' header during deployment is expected to be 'com.org.bundle.package;version="1.0.0",com.org.anotherbundle.anotherpackage;version="1.0.0"'

To achieve this functionality, the convention for append could be one of the following -
1. If the specified value in the PLAN file is wrapped within append().
2. If the specified value in the PLAN file begins with a '.' or '+' char.

The code to follow for implementing this enhancement (for Virgo) is -

Package: org.eclipse.virgo.kernel.deployer.core.internal
Class: BundleDeploymentPropertiesTransformer.java
Method: doTransformBundleArtifact()
Snippet: manifest.setHeader(headerName, entries.getValue()); // Line 52


Reproducible: Always

Steps to Reproduce:
Please follow the discussion thread at http://www.eclipse.org/forums/index.php?t=rview&th=201215&notify=1&opt=off
Comment 1 Nobody - feel free to take it CLA 2010-12-06 14:37:02 EST
Thanks for raising this. I think the cleanest way to define append would be to use a different property name prefix such as "headerAppend:Import-Package" which would simply add the specified value to the end of the specified header or create the header if it did not already exist.
Comment 2 Nobody - feel free to take it CLA 2010-12-06 14:37:41 EST
Flagging as helpwanted since this should be relatively easy to implement.
Comment 3 Amit Kumar CLA 2010-12-06 15:45:29 EST
I completely agree that header prefix 'headerAppend' is a much cleaner way to implement this. Did not strike me earlier.