Declarative manifest entries provide an option to add, remove and replace manifest headers of a bundle, without modifying the jar file. This is very helpful for:
In such cases framework must implicitly apply the modified headers to the matched bundles.
Requirements
Solution
A separate file – manifest_setup.prs is used to describe manifest headers modification in a declarative way. It is located in bin/vms/ folder.
To enable this functionality the system property mbs.manifest.setup.enabled MUST be set to true.
The manifest_setup.prs file consists of multiple sections and comments with the following format:
<bundle_symbolic_name>(#<version>)?:
<manifest_header_1>: <manifest_header_operation_1>
<manifest_header_2>: <manifest_header_operation_2>
...
<manifest_header_n>: <manifest_header_operation_n>
Sections are separated by either an empty line(s) or a comment line(s). Manifest header operations are performed only if the bundle symbolic name and the bundle version are matched.
The following manifest header operations are defined:
If a header is not available in the original bundle manifest, it will be added automatically by the framework.
An escape character is supported – the ' \ ' symbol.
The following section demonstrates how this functionality is used.
Example
The user may define a manifest_setup.prs file in the bin/vms folder in the following way:
# This is an example manifest setup file. The following lines are examples how manifest header modification/replacement
# mechanism works. Make sure the system property mbs.manifest.setup.enabled is set to true,
# so that this file is taken into account. Character escaping for special symbols is supported.
# Multiple insertions are not supported.
# All sections must start with "<bsn>(#<version>)?:"
# Manifest headers will be modified for the target bundle.
com.prosyst.mbs.osgi.scr#1.0.0:
# adding/replacing of header A with value B
A: B
# removal of header C
C: !
# appending a value E after header D original value
D: +E
# inserting a header F original value between G1 and G2
F: G1*G2
# more examples
U: W*
X: *Y
# insert a "*" value to header
L: *\*
# replace with a "+" value
R: \+
# A section with no version
com.prosyst.mbs.osgi.scr:
X: Y