Previous Topic: SDK Client APINext Topic: SDK Support for HTTPS-enabled CA Configuration Automation Server


Establishing CA Configuration Automation Server Connectivity

The com.ca.acm.sdk.net package contains classes that establish the connectivity with, and provide session credentials to the CA Configuration Automation Server. As the following example shows, com.ca.acm.sdk.net.ACMSDKService is the primary class that CA Configuration Automation uses for this setup:

import com.ca.acm.sdk.net.ACMSDKService;
if (ACMSDKService.locateService(http://<yourserver>:port/services/SDKService) )
{
    if (ACMSDKService.beginSession(username, password) )
    {
        //  do some work
        Server[] server = Server.getAllServers();
        ...   
     }
        ACMSDKService.endsession();
 }

The product uses ACMSDKService static methods to set up and tear down ThreadLocal connectivity and session credentials. After you use the locateServer() and beginSession() methods to set up a session, the product manages the connectivity and session parameters in the ACMSDKService class. The Subsequent calls to SDK methods use the ThreadLocal connectivity and session parameters without a need to view or handle session credentials directly.

Note: Connectivity and session setup are ThreadLocal. Therefore, in multithreaded applications, verify that SDK calls are made from the thread where the connectivity was originally established.

The ACMSDKService.endsession() method closes established sessions and clears the connectivity that the locateServer() call set up.