Developing a composite bundle
A composite bundle groups shared bundles together into aggregates. It provides one or more packages at specific versions to an OSGi application. You can also extend a deployed application by adding one or more composite bundles to the composition unit for the application. You can use OSGi application tooling to develop a composite bundle.
About this task
When you want to ensure consistent behavior from a set of shared bundles in an OSGi application, you use a composite bundle to provide that set of bundles to the application. If a required package or service is available at the same version from both a bundle and a composite bundle, the provisioning process selects the package or service from the composite bundle.
When you want to extend a deployed business-level application that contains an OSGi application, and you do not want to stop the application or modify the underlying EBA asset, you add one or more composite bundles to the composition unit.
A composite bundle is packaged as a composite bundle archive (CBA) file. This file is a compressed archive file with a .cba file extension. If the composite bundle is part of an enterprise OSGi application, the CBA file can be directly contained within the enterprise bundle archive (EBA) file for the application, or pulled in by reference from the internal bundle repository or from an external repository that can process composite bundles. A composite bundle can directly contain bundles in its CBA file. It can also include by reference bundles that are hosted alongside the CBA file within the same EBA file, or bundles that are installed in the same bundle repository.
A composite bundle is described in a composite bundle manifest file, META-INF/COMPOSITEBUNDLE.MF. This manifest file lists the OSGi bundles that are directly contained in the composite bundle, and the reference bundles that are hosted alongside the composite bundle in the same EBA file, or in the same bundle repository.
If you want to use your composite bundle to extend a deployed application, you must install the CBA file in the internal bundle repository or in an external repository that can process composite bundles. If you install a composite bundle in a bundle repository, and the composite bundle includes bundles by reference, you must ensure that the referenced bundles are also available in the same repository. If you use the internal bundle repository, and the composite bundle directly contains bundles, the contained bundles are not listed separately and are only available as part of the composite bundle. For more information, see Composite bundles.
OSGi application design guidelines Version 8.5 provides graphical support for creating and packaging composite bundles. You can also use other tools.
Procedure
What to do next
- If you have configured an enterprise OSGi application to use your composite bundle, you can now import the application as an asset. See Deploying an OSGi application as a business-level application.
- If you want to use your composite bundle to extend a composition unit, see Adding or removing extensions for an OSGi composition unit.