IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.mobile
Interface DataAdapter

All Known Implementing Classes:
MobileAdapter

public interface DataAdapter

The interface used to abstract the invocation of the server side logic. The implementation class should implement the invocation logic. There are two kinds of the invocation, one is passing the serializable JavaBean. Another is passing the Map object.


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.
 

Method Detail

invoke

java.io.Serializable invoke(java.lang.String operationName,
                            java.io.Serializable param)
                            throws java.io.IOException,
                                   ErrorResponseException,
                                   MobileException
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.

Parameters:
operationName -
param - the Serializable JavaBean passed to server side
Returns:
the processed JavaBean
Throws:
java.io.IOException - error occurs during connecting to the server
ErrorResponseException - if the response code isn't OK
MobileException - if exception occurs

invoke

java.io.Serializable invoke(java.lang.String operationName,
                            java.util.Map param,
                            java.lang.String responseDataId)
                            throws java.io.IOException,
                                   ErrorResponseException,
                                   MobileException
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");

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:
java.io.IOException - error occurs during connecting to the server
ErrorResponseException - if the response code isn't OK
MobileException - if exception occurs

establishSession

boolean establishSession()
                         throws java.io.IOException,
                                ErrorResponseException,
                                MobileException
Create the session with the server side

Returns:
true if create the session successfully
Throws:
java.io.IOException - error occurs during connecting to the server
ErrorResponseException - if the response code isn't OK
MobileException - if exception occurs

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009