Provides a list of public APIs in the SDMConnectivity library.
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()
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)
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.
An application can have more than one SDMRequestManager, for example, when connecting to two different servers at the same time.
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);