开发者

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
开发者_运维问答

?


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.


Fragments attach to hosts. They cannot attach to other fragments. You can construct capabilities and requirements (new in Core 4.3) to prevent a fragment from attaching to a host unless another fragment is also attached. For example, fragment 1 could provide a capability which fragment 2 requires. This may provide the level of control you seek.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜