Skip to main content



      Home
Home » Eclipse Projects » Virgo » Manipulating MANIFEST headers while deploying bundles through a PLAN file(Manipulating MANIFEST headers while deploying bundles through a PLAN file)
Manipulating MANIFEST headers while deploying bundles through a PLAN file [message #642613] Wed, 01 December 2010 20:01 Go to next message
Eclipse UserFriend
Use Case :

Add a custom Tomcat Valve implementation in tomcat-server.xml. The valve can function as the user-principal initializer if there is a given request header set (OAM cookie) or can provide any other custom implementation.

I have a bundle library created for implementing the required feature. The implemented Valve depends on Tomcat APIs (Catalina libraries). I have copied my JAR under $SERVER_HOME/repository/ext.

Now, when I try to configure this valve in $SERVER_HOME/config/tomcat-server.xml, the DM server fails to start due to missing classes (My Valve in this case).

So, I needed to tell Spring DM extender to somehow load my classes when loading bundle com.springsource.osgi.webcontainer.tomcat, it should also load my bundle. In dependencies terms, it simply means, I have to modify the MANIFEST of bundle com.springsource.osgi.webcontainer.tomcat and add my JAR/Package to 'Import-Bundle' or 'Import-Package' header.

Fortunately, com.springsource.osgi.webcontainer.tomcat bundle is deployed using the PLAN file under repository/ext,
named com.springsource.server.web-2.0.0.RELEASE.plan, and I can manipulate the bundle manifest headers using following syntax in the PLAN -


<artifact type="bundle" name="com.springsource.osgi.webcontainer.tomcat" version="[1, 2)">
<property name="header:Import-Bundle" value="oam.plugins.tomcat;version=1.0.0"/>
</artifact>

Things work perfectly for me at this point without touching the com.springsource.osgi.webcontainer.tomcat bundle. However, this overwrites the existing Import-Bundle headers in com.springsource.osgi.webcontainer.tomcat if any during deploy.

Question:

Is there a way I can append my bundle to the 'Import-Bundle' header through similar configuration. I wish there was a feature to support this 'concatination' behavior for Manifest headers through the <property> attribute in the PLAN. I am not aware if there is already a feature currently supported for this.

I would appreciate any comments with respect to this.

[Updated on: Wed, 01 December 2010 20:40] by Moderator

Re: Manipulating MANIFEST headers while deploying bundles through a PLAN file [message #642928 is a reply to message #642613] Fri, 03 December 2010 06:38 Go to previous messageGo to next message
Eclipse UserFriend
There is no support for, or enhancement bugzilla to add, that kind of append mechanism. I'm not sure what it would take to implement - could be pretty expensive if it involved a core Spring change.

There are a couple of alternatives though. Firstly, the Tomcat bundles will never use Import-Bundle as we avoid making their manifests Virgo specific, so you may simply continue to add an Import-Bundle header. Secondly, if you don't like this, you could create a fragment to attach to the Tomcat bundle which would specify either Import-Bundle or Import-Package in the fragment's manifest.

Hope that helps.
Re: Manipulating MANIFEST headers while deploying bundles through a PLAN file [message #643040 is a reply to message #642928] Fri, 03 December 2010 12:52 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for your response Glyn. I was not aware that a Fragment would let me manipulate any/all of the host bundle MANIFEST. Also, this approach requires more work and a little complex than the first one. So, for the time being I will continue with my first approach.

On the other hand, I was hoping that, it was not very difficult to support the 'concatinate' behavior for MANIFEST headers during bundle deployment.

Following is the code fragment I was targeting, which could be a possible place for implementing this feature -

Bundle : com.springsource.kernel.deployer-2.x.x.RELEASE.jar
Package : com.springsource.kernel.deployer.core.internal
Class : BundleDeploymentPropertiesTransformer.java
Method : doTransformBundleArtifact()
Code Fragment: manifest.setHeader(headerName, ...)

I may not be aware of the other complexities involved in supporting this feature, so might be off the track here.

[Updated on: Fri, 03 December 2010 12:54] by Moderator

Re: Manipulating MANIFEST headers while deploying bundles through a PLAN file [message #643292 is a reply to message #643040] Mon, 06 December 2010 07:09 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for investigating. I was not familiar with that piece of code. Please would you raise an enhancement bugzilla as the implementation now seems tractable.
Re: Manipulating MANIFEST headers while deploying bundles through a PLAN file [message #643379 is a reply to message #643292] Mon, 06 December 2010 12:05 Go to previous message
Eclipse UserFriend
Thanks for your reply Glyn. I have requested the enhancement here : https://bugs.eclipse.org/bugs/show_bug.cgi?id=331926
Previous Topic:Cannot find Dynamic Module annotations on Virgo
Next Topic:Eclipse Virgo shutdown
Goto Forum:
  


Current Time: Tue Jul 22 11:46:38 EDT 2025

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

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

Back to the top