Previous Topic

Next Topic

Book Contents

Book Index

Configure the Set of Bundles within the Image

Bundles extend the platform with specific functionality interacting with each other and with the framework. To prepare the list of bundles of the image, go to the Bundles section of the Image Description file. When ready, do not forget to save the Image Description file.

When an OSGi Image created with an earlier version of the SDK is imported, mToolkit will automatically ask if the bundles should be updated.

Adding Bundles

The Image Builder supports several formats for including bundles in an image reflecting the most popular ways in which bundles are distributed.

From the Eclipse Workspace

As previously mentioned, to be able to add a bundle from the active workspace to your image, it must be distributed as a plugin project that is being developed or as an archive in the target platform.

  1. Click the Add button from the Bundles section of the Image Description file editor.
  2. In the Add bundles dialog, select Workspace and Target Platform Bundles for Bundle type.

    As a result, a list will appear showing the bundles available as projects in the workspace (Maven including) and in the target platform definition that are not already added to the image.

  3. Select the bundle(s) to add to the image.

  4. Click OK to confirm.

From a Location Outside Eclipse

To extend the image with bundle JAR files residing in your local file system:

  1. Click the Add button from the Bundles section of the Image Description file editor.
  2. In the Add bundles dialog, select External Bundles for Bundle type.
  3. Use the Browse button next to the Bundle locations field, and from the file system select one or more bundle archives.
  4. Click OK to confirm adding the bundles.

As Maven Projects

To add bundles which are modeled as Maven projects either from the Eclipse workspace or from a location outside the development environment:

  1. Click the Add button from the Bundles section of the Image Description file editor.
  2. In the Add bundles dialog, select Maven-built Bundles for Bundle type.
  3. Then, depending on the location of the Maven projects:
    1. Select Workspace Maven projects and check the projects to add available from the active workspace.
    2. Select External Maven projects, and browse to directory which contains your Maven projects. Then check the projects of interest.

  4. Click OK to confirm.

Resolve Dependencies of Bundles

To include all bundles from the target platform and from the workspace that are needed to resolve the dependencies of the bundles currently added to the target image, click the Add Required Bundles button. You can choose to include optional dependencies by selecting the Include optional dependencies when computing bundles requirements checkbox.

Configure a Bundle's Activation Policy

You can define the activation policy of the bundles included in the target image by choosing an option in the Activation Policy column of the bundles table or from the properties of the bundle:

Specify a Bundle's Start Level

The start level of a bundle determines its startup priority. If its level is higher that the one defined for the framework, it will not be started. By default, upon adding a bundle its startup level is set to 4. To change it, double-click on the Start Level property and enter the new value, or click the Properties button and enter the level there.

Editing a Bundle Entry

To change a bundle entry for example with a new update:

  1. Select the bundle.
  2. Click the Edit button.
  3. In the Bundle Properties dialog that appears, specify the replacement JAR file:
    1. Click the Select bundle button.
    2. Specify the location of the bundle. Similarly to adding bundles to the image you can replace the bundle JAR file with an update from the workspace in the form of a plugin project or a Maven project, or from outside the Eclipse workspace.
    3. Set a start level if needed.
    4. Specify different activation policy as described in the "Configure a Bundle's Activation Policy" section above.
  4. Click OK to apply the update.