The manifest file of OSGI bundle

来源:互联网 发布:淘客助手插件 mac 编辑:程序博客网 时间:2024/05/29 13:00

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.

原创粉丝点击