The manifest file of OSGI bundle

Every OSGI bundle is a jar file,and before you compress the bundle to a jar file, a configuration file is necessary,the following is a configuration file example.it is very simple.it belongs to .mf format configuration file.

file manifest.mf

Bundle-Activator: test.Activator
Bundle-Name: simplebundle
Bundle-SymbolicName: simplebundle
Bundle-Description: Demo Bundle
Bundle-Vendor: tiger
Bundle-Category: example
Import-Package: org.osgi.framework
Bundle-Version: 1.0.0
Manifest-Version: 1.0

        the most important properties in preceding file is Bundle-Activator and Import-Package,they are emphasized by an underline. 
        Bundle-Activator tells the framework which is the Activtor class,this is a kind of "main" class of a bundle,after we deploy this bundle to the OSGI framework ,the bundle will start from this class.so we can consider that the Activator class is an entrance of an bundle.
        Import-Package tells the framework that out bundle needs to access the classes in specified package,in the example it is org.osgi.framework.Any bundle needs an special package which is org.osgi.framework,only by this it is a bundle.By the way, a bundle may also need other packages when it is necessary.

發佈了30 篇原創文章 · 獲贊 0 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章