Create the component facade

Creating a component facade consists of running the Design Pattern Toolkit and then customizing the template code that is generated. The EJB service module is created with shell commands that return empty BODs.


Procedure

  1. Create a WebSphere Commerce service module.

  2. Open the MyServiceModule-Server project.

  3. Implement the shell commands in the com. mycompany.commerce. myservicemodule.facade.server.commands package. For example, implement Verb MyNounCmdImpl.java. This is the simplest approach to implementing a component facade -- use the shell command to parse your XML and execute any existing WebSphere Commerce or custom commands containing business logic you wish to reuse.

  4. Optional: Alternatively, we can use the Message mapper to flatten the XML messages into name-value pairs appropriate to the WebSphere Commerce commands. If you do so, you will use the command registry table to select the correct command implementation, based on the inbound XPath expression in the BOD. For an example of how the member subsystem maps XML messages to command name-value pairs, see the Member component message mapper.

  5. Register your new commands. When you do so, if we are using the message mapper, you need to associate the XPath search expression key with your new custom fetch command implementation by using an SQL statement. For example:

      insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET)
      VALUES 
      (0,'com.ibm.commerce.catalog.facade.server.commands.FetchCatalogEntryCmd+/CatalogEntry[Price[StandardPrice[Price[(Price<=
      and Price[@currency=]) 
      and (Price>= and Price[@currency=])]]]]',
      'com.mycompany.commerce.customization.catalog.FetchCatalogEntryByPriceRangeTaskCmdImpl',
      'Local');

    Notes:

    1. The interface name contains the name of the command concatenated with the XPath.

    2. For implementations that do not use the Message mapper, including WebSphere Commerce member subsystem customization, you need to update the CMDREG entry for the existing default fetch command. Also, no XPath details are included in the SQL statement.

  1. Creating a new search expression

  2. Extending a noun

  3. Creating the service command

  4. Deploying the component facade


Related tasks
Deploying the component facade


Related reference
Member component message mapper configuration