6. OSGi Profiles and Bundlor

When managing and transforming bundles it can become difficult to remember which packages are boot delegated, which are exported from the system bundle, and which are from other bundles in your system. This information is important because you typically do not want to import packages into your own application that are boot delegated, you want to import system bundle packages at version 0, and you want to define custom imports for all the rest of the bundles. Trying to keep track of which packages are in each of these categories can be error prone; similarly, defining template entries for them in your manifest template can be time-consuming and tedious.

To solve this problem, you can specify that Bundlor take an OSGi profile as input and automatically add template entries for boot delegated packages and system bundles. These import entries would ignore boot-delegated packages and set the version of system bundles to version="0". This feature is available for all Bundlor front ends: command-line, ANT and Maven.

6.1 Overview of OSGi profiles

An OSGi profile defines the packages that a particular OSGi runtime (such as Virgo) exports from the system bundle and the packages that it delegates to the boot class loader. An OSGi profile isn't an actual file; rather, it is two properties that are well known to an OSGi runtime. However, when you pass these properties to Bundlor, you pass them as a file, as described in the next section. The properties that make up an OSGi profile are as follows.

  • The org.OSGi.framework.system.packages property defines the packages exported from the system bundle.
  • The org.OSGi.framework.bootdelegation property defines the packages that are boot delegated.

If you are using Virgo as your OSGi runtime, see the file $VIRGO_HOME/configuration/java6-server.profile for its OSGi profile, where $VIRGO_HOME refers to the main installation directory of Virgo. If you are using another OSGi runtime, such as Equinox, then see their documentation for their OSGi profile.

For additional information about the syntax of the values of these properties, see the OSGi Core specification.