IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.mobile
Class MobileAdapter

java.lang.Object
  extended by com.ibm.btt.mobile.MobileAdapter
All Implemented Interfaces:
DataAdapter

public class MobileAdapter
extends java.lang.Object
implements DataAdapter

The implementation class that implements the DataAdapter interface. There are two kinds of the invocation, one is passing the serializable JavaBean. Another is passing the Map object.


Constructor Summary
MobileAdapter()
           
 
Method Summary
 boolean establishSession()
          Create the session with the server side
 java.io.Serializable invoke(java.lang.String operationName, java.util.Map param, java.lang.String responseDataId)
          Invoke server side operation and return the processing result.
 java.io.Serializable invoke(java.lang.String operationName, java.io.Serializable param)
          Invoke server side operation and return the processing result If the passed java bean and returned result are the same, use this API to invoke server side operation.
protected  java.io.Serializable processResponse(HttpConnection connection)
          processing the response
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MobileAdapter

public MobileAdapter()
Method Detail

processResponse

protected java.io.Serializable processResponse(HttpConnection connection)
                                        throws java.io.IOException,
                                               ErrorResponseException,
                                               MobileException
processing the response

Parameters:
connection - the HTTP connection used to connect to the server
Returns:
the response result
Throws:
java.io.IOException - error occurs during processing response
ErrorResponseException
MobileException

establishSession

public boolean establishSession()
                         throws ErrorResponseException,
                                java.io.IOException,
                                MobileException
Description copied from interface: DataAdapter
Create the session with the server side

Specified by:
establishSession in interface DataAdapter
Returns:
true if create the session successfully
Throws:
ErrorResponseException - if the response code isn't OK
java.io.IOException - error occurs during connecting to the server
MobileException - if exception occurs
See Also:
DataAdapter.establishSession()

invoke

public java.io.Serializable invoke(java.lang.String operationName,
                                   java.io.Serializable param)
                            throws ErrorResponseException,
                                   java.io.IOException,
                                   MobileException
Description copied from interface: DataAdapter
Invoke server side operation and return the processing result If the passed java bean and returned result are the same, use this API to invoke server side operation. In BTT C/S client mechanism, one is passing the java bean to the server side, setting the values of this java bean in the server side operation and returning this processed java bean to client side. This method is implemented for this usage. Please establishSession before invoking this API.

Specified by:
invoke in interface DataAdapter
param - the Serializable JavaBean passed to server side
Returns:
the processed JavaBean
Throws:
ErrorResponseException - if the response code isn't OK
java.io.IOException - error occurs during connecting to the server
MobileException - if exception occurs
See Also:
DataAdapter.invoke(String, Serializable)

invoke

public java.io.Serializable invoke(java.lang.String operationName,
                                   java.util.Map param,
                                   java.lang.String responseDataId)
                            throws ErrorResponseException,
                                   java.io.IOException,
                                   MobileException
Description copied from interface: DataAdapter
Invoke server side operation and return the processing result. If the passed java bean and returned result are different or you need to pass more than one parameters, use this API to invoke server side operation. This method is generic, it supports below usage scenarios: 1) passing one java bean or more than one java bean to the server side and returning the result Sample Code: User user = new User(); user.setUserName("aaaa"); user.setPassword("bbbb"); Map param = new HashMap(); param.put("userBean", user); // the key is the data id defined in the server side context definition Result result = (Result) adapter.invoke("MobileSignInOp", param, "resultBean"); 2) passing the query conditions to the server side and returning the result Sample Code: Query user by userId: Map newParam = new HashMap(); newParam.put("userId", "123456"); // the userId defined in the server side context definition User newResult = (User) adapter.invoke("MobileQueryUserOp", newParam, "userBean"); 3) You can mix the first two usages. User user = new User(); user.setUserName("aaaa"); user.setPassword("bbbb"); Map param = new HashMap(); param.put("userBean", user); // the key is the data id defined in the server side context definition param.put("firstLogin","true");// the key is the data id defined in the server side context definition Result result = (Result) adapter.invoke("MobileSignInOp", param, "resultBean");

Specified by:
invoke in interface DataAdapter
Parameters:
operationName - the operation name
param - The Map contains the JavaBean or Simple Java Object passed to the server side. The key is the data id defined in the server side operation context definition
responseDataId - the response data id defined in the server side operation context
Returns:
the processed JavaBean
Throws:
ErrorResponseException - if the response code isn't OK
java.io.IOException - error occurs during connecting to the server
MobileException - if exception occurs
See Also:
DataAdapter.invoke(String, Map, String)

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011