Adding bundles to OSGi application projects
About this task
Bundles can be added to an application as use bundles or application bundles.
Adding bundles to an application as a use bundle
About this task
Bundles are added to the Use-Bundle list to satisfy the package dependencies of bundles in the Application-Content list. Each bundle or composite bundle in the Use-Bundle list must provide at least one package to at least one bundle in the Application-Content list. These bundles are provisioned into the shared bundle space at run time. Provisioning is the process of getting bundles from the repositories.
Shared bundles are not application-specific. A single instance of a package from a shared bundle can be used by many applications. Shared bundles cannot import packages or services from application bundles. Shared bundles in an application must be provided by reference rather than contained directly in an application.
A use bundle is a shared bundle that provides at least one package to an application bundle. Use bundles are referenced in the application manifest in the Use-Bundle header.
Procedure
- In Enterprise Explorer, expand your OSGi application project and then expand META-INF.
- Double-click APPLICATION.MF to open it in the editor.
- In the Shared Bundle Affinity section, click Add and then select the bundle from the list. Click OK.
Adding bundles to an application as an application bundle
About this task
Add bundles to the Application-Content list to include the bundles in the application.
Application bundles are bundles that you create specifically for your application. They are instance-specific and are not shared with other applications. They are referenced in the application manifest in the Application-Content header.
Procedure
- In Enterprise Explorer, expand your OSGi application project and then expand META-INF.
- Double-click APPLICATION.MF to open it in the editor.
- In the Contained Bundles section, click Add and then select the bundle from the list. Click OK.