Coding a Standard License Authorization/Request

Declare Variables/Constants

String FEATURE_NAME = "Feature1";
String FEATURE_VERSION = "1";
String CONTACT_SERVER = "no-net";
Attribute attrAppContext = null;
ApplicationContext appContext = null;
LoginSession session = null;

API Calls

To request a license, 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);

>session = new LoginSession();

>session.login(appContext, FEATURE_NAME);

Notes

>In the use case described above, a license is being requested in standalone licensing environment. For network licensing scenario, you need to 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";

>If the License Manager is running on the same system as the client application.

String CONTACT_SERVER = "localhost";

>In the case you want to include additional parameters (like feature version or vendor usage data) at the time of a license request, then you may use Attribute attrLogin = new Attribute(); along with attrLogin.set API function (or a related macros as described below):

>To associate a feature version, use the macro SNTL_ATTR_LOGIN_FEATURE_VERSION prior to the session.login(appContext, FEATURE_NAME, attrLogin) call.

>To associate vendor usage data, use the macro SNTL_ATTR_LOGIN_VENDOR_USAGE_DATA prior to the session.login(appContext, FEATURE_NAME, attrLogin) call.