I have a fragment bundle with a component that has an @Activate
-annotated activate
method. I can't find any definite information on whether this should or should not work.
On the one hand, it probably should work, in the sense that the Framework attaches a fragment to the host, then restarts the host. The component's activate
method would then fire up, since it's now part of the host, which activates once more.
On the other hand, it probably should not work, since the Framework would not restart the host when attaching the fragment. In which case, the activate
method never fires.
I tried tinkering with my bundle on my own, and it seems to not work, but I'm not sure if this is because of the latter case I mentioned above, or because of something else. I tried looking at the documentation, and there's no mention of how the Framework handles the lifecycle of a fragment and host during attachment, beyond the fact that the fragment gets resolved.
My question, then, is what does the OSGi Framework do with the host when attaching a newly-deployed fragment?
Declarative Services does not support the Service-Component
header in fragment manifests. So while the classes of a component and the XML component description for a component can come from a fragment, any Service-Component
header in a fragment's manifest is not processed.
See https://osgi.org/specification/osgi.cmpn/7.0.0/service.component.html#d0e38069.