1010import java .math .BigInteger ;
1111import com .fasterxml .jackson .databind .ObjectMapper ;
1212import com .fasterxml .jackson .core .JsonProcessingException ;
13+ import com .fasterxml .jackson .core .type .TypeReference ;
1314import java .util .ArrayList ;
1415import java .util .List ;
1516
@@ -237,6 +238,8 @@ public static HostConfig GetHostConfig() throws LexFloatClientException, Unsuppo
237238 /**
238239 * Gets the product version name.
239240 *
241+ * @deprecated This function is deprecated. Use GetHostLicenseEntitlementSetName() instead.
242+ *
240243 * @return name - Returns the name of the Product Version being used.
241244 * @throws LexFloatClientException
242245 * @throws UnsupportedEncodingException
@@ -262,6 +265,8 @@ public static String GetHostProductVersionName() throws LexFloatClientException,
262265 /**
263266 * Gets the product version display name.
264267 *
268+ * @deprecated This function is deprecated. Use GetHostLicenseEntitlementSetDisplayName() instead.
269+ *
265270 * @return displayName - Returns the display name of the Product Version being
266271 * used.
267272 * @throws LexFloatClientException
@@ -288,6 +293,8 @@ public static String GetHostProductVersionDisplayName() throws LexFloatClientExc
288293 /**
289294 * Gets the product version feature flag.
290295 *
296+ * @deprecated This function is deprecated. Use GetHostFeatureEntitlement() instead.
297+ *
291298 * @param name - The name of the Feature Flag.
292299 * @return The properties of the Feature Flag as an object.
293300 * @throws LexFloatClientException
@@ -315,6 +322,147 @@ public static HostProductVersionFeatureFlag GetHostProductVersionFeatureFlag(Str
315322 throw new LexFloatClientException (status );
316323 }
317324
325+ /**
326+ * Gets the name of the entitlement set associated with the LexFloatServer license.
327+ *
328+ * @return Returns the host license entitlement set name.
329+ * @throws LexFloatClientException
330+ * @throws UnsupportedEncodingException
331+ */
332+ public static String GetHostLicenseEntitlementSetName () throws LexFloatClientException , UnsupportedEncodingException {
333+ int status ;
334+ int bufferSize = 256 ;
335+ if (Platform .isWindows ()) {
336+ CharBuffer buffer = CharBuffer .allocate (bufferSize );
337+ status = LexFloatClientNative .GetHostLicenseEntitlementSetName (buffer , bufferSize );
338+ if (LF_OK == status ) {
339+ return buffer .toString ().trim ();
340+ }
341+ } else {
342+ ByteBuffer buffer = ByteBuffer .allocate (bufferSize );
343+ status = LexFloatClientNative .GetHostLicenseEntitlementSetName (buffer , bufferSize );
344+ if (LF_OK == status ) {
345+ return new String (buffer .array (), "UTF-8" ).trim ();
346+ }
347+ }
348+ throw new LexFloatClientException (status );
349+ }
350+
351+ /**
352+ * Gets the display name of the entitlement set associated with the LexFloatServer license.
353+ *
354+ * @return Returns the host license entitlement set display name.
355+ * @throws LexFloatClientException
356+ * @throws UnsupportedEncodingException
357+ */
358+ public static String GetHostLicenseEntitlementSetDisplayName () throws LexFloatClientException , UnsupportedEncodingException {
359+ int status ;
360+ int bufferSize = 256 ;
361+ if (Platform .isWindows ()) {
362+ CharBuffer buffer = CharBuffer .allocate (bufferSize );
363+ status = LexFloatClientNative .GetHostLicenseEntitlementSetDisplayName (buffer , bufferSize );
364+ if (LF_OK == status ) {
365+ return buffer .toString ().trim ();
366+ }
367+ } else {
368+ ByteBuffer buffer = ByteBuffer .allocate (bufferSize );
369+ status = LexFloatClientNative .GetHostLicenseEntitlementSetDisplayName (buffer , bufferSize );
370+ if (LF_OK == status ) {
371+ return new String (buffer .array (), "UTF-8" ).trim ();
372+ }
373+ }
374+ throw new LexFloatClientException (status );
375+ }
376+
377+ /**
378+ * Gets the feature entitlements associated with the LexFloatServer license.
379+ *
380+ * Feature entitlements can be linked directly to a license (license feature entitlements)
381+ * or via entitlement sets. If a feature entitlement is defined in both, the value from
382+ * the license feature entitlement takes precedence, overriding the entitlement set value.
383+ *
384+ * @return Returns a list of host feature entitlements.
385+ * @throws LexFloatClientException
386+ * @throws UnsupportedEncodingException
387+ */
388+ public static List <HostFeatureEntitlement > GetHostFeatureEntitlements () throws LexFloatClientException , UnsupportedEncodingException {
389+ int status ;
390+ int bufferSize = 4096 ;
391+ if (Platform .isWindows ()) {
392+ CharBuffer buffer = CharBuffer .allocate (bufferSize );
393+ status = LexFloatClientNative .GetHostFeatureEntitlementsInternal (buffer , bufferSize );
394+ if (LF_OK == status ) {
395+ String hostFeatureEntitlementsJson = buffer .toString ().trim ();
396+ if (!hostFeatureEntitlementsJson .isEmpty ()) {
397+ ObjectMapper objectMapper = new ObjectMapper ();
398+ try {
399+ List <HostFeatureEntitlement > hostFeatureEntitlements = objectMapper .readValue (hostFeatureEntitlementsJson , new TypeReference <List <HostFeatureEntitlement >>() {});
400+ return hostFeatureEntitlements ;
401+ } catch (JsonProcessingException e ) {}
402+ } else {
403+ return new ArrayList <>();
404+ }
405+ }
406+ } else {
407+ ByteBuffer buffer = ByteBuffer .allocate (bufferSize );
408+ status = LexFloatClientNative .GetHostFeatureEntitlementsInternal (buffer , bufferSize );
409+ if (LF_OK == status ) {
410+ String hostFeatureEntitlementsJson = new String (buffer .array (), "UTF-8" ).trim ();
411+ if (!hostFeatureEntitlementsJson .isEmpty ()) {
412+ ObjectMapper objectMapper = new ObjectMapper ();
413+ try {
414+ List <HostFeatureEntitlement > hostFeatureEntitlements = objectMapper .readValue (hostFeatureEntitlementsJson , new TypeReference <List <HostFeatureEntitlement >>() {});
415+ return hostFeatureEntitlements ;
416+ } catch (JsonProcessingException e ) {}
417+ } else {
418+ return new ArrayList <>();
419+ }
420+ }
421+ }
422+ throw new LexFloatClientException (status );
423+ }
424+
425+ /**
426+ * Gets the feature entitlement associated with the LexFloatServer license.
427+ *
428+ * Feature entitlements can be linked directly to a license (license feature entitlements)
429+ * or via entitlement sets. If a feature entitlement is defined in both, the value from
430+ * the license feature entitlement takes precedence, overriding the entitlement set value.
431+ *
432+ * @param name The name of the feature.
433+ * @return Returns the host feature entitlement object.
434+ * @throws LexFloatClientException
435+ * @throws UnsupportedEncodingException
436+ */
437+ public static HostFeatureEntitlement GetHostFeatureEntitlement (String name ) throws LexFloatClientException , UnsupportedEncodingException {
438+ int status ;
439+ int bufferSize = 1024 ;
440+ if (Platform .isWindows ()) {
441+ CharBuffer buffer = CharBuffer .allocate (bufferSize );
442+ status = LexFloatClientNative .GetHostFeatureEntitlementInternal (new WString (name ), buffer , bufferSize );
443+ if (LF_OK == status ) {
444+ String hostFeatureEntitlementJson = buffer .toString ().trim ();
445+ ObjectMapper objectMapper = new ObjectMapper ();
446+ try {
447+ HostFeatureEntitlement hostFeatureEntitlement = objectMapper .readValue (hostFeatureEntitlementJson , HostFeatureEntitlement .class );
448+ return hostFeatureEntitlement ;
449+ } catch (JsonProcessingException e ) {}
450+ }
451+ } else {
452+ ByteBuffer buffer = ByteBuffer .allocate (bufferSize );
453+ status = LexFloatClientNative .GetHostFeatureEntitlementInternal (name , buffer , bufferSize );
454+ if (LF_OK == status ) {
455+ String hostFeatureEntitlementJson = new String (buffer .array (), "UTF-8" ).trim ();
456+ ObjectMapper objectMapper = new ObjectMapper ();
457+ try {
458+ HostFeatureEntitlement hostFeatureEntitlement = objectMapper .readValue (hostFeatureEntitlementJson , HostFeatureEntitlement .class );
459+ return hostFeatureEntitlement ;
460+ } catch (JsonProcessingException e ) {}
461+ }
462+ }
463+ throw new LexFloatClientException (status );
464+ }
465+
318466 /**
319467 * Get the value of the license metadata field associated with the
320468 * LexFloatServer license key
0 commit comments