osgiosgi-fragment

Can OSGi fragments have other fragments as hosts?


Is this legal?

MANIFEST.MF for org.fragment1 (org.host is a normal bundle, not a fragment):

Bundle-SymbolicName: org.fragment1
Fragment-Host: org.host

MANIFEST.MF for org.fragment2:

Bundle-SymbolicName: org.fragment2
Fragment-Host: org.fragment1

Or should org.fragment2 instead have

Fragment-Host: org.host

?


Solution

  • Fragment bundles can't have a other fragment bundles as host. Only normal bundles can act as an fragment-host. So your third example is correct:

    Or should org.fragment2 instead have

    Fragment-Host: org.host

    You find this restriction in the OSGi Service Platform Release 4 Version 4.3 Core Specification on page 70. It says:

    A Fragment bundle can not be required by another bundle with the Require-Bundle header.