Adding an EBA asset that includes composite bundles by using the addCompUnit command

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.

Before you begin

For a full description of how you specify this configuration information, see Adding an EBA asset to a composition unit by using wsadmin commands. When you work through that task, each step where the syntax is different for composite bundles is linked to an equivalent step in this task.

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 session manager, context roots or virtual hosts of the application.
  • Mappings from enterprise beans to JNDI names.
  • 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

  • Map context root for web modules 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"]]
      ...
    ]')
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Map context root for web modules.
  • Bind listeners for message-driven beans in composite bundles
    The Jython syntax for this aspect of the command is as follows.
    AdminTask.addCompUnit('[
      ... 
      -MDBBindingsStep [
        [bundle_symbolic_name_1 bundle_version_1 uri_1
           activation_spec_1 destination_jndi_name_1 authentication_alias_1]
        [bundle_symbolic_name_2 bundle_version_2 uri_2
           activation_spec_2 destination_jndi_name_2 authentication_alias_2]]
      ...
    ]') 
    For composite bundles, the bundle symbolic name has the following syntax:
    CBA.symbolic.name_CBA.bundle.version/EJBbundle.symbolic.name
    In the following example, a composite bundle com.ibm.ws.eba.financeCBA, at version 1.0.0, contains two EJB bundles, com.ibm.ws.eba.currencyService at version 1.0.0, and com.ibm.ws.eba.accountService at version 0.9.0. The currencyService bundle contains a message-driven bean called ExchangeRateMDB, bound to an activation specification with a JNDI name of eis/ExchangeRate_Act_Spec; the destination JNDI name that is defined in the activation specification is overridden by a destination whose JNDI name is jms/ExchangeRateQueue, and the authentication alias that is defined in the activation specification is overridden by an authentication alias called ExchangeRate_Auth_Alias. The accountService bundle contains an MDB called CustomerDetailsMDB, bound to an activation specification with a JNDI name of eis/CustomerDetails_Act_Spec; the destination JNDI name that is defined in the activation specification is overridden by a destination whose JNDI name is jms/CustomerDetailsQueue, and the authentication alias that is defined in the activation specification is overridden by an authentication alias called CustomerDetails_Auth_Alias.
    AdminTask.addCompUnit('[
      ... 
      -MDBBindingsStep [
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0
         META-INF/ejb-jar.xml/ExchangeRateMDB eis/ExchangeRate_Act_Spec
         jms/ExchangeRateQueue ExchangeRate_Auth_Alias] 
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0
         META-INF/ejb-jar.xml/CustomerDetailsMDB eis/CustomerDetails_Act_Spec
         jms/CustomerDetailsQueue CustomerDetails_Auth_Alias]]
      ...
    ]')
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Bind listeners for message-driven beans
  • Provide EJB JNDI names in composite bundles
    The Jython syntax for this aspect of the command is as follows.
    AdminTask.addCompUnit('[
      ... 
      -EJBMappingsStep [
        [bundle_symbolic_name_1 bundle_version_1 ejb_name_1
           ejb_interface_1 ejb_interface_type_1 jndi_name_1]
        [bundle_symbolic_name_2 bundle_version_2 ejb_name_2
           ejb_interface_2 ejb_interface_type_2 jndi_name_2]]
      ...
    ]') 
    For composite bundles, the bundle symbolic name has the following syntax:
    CBA.symbolic.name_CBA.bundle.version/EJBbundle.symbolic.name
    In the following example, a composite bundle com.ibm.ws.eba.financeCBA, at version 1.0.0, contains two EJB bundles, com.ibm.ws.eba.currencyService at version 1.0.0, and com.ibm.ws.eba.accountService at version 0.9.0. The currencyService bundle contains an enterprise bean called ExchangeRate_ejb, with a Local interface called com.ibm.ws.eba.ejb.ExchangeRate, that is mapped to a JNDI name of ejb/ExchangeRate. The accountService bundle contains an enterprise bean called CustomerDetails_ejb, with a Remote interface called com.ibm.ws.eba.ejb.CustomerDetails, that is mapped to a JNDI name of ejb/CustomerDetails.
    AdminTask.addCompUnit('[
      ... 
      -EJBMappingsStep [
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0 ExchangeRate_ejb
          com.ibm.ws.eba.ejb.ExchangeRate Local ejb/ExchangeRate] 
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0 CustomerDetails_ejb
          com.ibm.ws.eba.ejb.CustomerDetails Remote ejb/CustomerDetails]]
      ...
    ]')
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Provide EJB JNDI names
  • Map EJB references in composite bundles
    The Jython syntax for this aspect of the command is as follows.
    AdminTask.addCompUnit('[
      ... 
      -EJBRefStep [
        [bundle_symbolic_name_1 bundle_version_1 uri_1
           ejb_reference_name_1 business_interface_1 jndi_name_1]
        [bundle_symbolic_name_2 bundle_version_2 uri_2
           ejb_reference_name_2 business_interface_2 jndi_name_2]]
      ...
    ]') 
    The uri parameter specifies the location where the EJB reference is defined.
    For composite bundles, the bundle symbolic name has the following syntax:
    CBA.symbolic.name_CBA.bundle.version/EJBbundle.symbolic.name
    In the following example, a composite bundle com.ibm.ws.eba.financeCBA, at version 1.0.0, contains two bundles, com.ibm.ws.eba.currencyService at version 1.0.0, and com.ibm.ws.eba.accountService at version 0.9.0. The currencyService bundle contains an EJB reference called ExchangeRate, from the CurrencyExchange enterprise bean, defined in META-INF/ejb-jar.xml that is mapped to a JNDI name of ejb:ExchangeRate. The accountService bundle contains an EJB reference called CustomerDetails, defined in web.xml, that is mapped to a JNDI name of ejb:CustomerDetails.
    AdminTask.addCompUnit('[
      ... 
      -EJBRefStep [
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0
          META-INF/ejb-jar.xml/CurrencyExchange ExchangeRate com.ibm.ws.eba.ejb.ExchangeRate
          ejb:ExchangeRate]
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0
          WEB-INF/web.xml CustomerDetails com.ibm.ws.eba.ejb.CustomerDetails ejb:CustomerDetails]]
      ...
    ]')
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Map EJB references
  • Map EJB resource references to resources in composite bundles
    The Jython syntax for this aspect of the command is as follows
    AdminTask.addCompUnit('[
      ... 
      -EJBResourceRefs [
        [
        bundle_symbolic_name
        bundle_version
        ejb_name
        resource_reference_id
        resource_type
        target_jndi_name
        resource_authentication_method
        mapping_properties
        extended_properties
        ]]
      ...
    ]')
    The mapping_properties parameter defines arbitrary name and value pairs for extended data source properties, in the following format (one continuous string):
    WebSphere:name=property_name1,value=property_value1,description=property_description1
    +WebSphere:name=property_name2,value=property_value2,description=property_description2
    + ...
    The extended_properties parameter defines extended data source custom properties in the following format (one continuous string):
    property_name1=property_value1+property_name2=property_value2+ ...
    For composite bundles, the bundle symbolic name has the following syntax:
    CBA.symbolic.name_CBA.bundle.version/EJBBundle.symbolic.name
    For example:
    AdminTask.addCompUnit('[
      ... 
      -EJBResourceRefs [
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0
         ExchangeRate dataSource1 javax.sql.DataSource ref/ds1 ClientContainer
         "WebSphere:name=mprop1,value=val1,description=desc1"
         "exprop1=expropval1+exprop2=expropval2"] 
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0
         CustomerDetails dataSource2 javax.sql.DataSource ref/ds2 WSLogin "" ""]]
      ...
    ]') 
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Map EJB resource references to resources
  • Bind EJB message destination references to administered objects in composite bundles.
    The Jython syntax for this aspect of the command is as follows
    AdminTask.addCompUnit('[
      ... 
      -EJBMsgDestRefs [
        [
        bundle_symbolic_name
        bundle_version
        ejb_name
        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/EJBBundle.symbolic.name
    For example:
    AdminTask.addCompUnit('[
      ... 
      -EJBMsgDestRefs [
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0
         ExchangeRate jms/myQ javax.jms.Queue jms/workQ] 
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0
         CustomerDetails jms/myT javax.jms.Topic jms/notificationTopic]]
      ...
    ]') 
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Bind EJB message destination references to administered objects.
  • Map EJB environment entries in composite bundles.
    The Jython syntax for this aspect of the command is as follows
    AdminTask.addCompUnit('[
      ... 
      -EJBEnvEntryStep [
        [
        bundle_symbolic_name
        bundle_version
        ejb_name
        env_entry_name
        env_entry_type
        env_entry_description
        env_entry_value
        ]]
      ...
    ]')
    For composite bundles, the bundle symbolic name has the following syntax:
    CBA.symbolic.name_CBA.bundle.version/EJBBundle.symbolic.name
    For example:
    AdminTask.addCompUnit('[
      ... 
      -EJBEnvEntryStep [
        [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0
         ExchangeRate CommissionRate java.lang.Double
         "Commission rate applied to currency exchange transactions." 5.75]]
      ...
    ]') 
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Map EJB environment entries.
  • Map virtual hosts for web modules in composite bundles.
    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]]
      ...
    ]') 
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Map virtual hosts for web modules.
  • 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
        ]]
      ...
    ]')
    Notes:
    • For composite bundles, the bundle symbolic name has the following syntax:
      CBA.symbolic.name_CBA.bundle.version/embedded_bundle.symbolic.name
    • The value for jndi_name must match the JNDI name that you declare in the filter attribute of the resource reference element in the Blueprint XML file.
    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]]
      ...
    ]')
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Add authentication aliases to Blueprint resource references.
  • Bind web module message destination references to administered objects in composite bundles.
    The Jython syntax for this aspect of the command is as follows
    AdminTask.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]]
      ...
    ]') 
    Note: For bundles other than composite bundles, the syntax is slightly different. See Step: Bind web module message destination references to administered objects.
  • Map web module resource references to resources 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:

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 by 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"]]
  -EJBMappingsStep [
    [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0 ExchangeRate_ejb
      com.ibm.ws.eba.ejb.ExchangeRate Local ejb/ExchangeRate] 
    [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0 CustomerDetails_ejb
      com.ibm.ws.eba.ejb.CustomerDetails Remote ejb/CustomerDetails]]
  -EJBRefStep [
    [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0
      META-INF/ejb-jar.xml/CurrencyExchange ExchangeRate com.ibm.ws.eba.ejb.ExchangeRate
      ejb:ExchangeRate]
    [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0
      WEB-INF/web.xml CustomerDetails com.ibm.ws.eba.ejb.CustomerDetails ejb:CustomerDetails]]
  -EJBResourceRefs [
    [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0
     ExchangeRate dataSource1 javax.sql.DataSource ref/ds1 ClientContainer
     "WebSphere:name=mprop1,value=val1,description=desc1"
     "exprop1=expropval1+exprop2=expropval2"] 
    [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0
     CustomerDetails dataSource2 javax.sql.DataSource ref/ds2 WSLogin "" ""]]
  -EJBMsgDestRefs [
    [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.currencyService 1.0.0
     ExchangeRate jms/myQ javax.jms.Queue jms/workQ] 
    [com.ibm.ws.eba.financeCBA_1.0.0/com.ibm.ws.eba.accountService 0.9.0
     CustomerDetails jms/myT javax.jms.Topic jms/notificationTopic]]
  -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"]]
]')