Obtaining Application Context Information
Declare Variables/Constants
String CONTACT_SERVER = "no-net";
Attribute attrAppContext = null;
ApplicationContext appContext = null;
Load Library
LicensingAPI lsapiInstance= new LicensingAPI();
API Calls
To obtain the application context information, execute the APIs in the specified sequential order only:
>attrAppContext = new Attribute();
>attrAppContext.set(LicensingConstants.SNTL_ATTR_APPCONTEXT_CONTACT_SERVER, CONTACT_SERVER);
NOTE If instead the LSFORCEHOST or LSHOST environment variables are set, then the above-mentioned steps are not required.
>attrAppContext.set(LicensingConstants.SNTL_ATTR_APPCONTEXT_CONTROL_REMOTE_SESSION,LicensingConstants.SNTL_CONTROL_REMOTE_NONE);
>appContext = new ApplicationContext(attrAppContext);
>String appContextInfo = appContext.getInfo(LicensingConstants.SNTL_QUERY_SCOPE_NONE, LicensingConstants. SNTL_QUERY_SERVER_INFO_VERSION("1.0"));
If the appContext.getInfo call is successful, the appContextInfo string contains an XML-based output having the detailed information.
Notes
>In the use case described above, application context Information is obtained for the following attributes:
•Contact Server
•Control Remote Session.
For other attributes, default value will be returned.
>To set the value of network timeout,use the macro LicensingConstants.SNTL_ATTR_APPCONTEXT_NETWORK_TIMEOUT before appContext.getInfo(LicensingConstants.SNTL_QUERY_SCOPE_NONE, LicensingConstants. SNTL_QUERY_APPCONTEXT_INFO_VERSION("1.0")) call.
>To set the value of trace level, use the macro LicensingConstants.SNTL_ATTR_APPCONTEXT_TRACE_LEVEL prior to appContext.getInfo(LicensingConstants.SNTL_QUERY_SCOPE_NONE, LicensingConstants. SNTL_QUERY_APPCONTEXT_INFO_VERSION("1.0")) call.
>Similarly, use the same process to set the value of other attributes.