Provisioning for OSGi applications
When you import an enterprise bundle archive (EBA) file as an asset, or update an asset to use new bundle versions, or add a composite bundle as an extension to a composition unit, provisioning ensures that all the required OSGi bundles are available. An OSGi application can use bundles from external repositories, bundles from the internal repository, and bundles that are included in an EBA file or a composite bundle archive (CBA) file.
As an OSGi application becomes formalized, the developer creates an application manifest that lists all the bundles that the application uses directly. Of this set of bundles, the developer might choose to package up only newly-created bundles in the EBA file, expecting other bundles to be provisioned from the configured local and remote bundle repositories. Similarly, the developer of a composite bundle creates a composite bundle manifest that lists all the bundles that the composite bundle uses. Of this set of bundles, the developer might choose to package up some bundles to be directly available to the composite bundle, and expect other bundles to be provisioned from the configured bundle repositories.
- The EBA file.
- The CBA file.
- The internal bundle repository.
A WebSphere® Application Server installation has one internal bundle repository. You can add an OSGi bundle or a composite bundle to the internal repository. If a bundle is used by many OSGi applications, consider adding that bundle to the internal repository.
- External bundle repositories.
You can specify the location of one or more external bundle repositories that contain the bundles that the application requires. Depending on how the external bundle repository is implemented, you might not be able to use it to provision services, or to store composite bundles or bundles referenced by composite bundles.
- Referenced bundle. This is a bundle that is referenced in the application or composite bundle manifest, and not directly contained in the EBA file or composite bundle.
- Dependency bundle. This is a bundle that is not referenced in the application or composite bundle manifest, but is needed by a bundle that is referenced in the application or composite bundle manifest. There might be more than one level of dependency for such a bundle. That is, a dependency bundle might itself be dependent on another dependency bundle.
Provisioning occurs for an EBA asset when the OSGi application is initially imported, and when the asset is subsequently updated. The asset is resolved; that is, the locations of the constituent application bundles, at appropriate versions, are determined by using the contents of the EBA file, the internal bundle repository, and the specified set of external bundle repositories. Similarly, provisioning occurs when you add a composite bundle as an extension to a composition unit. The locations of the constituent bundles, at appropriate versions, are determined by using the contents of the composite bundle and the available bundle repositories.
Provisioning also checks for dependencies and locates them from the relevant bundle repositories. Dependencies include imported packages, required bundles, services, and persistence providers. The provisioning process detects service dependencies by checking the <service>, <reference>, and <reference-list> elements in the Blueprint XML files for a bundle. Bundles are scanned for Blueprint XML files when the bundles are added to the internal bundle repository, or when they are provided in an EBA or CBA file. If your application code makes direct programmatic use of OSGi services, provisioning does not detect those service dependencies unless they are also specified in the Blueprint XML files.
If a bundle is referenced in the application manifest with a range of possible versions, provisioning locates a bundle at a version in that range. If more than one version of a specified bundle is available, the latest version in the specified range is selected, unless selecting a later version prevents the application from resolving.
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.
- Add the bundle to the EBA or CBA file.
- Upload the bundle to the internal bundle repository.
- Find the bundle in an external bundle repository, and specify the location of that repository.
When all bundle downloads are complete, you can add the asset to a business-level application, or update the OSGi composition unit, so that the business-level application uses the newer configuration.