Import an OSGi application as an enterprise bundle archive
(EBA) asset, then add the asset to a business-level application by
creating a composition unit. Optionally, add a composite bundle extension
to the composition unit.
Before you begin
This topic assumes that you have already created an enterprise
OSGi application packaged as an EBA file, for example as described
in Creating an OSGi application. You might also
have developed a composite bundle extension, as described in Extending a deployed OSGi application.
As well as specifying the configuration information for the EBA asset through the following procedure, you can also change it later as described in Modifying the configuration of an OSGi composition unit. For example, if you update a bundle in an EBA asset, or replace a composite bundle extension, you might introduce a resource that requires additional configuration, such as a new or changed Blueprint resource reference, or security role mapping.
About this task
To deploy an OSGi application in
WebSphere® Application Server, you import your
OSGi application (EBA file) as an asset and create an empty business-level
application. You then add a composition unit to the business-level
application. This composition unit consists of the new EBA asset plus
configuration information for the context roots, virtual hosts, security
role mappings, and web application or Blueprint resource bindings
for your OSGi application. The composition unit can also include composite
bundle extensions.
Note: - An EBA file can be imported into only one asset.
- An EBA asset can be added to only one business-level application.
- One or more composite bundle extensions can be added to a composition
unit.
A business-level application is scoped to cell scope, therefore only one instance of a given OSGi application can be deployed in a cell.
This
topic describes the specific task of deploying an OSGi application
and any composite bundle extensions as a business-level application.
The more generalized task of creating any business-level application
is described in Creating
business-level applications.
Each step can be completed using either
the administrative console or wsadmin commands. You can also create
an empty business-level application or add a composition unit using
programming.
Procedure
- Import the EBA file as an asset.
Note: You can
import the asset before or after you create the empty business-level
application. An EBA file can be imported into only one asset.
To
import the EBA file using the administrative console, navigate to .
For more information, see Importing assets.
To import the EBA file using the
importAsset command,
enter (for example) the following command:
AdminTask.importAsset(["-storageType", "FULL",
"-source", com.ibm.ws.eba.helloWorldService.eba])
For more information, see the step
"Import assets to your configuration" in
topic
Setting up business-level applications using
wsadmin scripting.
Notes: - When you import the EBA file as an asset, it is checked for any
bundle dependencies. If the OSGi application has dependencies on bundles
that are not included in the EBA file, the dependencies are resolved
against any configured bundle repositories. Asset registration cannot
complete unless all missing dependencies are available from configured
bundle repositories.
- When asset registration completes, if the asset requires bundles
to be downloaded from bundle repositories, a warning message is displayed
telling you to save your changes to the master configuration after
completing the asset import. When you save changes, the missing dependencies
are downloaded from the configured bundle repositories.
- If the asset uses Java 2
security, the security permissions are displayed. This information
comes from the META-INF/permissions.perm file
for your application. For more information, see Java 2 security and OSGi Applications.
- Do not add the asset to a business-level application until the
bundle download has completed. You can view the download status of the bundles from the administrative console, or by calling the areAllDownloadsComplete () method of the BundleCacheManager MBean. See Interacting with the OSGi bundle cache.
- Create an empty business-level application.
To
create an empty business-level application using the administrative
console, navigate to .
For more information, see the step "Create an empty business-level
application" in topic Creating business-level applications with the console.
To
create an empty business-level application using the
createEmptyBLA command,
enter (for example) the following command:
AdminTask.createEmptyBLA('[-name "helloWorld"
-description "helloWorld OSGi sample"]')
For
more information, see the step
"Create an empty business-level application" in
topic
Setting up business-level applications using
wsadmin scripting.
To create an empty
business-level application using programming, see Creating
an empty business-level application using programming.
- Add the EBA asset to the business-level application as
a composition unit.
An EBA asset can be added to only one business-level application. An OSGi composition unit consists of an EBA asset, (optionally) one or more composite bundle extensions, and some or all of the following configuration information: - Mappings from the composition unit to a target application server,
web server or cluster.
- Configuration of the application's session manager, context
roots or virtual hosts.
- Bindings to any associated web applications or blueprint resource
references.
- Mappings from security roles to particular users or groups.
To add the asset to the business-level application as
a composition unit, use one of the following methods:
- Optional: Add a composite bundle as an
extension to the composition unit.
After you import the enterprise bundle archive (EBA) file for your OSGi application as an asset, you can update versions of existing bundles but you cannot add extra bundles to the asset. However, after you have added the asset as a composition unit to a business-level application, you can extend the business-level application by adding one or more composite bundles to the composition unit.
- Save your changes to the master configuration.
If you are using wsadmin commands, enter the following command:
AdminConfig.save()
What to do next
You are now ready to start your business-level application.