Manipulating MANIFEST headers while deploying bundles through a PLAN file [message #642613] |
Thu, 02 December 2010 01:01 |
Amit Kumar Messages: 3 Registered: December 2010 |
Junior Member |
|
|
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: Thu, 02 December 2010 01:40] Report message to a moderator
|
|
|
|
Re: Manipulating MANIFEST headers while deploying bundles through a PLAN file [message #643040 is a reply to message #642928] |
Fri, 03 December 2010 17:52 |
Amit Kumar Messages: 3 Registered: December 2010 |
Junior Member |
|
|
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 17:54] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04031 seconds