WebSphere Commerce EnterpriseWebSphere Commerce Professional

Extending an existing service request handler

The IBM Sales Center service request extension point is the mechanism by which requests are made of the server and the request results are handled and the model is updated. The class that constructs the request and interprets the response is the request handler. This section explains how to extend an existing service handler request.

Procedure

  1. Extend the implementation class (using the class API documentation as a reference). For example:
    
    ExtendedProcessLogonRequest.java:
    
    package extensions;
    
    import java.text.DateFormat;
    import java.util.Date;
    
    import
    com.ibm.commerce.telesales.core.impl.request.ProcessLogonRequest;
    import com.ibm.commerce.telesales.model.Operator;
    
    public class ExtendedProcessLogonRequest extends
    ProcessLogonRequest {
    
            protected void updateModel(Object databean) {
                    super.updateModel(databean);
                    System.out.println("setting logon time");
                    ((Operator)databean).setData("logonTime",
    DateFormat.getDateTimeInstance().format(new Date()));
            }
    }
    
  2. Register the new implementation using the service requests extension point. This is an example of the plug-in manifest file:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.0"?>
    <plugin>
    
       <extension
    point="com.ibm.commerce.telesales.configurator">
          <configurator path="config"/>
       </extension>
       <extension
    point="com.ibm.commerce.telesales.core.serviceRequests">
       <!-- Logon -->
          <serviceRequest
                label="Logon"
               
    requestHandlerClass="extensions.ExtendedProcessLogonRequest"
                id="extensions.logon"
               
    commServiceId="com.ibm.commerce.telesales.services.TsCommunication">
          </serviceRequest>
       </extension>
    </plugin>
    
  3. Use the system configurator extension point to indicate that the new implementation will be used instead of the default IBM Sales Center implementation:
    
    com.ibm.commerce.telesales.logon=extensions.logon
    

    All of the default service request definitions can be found in the com.ibm.commerce.telesales.core.impl plug-in.