Application bundles, use bundles and provision bundles
Application bundles are instance-specific, and each instance of an application includes its own instance of the bundle. Shared bundles are not instance-specific, and a single instance of a package or service from a shared bundle can be used by many applications. Shared bundles are further sub-divided into use bundles and provision bundles.
Application bundles
Application bundles are bundles that you create specifically for your application. They are instance-specific or isolated; that is, they are not intended to be shared. They are referenced in the application manifest in the Application-Content header.
Shared bundles
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 must be provided by reference rather than contained directly in an application.
- Use bundles
- A use bundle provides at least one package to an application bundle. Use bundles are shared bundles that are referenced in the application manifest in the Use-Bundle header.
- Provision bundles
- A provision bundle provides at least one package or service to an application bundle, a use bundle or another provision bundle. Provision bundles are not referenced in the application manifest, and your application does not know how the requirement for each provision bundle is satisfied.
If you have two separate OSGi applications, and you want them to share the same API classes, you can package those classes as a shared bundle then reference that bundle in the Use-Bundle header of both application manifests. For administrators, another benefit of use bundles is that you can monitor and update them using the administrative console or wsadmin commands.
Bundle usage and bundle provisioning terminology
- The enterprise bundle archive (EBA) file for the application.
- The internal bundle repository.
- External OSGi bundle repositories.
Application bundles can be stored either in the EBA file or in a repository. Shared bundles are stored in a repository (otherwise they cannot be shared).
- Referenced bundles
- A referenced bundle is a bundle that is referenced in the application manifest, and stored in a repository.
- Dependency bundles
- A dependency bundle is a bundle that is not referenced in the application manifest, but that is used by bundles that are referenced in the application manifest, or by other dependency bundles.
- Application bundles that are not directly contained in the EBA file are instance-specific referenced bundles.
- Use bundles are shared referenced bundles.
- Provision bundles are shared dependency bundles.