You can use the addCompUnit command
to add a composition unit that contains a previously-imported enterprise
bundle archive (EBA) asset plus configuration information. If the EBA asset includes composite bundles, the command syntax is slightly different.
About this task
An OSGi composition unit includes an EBA asset 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.
For several of the elements, the values you specify include bundle identifiers. If your EBA asset includes or references composite bundles, the command syntax is slightly different. The differences for composite bundles are described in the following steps.
Procedure
- Define context roots for web application bundles (WABs) in composite bundles.
The jython syntax for this aspect of the command is as follows:
AdminTask.addCompUnit('[
...
-ContextRootStep [
[bundle_symbolic_name_1 bundle_version_1 context_root_1]
[bundle_symbolic_name_2 bundle_version_2 context_root_2]]
...
]')
For composite bundles, the bundle symbolic name has the following syntax:CBA.symbolic.Name_CBA.bundle.version/WAB.symbolic.name
For example, for a composite bundle com.ibm.ws.eba.helloWorldCBA at version 1.0.0 that contains two WABs (com.ibm.ws.eba.helloWorldService.web at version 1.0.0, which is to be mapped to /hello/web, and com.ibm.ws.eba.helloWorldService.withContextRoot at version 0.9.0, which is to be mapped to /hello/service), this aspect of the command is as follows:AdminTask.addCompUnit('[
...
-ContextRootStep [
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web 1.0.0
"/hello/web"]
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.withContextRoot 0.9.0
"/hello/service"]]
...
]')
- Map WABs in composite bundles to virtual hosts.
The jython syntax for this aspect of the command is as follows:
AdminTask.addCompUnit('[
...
-VirtualHostMappingStep [
[bundle_symbolic_name_1 bundle_version_1
web_module_name_1 virtual_host_1]
[bundle_symbolic_name_2 bundle_version_2
web_module_name_2 virtual_host_2]]
...
]')
For composite bundles, the bundle symbolic name has the following syntax:CBA.symbolic.Name_CBA.bundle.version/WAB.symbolic.name
For example, for a composite bundle com.ibm.ws.eba.helloWorldCBA at version 1.0.0 that contains two WABs (com.ibm.ws.eba.helloWorldService.web at version 1.0.0, which is to be mapped to default_host, and com.ibm.ws.eba.helloWorldService.withContextRoot at version 0.9.0, which is to be mapped to test_host), this aspect of the command is as follows:AdminTask.addCompUnit('[
...
-VirtualHostMappingStep [
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0 "HelloWorld service" default_host]
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.withContextRoot
0.9.0 "HelloWorld second service" test_host]]
...
]')
- Add authentication aliases to Blueprint resource references in composite bundles.
The jython syntax for this aspect of the command is as follows.
AdminTask.addCompUnit('[
...
-BlueprintResourceRefBindingStep [
[
bundle_symbolic_name
bundle_version
blueprint_resource_reference_id
interface_name
jndi_name
authentication_type
sharing_setting
authentication_alias_name
]]
...
]')
For example, for a composite bundle com.ibm.ws.eba.helloWorldCBA at version 1.0.0 that contains a bundle com.ibm.ws.eba.helloWorldService.properties.bundle.jar at Version 1.0.0, which is to be bound to authentication alias alias1, the command is as follows:AdminTask.addCompUnit('[
...
-BlueprintResourceRefBindingStep[
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.properties.bundle
1.0.0 resourceRef javax.sql.DataSource jdbc/Account Container Shareable alias1]]
...
]')
- Bind web module message destination and resource environment references in composite bundles.
The jython syntax for this aspect of the command is as followsAdminTask.addCompUnit('[
...
-WebModuleMsgDestRefs [
[
bundle_symbolic_name
bundle_version
resource_reference_id
resource_type
target_jndi_name
]]
...
]')
For composite bundles, the bundle symbolic name has the following syntax:CBA.symbolic.Name_CBA.bundle.version/WAB.symbolic.name
For
example:
AdminTask.addCompUnit('[
...
-WebModuleMsgDestRefs [
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0
jms/myQ javax.jms.Queue
jms/workQ]
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0
jms/myT javax.jms.Topic
jms/notificationTopic]]
...
]')
- Bind web module resource references in composite bundles.
The jython syntax for this aspect of the command is as follows.
AdminTask.addCompUnit('[
...
-WebModuleResourceRefs [
[
bundle_symbolic_name
bundle_version
resource_reference_id
resource_type
target_jndi_name
login_configuration
login_properties
extended_properties
]]
...
]')
For composite bundles, the bundle symbolic name has the following syntax:CBA.symbolic.Name_CBA.bundle.version/WAB.symbolic.name
For
example:
AdminTask.addCompUnit('[
...
-WebModuleResourceRefs [
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0
jdbc/jtaDs javax.sql.DataSource
jdbc/helloDs "" "" ""]
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0
jdbc/nonJtaDs javax.sql.DataSource
jdbc/helloDsNonJta "" "" "extprop1=extval1"]]
...
]')
Notes: - If you use multiple extended properties, the jython syntax is "extprop1=extval1,extprop2=extval2".
- For bundles other than composite bundles, the syntax is slightly different. See Step: Bind web module resource references.
Example
In the following example, the jython syntax
from the previous steps is combined with the additional steps described
in
Adding an EBA asset to a composition unit using wsadmin commands so that, by
running the
addCompUnit command once only, a composition
unit is created and added to a business-level application. In the
example, an EBA file
com.ibm.ws.eba.helloWorldService.eba contains
a composite bundle with symbolic name
com.ibm.ws.eba.helloWorldCBA,
at version
1.0.0. This composite bundle contains
two WABs:
- com.ibm.ws.eba.helloWorldService.web, at version
1.0.0
- com.ibm.ws.eba.helloWorldService.withContextRoot,
at version 0.9.0
The composite bundle also contains a bundle with symbolic name
com.ibm.ws.eba.helloWorldService.properties.bundle,
at version 1.0.0.
AdminTask.addCompUnit('[
-blaID WebSphere:blaname=helloWorldService
-cuSourceID WebSphere:assetname=com.ibm.ws.eba.helloWorldService.eba
-CUOptions [
[WebSphere:blaname=helloWorldService.eba
WebSphere:assetname=com.ibm.ws.eba.helloWorldService.eba
com.ibm.ws.eba.helloWorldService_0001.eba "" 1 false DEFAULT]]
-MapTargets [[ebaDeploymentUnit WebSphere:cluster=cluster1]]
-ActivationPlanOptions [[default ""]]
-ContextRootStep [
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web 1.0.0
"/hello/web"]
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.withContextRoot 0.9.0
"/hello/service"]]
-VirtualHostMappingStep [
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0 "HelloWorld service" default_host]
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.withContextRoot
0.9.0 "HelloWorld second service" test_host]]
-MapRolesToUsersStep [
[ROLE1 No Yes "" ""]
[ROLE2 No No WABTestUser1 ""]
[ROLE3 No No "" WABTestGroup1]
[ROLE4 Yes No "" ""]]
-MapRunAsRolesToUsersStep [
[Role1 User1 password1]
[AdminRole User3 password3]]
-BlueprintResourceRefBindingStep[
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.properties.bundle
1.0.0 resourceRef javax.sql.DataSource jdbc/Account Container Shareable alias1]]
-WebModuleMsgDestRefs [
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0
jms/myQ javax.jms.Queue
jms/workQ]
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0
jms/myT javax.jms.Topic
jms/notificationTopic]]
-WebModuleResourceRefs [
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0
jdbc/jtaDs javax.sql.DataSource
jdbc/helloDs "" "" ""]
[com.ibm.ws.eba.helloWorldCBA_1.0.0/com.ibm.ws.eba.helloWorldService.web
1.0.0
jdbc/nonJtaDs javax.sql.DataSource
jdbc/helloDsNonJta "" "" "extprop1=extval1"]]
]')