Manage composition units using wsadmin.sh
Use the commands in the BLAManagement command group to manage composition units. Use the examples in this topic to add, remove, edit, export, and view composition units.
There are two ways to complete the examples in this task. Use the BLAManagement command group for the AdminTask object to manage composition units. Alternatively, we can use the scripts in the AdminBLA script library to administer your composition unit configurations.
Composition units can represent deployed assets, other business-level applications, or external artifacts deployed on non-WebSphere Application Server runtime environments without associated assets. Business-level applications contain zero or more composition units. We cannot add the same composition unit to more than one business-level application, but we can use one asset to create more than one composition unit.
Tasks
- Add composition units.
- Start the wsadmin scripting tool.
- Add composition units.
Use the addCompUnit command to add composition units to business-level applications.
If the asset is an enterprise bundle archive (EBA) asset, there are additional parameters to set. Use the following command example to add the asset1 asset as a composition unit in the myBLA business-level application, and map the deployment to the server1 server:
AdminTask.addCompUnit('-blaID myBLA -cuSourceID asset1 -CUOptions [[.* .* compositionUnit1 "composition unit that is backed by asset1" 0]] -MapTargets [[.* server1]] -ActivationPlanOptions [.* specname=actplan0+specname=actplan1]')To add the asset2 asset as a composition unit in the myBLA business-level application, and map the deployment to the server1 and testServer servers:
AdminTask.addCompUnit('-blaID myBLA -cuSourceID asset2 -CUOptions [[.* .* compositionUnit2 "composition unit that is backed by asset2" 0]] -MapTargets [[.* server1+testServer]] -ActivationPlanOptions [.* specname=actplan0+specname=actplan1]')To add the J2EEAsset asset as a composition unit in the myBLA business-level application, and map the deployment to the server1 and testServer servers:
AdminTask.addCompUnit('[-blaID myBLA -cuSourceID J2EEAsset -defaultBindingOptions defaultbinding.ejbjndi.prefix=ejb# defaultbinding.virtual.host=default_host# defaultbinding.force=yes -AppDeploymentOptions [-appname defaultapp -installed.ear.destination application_root/myCell/defaultapp.ear] -MapModulesToServers [[defaultapp.war .* WebSphere:cell=cellName,node=nodeName,server=server1][Increment.jar .* WebSphere:cell=cellName,node=nodeName,server=testServer]] -CtxRootForWebMod [[defaultapp.war .* myctx/]]]')If we are editing a composition unit to update a shared library, first manually stop all Java EE applications that depend on that shared library. After updating the shared library, manually restart the Java EE applications. Java EE applications do not automatically restart when a shared library is updated.
The command returns the configuration IDs of the composition unit and the new composition unit created for the asset in the asset relationship:
WebSphere:cuname=compositionUnit1 WebSphere:cuname=compositionUnit2 WebSphere:cuname=J2EEAsset- Save the configuration changes.
AdminConfig.save()
- Display composition units and configuration settings.
Use the listCompUnits and viewCompUnits commands to display the configuration IDs of each composition unit that matches a specific search scope.
Use the listCompUnits command to display each composition unit in the configuration or within a specific business-level application. The following example displays each composition unit in the myBLA business-level application:
AdminTask.listCompUnits('-blaID blaname=myBLA')The command returns the configuration IDs and type of backing asset for each composition unit that matches the search scope, as the following sample displays:
WebSphere:cuname=cu1 asset WebSphere:cuname=cu4 bla WebSphere:cuname=defaultapp __j2eeUse the viewCompUnits command to display additional configuration information about a specific composition unit of a business-level application. For example, the following example displays additional information about the cu1 composition unit for the myBLA business-level application:
AdminTask.viewCompUnit('-blaID myBLA -cuID cu1')The command returns detailed configuration information for the composition unit, as the following sample displays:
Specify Composition Unit options (CUOptions) Specify name, description options for Composition Unit. Parent BLA (parentBLA): [WebSphere:blaname=myBLA] Backing Id (backingId): [WebSphere:assetname=asset1.zip] Name (name): [cu1] Description (description): [my description of cu1 composition unit] Starting Weight (startingWeight): [0] Specify servers (MapTargets) Specify targets such as application servers or clusters of application servers where we want to deploy the composition unit contained in the application. Deployable Unit (deplUnit): [default] *Servers (server): [WebSphere:node=myNode,server=server1] Specify Composition Unit activation plan options (ActivationPlanOptions) Specify composition unit activation plan optionsDeployableUnit Name (deplUnit): [default] Activation Plan (activationPlan): [WebSphere:specname=actplan0+WebSphere:specname=actplan1]If the composition unit contains an enterprise bundle archive (EBA) asset, the composition unit status is also displayed. This status is one of the following values:
- Use latest OSGi application deployment.
- New OSGi application deployment not yet available because it requires bundles that are still downloading.
- New OSGi application deployment available.
- New OSGi application deployment cannot be applied because bundle downloads have failed.
- Edit composition units.
- Start the wsadmin scripting tool.
- Modify the composition unit.
Use the editCompUnit command to modify composition unit options. Use this command to modify the starting weight of the composition unit, deployment targets, activation plan options, and relationship settings. See the documentation for the BLAManagement .to view descriptions of each option that we can modify.
If the composition unit contains an enterprise bundle archive (EBA) asset, there are additional parameters that we can modify.
The following example edits a composition unit, which is associated with an asset, and replaces the deployment target:
AdminTask.editCompUnit('-blaID myBLA -cuID cu1 -CUOptions [[.* .* cu1 cudesc 1]] -MapTargets [[.* server2]] -ActivationPlanOptions [.* #specname=actplan0+specname=actplan2]')The command returns the configuration ID of the composition unit the system edits, as the following sample displays:
WebSphere:cuname=cu1- Save the configuration changes.
AdminConfig.save()
- Remove composition units.
- Start the wsadmin scripting tool.
- Remove composition units.
Use the deleteCompUnit command to remove a composition unit. Both parameters for the following command accept incomplete configuration IDs, as long as the system can match the string to a unique ID:
AdminTask.deleteCompUnit('-blaID myBLA -cuID cu1')The command returns the configuration ID of the composition unit the system deletes, as the following sample demonstrates:
WebSphere:cuname=cu1- Save the configuration changes.
AdminConfig.save()
Set up business-level applications Deploy and administering business-level applications Add an EBA asset to a composition unit using the addCompUnit command Modify the configuration of an EBA composition unit using the editCompUnit command Checking the update status of an EBA composition unit Business-level application configuration scripts BLAManagement .