Appendix A. OSGi manifest headers – OSGi in Depth

Appendix A. OSGi manifest headers

Manifest header entries are very significant in OSGi as they dictate behavior for several OSGi services and framework features. The following table includes all header entries used in the book. These are the most commonly used header entries in all existing OSGi specifications at the time of writing.

Header name

Description

Bundle-ActivationPolicy Specifies how a bundle should be activated when started. This can be used for the lazy activation of a bundle, as explained in chapter 10. Example: Bundle-ActivationPolicy: lazy
Bundle-Activator Specifies the Java class name of the bundle’s activator. Example: Bundle-Activator: com.manning.osgi.BundleActivator
Bundle-Blueprint Specifies the path of a Blueprint document to be used by the Blueprint container for assembling dependencies in a bundle. This is demonstrated in chapter 13. Example: Bundle-Blueprint: META-INF/blueprint.xml
Bundle-Category Specifies a comma-separated list of category names or tags. This can be used to describe a bundle. Example: Bundle-Category: manning, auction-framework
Bundle-ClassPath Specifies paths within a bundle that are to be used as part of the bundle’s class space. Example: Bundle-ClassPath: /libs/app.jar
Bundle-ContactAddress Specifies the contact address of the vendor. Example: Bundle-ContactAddress: 123 My Road, CA, my@email.com
Bundle-Copyright Specifies the copyright information of the bundle. Example: Bundle-Copyright: Manning© 2011
Bundle-Description Specifies a user-friendly short description for the bundle. Example: Bundle-Description: Manning's OSGi in Depth Auction Application
Bundle-DocURL Specifies a URL pointing to a bundle’s documentation. Example: Bundle-DocURL: http://www.manning.com/alves
Bundle-Icon Specifies a URL within the bundle’s JAR file for an image file, useful for a pictorial representation of the bundle. Example: Bundle-Icon: /images/bundle.jpg;size=64
Bundle-License Specifies license information that can be used to validate the bundle’s usage terms. This can be in some internal format or even a URL. Example: Bundle-License: http://www.manning.com/validate-license.php
Bundle-Localization Specifies the location within the bundle where localization files reside. Example: Bundle-Localization: OSGi-INF/l10n/bundle
Bundle-ManifestVersion Specifies the OSGi specification to be used. For our purposes, it should be set to 2. Example: Bundle-ManifestVersion: 2
Bundle-Name Specifies a user-friendly readable name for the bundle. Example: Bundle-Name: auction application
Bundle-NativeCode Specifies the native code libraries contained within the bundle. Example: Bundle-NativeCode: /lib/io.dll; osname = Linux
Bundle-RequiredExecutionEnvironment Specifies a comma-separated list of execution environments demanded by the bundle. This header has been deprecated in version 4.3 of the OSGi specification. Example: Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0
Bundle-SymbolicName Specifies the non-localizable identity of the bundle. This header together with the bundle version uniquely identify a bundle. Example: Bundle-SymbolicName: com.manning.osgi.auction
Bundle-UpdateLocation Specifies a URL where updates for this bundle can be retrieved. An example of how this can be used is in chapter 10. Example: Bundle-UpdateLocation: http://www.manning.com/alves/auction.jar
Bundle-Vendor Specifies a user-friendly description of the bundle’s vendor. Example: Bundle-Vendor: manning
Bundle-Version Specifies the version of the bundle. This header together with the symbolic name uniquely identify a bundle. Example: Bundle-Version: 1.0.0.1
DynamicImport-Package Specifies a comma-separated list of package names that are imported when needed. This is explained in chapter 4. Example: DynamicImport-Package: com.manning.osgi.*
Export-Package Specifies the exported packages of the bundle. Example: Export-Package: com.manning.osgi
Fragment-Host Specifies the host bundle of this fragment. Example: Fragment-Host: com.manning.osgi.auction; bundle-version="1.0.0.1"
Import-Package Specifies the imported packages for this bundle. Example: Import-Package: com.manning.osgi
Provide-Capability New header in OSGi version 4.3 used to specify a generic capability. Example: Provide-Capability: com.cloudprovider; web-access:Boolean=true; cpu:Long=80
Meta-Persistence Specifies the path to the persistence unit configuration of a JPA persistence bundle. Chapter 7 explains how JPA is used. Example: Meta-Persistence: META-INF/auction-jpa.xml
Meta-Transaction Specifies Java classes to be run in a transactional context. This is part of an example explained in chapter 8. Example: Meta-Transaction: com.manning.osgi.MyTransactionalClass
Remote-Service Specifies the endpoint description of a remote service. This is explained in chapter 7. Example: Remote-Service: META-INF/endpoint.xml
Require-Bundle Specifies dependency to another bundle. As explained in chapter 4, this should be avoided. Example: Require-Bundle: com.manning.osgi.auction
Require-Capability New header in OSGi version 4.3 used to specify a dependency on a provided capability. Example: Require-Capability: com.cloudprovider; filter:="(&(web-access)(cpu<90))"

All manifest header constants can be found on the OSGi website at http://www.osgi.org/javadoc/r4v43/org/osgi/framework/Constants.html.