SDMConnectivity Public APIs

Provides a list of public APIs in the SDMConnectivity library.

Technical Details and SDMConnectivity Public APIs

Note: The SAP Mobile Platform APIs and their descriptions are available after the installation of SAP Mobile Platform at the following location within your installation folder: ...\UnwiredPlatform\ClientAPI\apidoc.
The SDMRequestManager class implements the ISDMRequestManager interface, which provides the following methods:
ISDMRequestManager

void makeRequest(final ISDMRequest aRequest);
void makeRequest(final ISDMBundleRequest aBundleRequest)
ISDMConnectivitiyParameters getConnectivityParameters()
Vector getAllRequests()
int getQueueSize()
byte[] getRootContextID()
void terminate()
void pause()
void resume()
The number of working threads in the RequestManager class is configurable via the initialize(final SDMConnectivityParameters aParameters, final int aThreadNumber) method. The number of threads is maximized in four by the connectivity layer, because of performance related issues. If the client initializes the layer with more than the allowed threads, the implementation of the connectivity layer will decrease the thread number to the max allowed number. Methods defined by the SDMConnectivityParameters class:
ISDMConnectivitiyParameters

void setUserName(String aUserName)
String getUserName()
void setUserPassword(String aPassword)
String getUserPassword()
void setBaseUrl(String baseUrl)
String getBaseUrl()
String getLanguage()
void setLanguage(String language)
void enableXSRF(boolean useXSRF)
Sending requests with the connectivity layer consists of the following steps:
  1. Create the RequestManager class and initialize it with the required parameters.
  2. Create the request object. This can be done by implementing the ISDMRequest interface or by extending the SDMBaseRequest class which is the base implementation of the ISDMRequest interface. Both of them are provided by the connectivity layer.
  3. Add the request object to the SDMRequestManager.
Example

//create and fill parameters for Connectivity library
SDMConnectivityParameters params = new SDMConnectivityParameters();
params.setUserName("test");
params.setUserPassword("testpwd");
params.setLogger(Logger.getInstance()); //get the default Logger 
//create the RequestManager
SDMRequestManager reqManager = new SDMRequestManager();
//initialize it
reqManager.initialize(params, 2);//set the parameters and the thread number to be used
//create the request object
ISDMRequest testRequest = new SDMBaseRequest();
testRequest.setRequestUrl("http://test.de:8080/testpath");
testRequest.setRequestMethod(ISDMRequest.REQUEST_METHOD_GET);
testRequest.setPriority(ISDMRequest.PRIORITY_NORMAL);
//add the request to the connectivity layer
reManager.makeRequest(testRequest);

The tasks of the connectivity library have been divided into three main categories: managing the request queues, managing reading and writing to the input/output streams, and managing the platform specific connection creation.

The Connectivity component always performs the requests in asynchronous mode. The application’s role is to handle the request in sync mode. The component is able to perform HTTP and HTTPS requests, which you can use for developing and testing purposes, but the default is SUPRequest. The threads in the connectivity library are responsible for taking the requests from the queue (FIFO - First in first out - algorithm) and performing the requests.

The number of working threads in the connection pool can be configured in the connectivity layer. There is only one queue, and this is handled by the SDMRequestManager, and the working threads take the requests from this queue. Applications are interacting only with the SDMRequestManager class; the other components of the connectivity library are not visible to them. The network component consists of three main parts:
  • SDMRequestManager: responsible for queuing the requests, managing the threads and keeping the connection with applications
  • ConnectionHandler: responsible for performing the request
  • ConnectionFactory: responsible for creating and managing platform dependent connections to the server

An application can have more than one SDMRequestManager, for example, when connecting to two different servers at the same time.

There is built-in support for setting the timeout for the socket connection, the application can use the SDMConnectivityParameters object to modify the value.
int TIMEOUT = 3500;

ISDMPreferences preferences = new SDMPreferences();

preferences.setPreference(ISDMPreferences.CONNECTION_TIMEOUT_MS, String.valueOf(TIMEOUT));

requestManager = new SDMRequestManager(logger, preferences, parameters, NUM_OF_HTTP_EXECUTION_THREADS);