Community
Participate
Working Groups
Hello, As per Declarative Service's spec (compendium 112.4), a DS implementation should ignore directives and properties in the Service-Component header. As such, an header such as: ------------ >8------------ Service-Component: OSGI-INF/component1.xml;foo:=bar,OSGI-INF/component2.xml;bar ------------ >8------------ should properly find components from definitions located at OSGI-INF/component1.xml and OSGI-INF/component2.xml However, the current Equinox DS implementation fails on this and looks for files named OSGI-INF/component1.xml;foo:=bar and OSGI-INF/component2.xml;bar I ran across this problem because of a bug in maven-bundle-plugin *but* this is also looks like a bug in Equinox DS (it is also BJ Hargrave's interpretation, see http://groups.google.com/group/bndtools-users/msg/e87b9869f449cd14 )
Created attachment 189478 [details] Proposed fix Here's a tentative fix that should be API compatible with the execution environment already set for Equinox DS. I'm using it with no problems, whether manifest have directives/properties or not. It strips the useless parts of the headers, and returns them to the original code expecting them not to have directives. (It might be more efficient to rewrite the parsing routing completely, but I went for a solution that involved no rewrite of existing code to be safe).
Created attachment 189486 [details] proposed fix for header syntax From spec: Service-Component ::= header header ::= clause ( ’,’ clause ) * clause ::= path ( ’;’ path ) * ( ’;’ parameter ) * The current code and the supplied patch do not handle 'clause' where there are ';' separated paths: e.g. Service-Component: OSGI-INF/one.xml; OSGI-INF/two.xml; attr=test; directive:=test This patch uses ManifestElement (the parser supplied by org.eclipse.osgi). DS is already importing the org.eclipse.osgi.util package for the NLS class. You might as well use the ManifestElement class to do this parsing. There are lots of gotchas to parsing this common header syntax. For example, the current code does not handle quoted strings either in the path elements.
Stoyan, please review the patch and release if appropriate. Thanks.
(In reply to comment #2) > Created attachment 189486 [details] > proposed fix for header syntax [snip] Thomas, Thanks for the comments & the patch. Indeed, I was pretty sure there was some class doing appropriate Manifest parsing in Equinox, but I didn't look for it. I also didn't see paths could be separated by semi-colons. Your solution is much better :-). Thanks again!
Comment on attachment 189478 [details] Proposed fix See Thomas Watson's patch.
Thanks for the patch Thomas! I have released it in HEAD.