Reputation: 8963
I have a fragment bundle that I created to access some add functionality to a second-party jar. My fragment should register a service to expose this new functionality. It doesn't seem to work. Before I get deep into troubleshooting, I'd like to know if this is even allowed? That is, does Felix SCR's bundle watcher look at or ignore fragments?
Upvotes: 7
Views: 1959
Reputation: 1632
Yes. But the host bundle must be open to this. By open, I mean the host bundle must have the Service-Components
header configured such that any descriptors in the fragment will be found. For example:
Service-Components: OSGI-INF/*.xml
will find all .xml
files in the OSGi-INF/
folder of the host bundle all the attached fragments.
I saw Eclipse SmartHome project use this solution to make their UI more customizable.
More information: http://apache-felix.18485.x6.nabble.com/DS-amp-fragments-td5004610.html
Upvotes: 6
Reputation: 8963
Aha, I found the answer myself in the spec, section 112.4.2: "A Service-Component manifest header specified in a fragment is ignored by SCR." This is consistent with 3.14.3: "The following list contains the headers that must not be used in a fragment bundle: Bundle-Activator"
Upvotes: 9