Obtaining Cumulative Trial License Usage Information

Declare Variables/Constants

String FEATURE_NAME = "FeatureTrial";
String FEATURE_VERSION = "1.0";
String CONTACT_SERVER = "localhost";
String ScopeTrialUsageInfo="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
                            "<sentinelScope>"+
                                "<feature index=\"0\">"+
                                    "<name>"+FEATURE_NAME+"</name>"+
                                    "<version>"+FEATURE_VERSION+"</version>"+
                                "</feature>"+
                            "</sentinelScope>";

Attribute attrAppContext = null;
ApplicationContext appContext = null;

API Calls

To obtain cumulative trial license usage 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.

>appContext = new ApplicationContext(attrAppContext);

>String trialUsageInfo = appContext.getInfo(ScopeTrialUsageInfo, LicensingConstants. SNTL_QUERY_FEATURE_CUMULATIVE_TRIAL_INFO_VERSION("1.0"));

If the appContext.getInfo call is successful, the trialUsageInfo string contains an XML-based output having the detailed information.

Notes

>In the use case described above, a license is being requested from the local system when the License Manager is running on the same system as the client application (set as localhost). You can change the CONTACT_SERVER constant to the IP address or hostname of the system hosting the Sentinel RMS License Manager. For example,

String CONTACT_SERVER "50.155.68.24";

>In the case of standalone licensing, set the contact server as no-net:

String CONTACT_SERVER "no-net";