WebSphere brand IBM WebSphere Telecom Web Services Server, Version 7.1

Developing a custom JCA adapter

To develop a JCA adapter for other native protocols, you must create a MessageTranslator class and then define objects that define how your JCA adapter communicates with the native protocols.

About this task
Follow these steps:
  1. Create a MessageTranslator class extending the com.ibm.mds.adpt.sms.base.cci.BaseMessageTranslator class. This class does two things:
    • Parses the JCA records that correspond to Parlay X operations
    • Constructs the protocol specific PDUs
  2. From the Web service implementation (SI) layer, define the BaseInteractionSpec object to be used for propagating the function name attribute to the adapter.
  3. From the SI layer, define the BaseConnectionSpec object to be used for propagating the following attributes corresponding to the Network Element to the adapter:
    • smscName: The name of the SMSC a client is attempting to access
    • hostName: Host name of the Network Element
    • portNumber: Port Number of the Network Element
    • systemID: User ID used to access the Network Element
    • password: Password corresponding to the systemID
    • protocolID
    • systemType
    • bindType
    • functionID: Unique ID to be used for making a bind connection with network entity

    These attributes are initialized to null values, so that if a particular JCA implementation does not require any of the fields, you can create a BaseConnectionSpec object using its default constructor and initialize the values or retrieve the values only for the required attributes using the setter/getter methods.

  4. Create an interaction object implementing the javax.resource.cci.Interaction interface, as shown in the following sample code:
    public class ProtocolName lInteration implments javax.resource.cci.Interaction {
    
    public void close() throws javax.resource..ResourceException {
        // Close the connections established with the Network Entity
    }
    
    public Connection getConnection() {
    // Retrieves the object corresponding to the connection
    //established with the SMSC
    }
    
    public boolean execute(InteractionSpec arg0, Record request, Record response)throws ResourceException {
    
          // Type cast the InteractionSpec to BaseInteractionSpec type.
        	BaseInteractionSpec csSepc = (BaseInteractionSpec) ispec;
    
       	// Extract the function Name from the InteractionSpec
        	String functionName = csSepc.getFunctionName();
    
       // Check the function name for the values 
    // SendMessage
    // BindToNE
    // StartMOMessages
    // MonitorHeartBeat
    // QueryMessageStatus
    
    if(functionName.equals("BindToNE ") || functionName.equals("StartMOMessages ")){
    
    // Parse the Record corresponding to the function
    BindToNERequest
    bindRecordFrmReq = (BindToNetworkElement)record;
    
    // Construct the JCA Records corresponding to the native protocol
    
    // Establish a connection with the Network Element
    
    // Construct the JCA Record corresponding to Parlay X adding the conection status
    
    // Send the response back to SI Layer using the "BindToNEResponse" record
    
    }
    if(functionName.equals("SendMessage"){
    
    // Send the response back to SI Layer using the record SendMessageResponse
    SendMessageRequest smsRecord = (SendMessageRequest)record;
    
    // Construct the JCA Records corresponding to the native protocol using the MessageTranslator object
    
    // Send the message to the Network Element
    
    // Send the response back to SI Layer
    
    }
    
    if(functionName.equals("MonitorHeartBeat "){
    
    // Parse the Record corresponding to Parlay X
    MonitorHeartBeat heartBeatRecord = (MonitorHeartBeat)record;
    
    // Construct the JCA Records corresponding to the native protocol using the  
    // MessageTranslator object
    
    // Send the message to the Network Element
    
    // Send the response with the connection status to SI Layer
    
    }
    if(functionName.equals("QueryMessageStatus"){
    
    // Parse the Record corresponding to Parlay X
    QueryStatusRequest queryStatusRecord = (QueryStatusRequest)record;    		
    // Construct the JCA Records corresponding to the native protocol using the  
    // MessageTranslator object
    
    // Send the message to the Network Element
    
    // Send the response with the message status to SI Layer using the record "QueryStatusResponse"
    
    }
    
    }
  5. To handle Mobile Origination (MO) messages, perform the following steps:
    1. The MO messages (either “confirm delivery” messages for a sendSMS mesage, or plain MO messages to notifications that are already started) must be read on the socket connections already opened during sendSMS or startNotification.
    2. Parse the protocol specific records, for example deliverSM in SMPP.
    3. Convert the protocol-specific records to JCA records of type MOMessageRequest.
    4. Create a ProtocolName Message object that implements the javax.jms.Message interface.
    5. Add the MOMessageRequest (of type JCA record ) as an object property to the Message object.
    6. Create a MessageLister object of type javax.jms.MessageListener. This MessageListener object will be part of the SI layer. Typically this object is a message driven bean in J2EE terms.
    7. Add the Message object as a request parameter to the onMessage method in the MessageListener object, and call the onMessage method.
    8. For scalability, you must create a proxy of the endpoint for every MO message received. Handle it and release the proxy.



Terms of use
(C) Copyright IBM Corporation 2009. All Rights Reserved.