Obtaining a List of Features with the License Manager

Declare Variables/Constants

String  CONTACT_SERVER = "localhost";
String ScopeFeatureInfoPart1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "+

"<sentinelScope>"+ "<feature index=\""; String ScopeFeatureInfoPart2 = "\"><name></name>"+ "<version></version>"+ "</feature>"+ "</sentinelScope>"; int iRetCode = LicensingConstants.SNTL_SUCCESS; int iFeatureIndex = 0; Attribute attrAppContext = null; ApplicationContext appContext = null;

API Calls

To obtain features list, execute the APIs in the specified sequential order only:

>attrAppContext = new Attribute();


NOTE   If instead the LSFORCEHOST or LSHOST environment variables are set, then the above-mentioned steps are not required.

>appContext = new ApplicationContext(attrAppContext);

>Now call appContext.getInfo inside a while loop (incrementing the feature index, iFeatureIndex at each iteration, its initial value being 0), till the return code is SNTL_NO_MORE_FEATURES, as shown in the code snippet below:

while(iRetCode != LicensingConstants.SNTL_NO_MORE_FEATURES)
  StringBuffer buff = new StringBuffer(ScopeFeatureInfoPart1);
  String ScopeFeatureInfo = buff.toString();
  String featureInfo = appContext.getInfo(ScopeFeatureInfo,       
/* Parse the XML output contained in featureInfo */
}/*end of while loop*/

On success during each iteration of the while loop, the featureInfo string contains an XML-based output having the detailed information.