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.

上一篇:
下一篇:

发表评论

邮箱地址不会被公开。 必填项已用*标注

昵称 *