Floating Client
Floating Client is a module that has everything related to floating licenses. See Floating Licenses for more information about floating licenses.
To include Floating Client into your Maven/Gradle project add this snippet:
Javadoc, Jar and OSGi bundle downloads can be found at: Javadoc & Downloads
The floating client, as opposed to License Client SDK, is implemented as a service. More than one instance can be created, and the usage template is you need one FloatingLicenseService per product that you need to use. For most use cases this is one. This approach enables having multiple products within your application and multiple licenses per FloatingLicenseService instance.
The License identity needs to be preserved somewhere within your application, as the references to active licenses are not saved within this module.
At the minimum there are three parameters you will need to initialize the SDK:
- apiKey, your company API key
- sharedKey, company-specific encryption key, used when signing requests
- productCode, an alphanumeric code identifying a specific product
The apiKey and sharedKey are available in the LicenseSpring Platform under "Account Setting -> Settings -> Keys tab". The productCode is tied to a specific product the license applies to and is defined while creating the product.
Optional Configuration parameters for initializing the Floating Client SDK:
- addShutdownHook indicates if you want the SDK to automatically release any currently active licenses on the device before you shut down the runtime process. Default is true.
- enablePeriodicCheck enables periodic calls to checkLicense method to prolong the license usage. It will be prolonged every time the license has passed half of its floating timeout time. Usage time is set through the LicenseSpring platform with the LicenseSpring platform with the floatingTimeout parameter in the product configuration.
- checkSubscriber subscriber on periodic check, default implementation is DoNothingSubscriber, but you can add your own implementation to handle the onSuccess and onError of the periodic check. This, of course, isn't a parameter you need to worry about if you chose not to enable periodic checks.
- requestLogging request logging for debug purposes, default is no request logging.
- appName name of the application using the SDK
- appVersion manually set the version of the application that's using the SDK.
- identityProvider set a custom IdentityProvider which generates unique keys for a particular device. Default implementation for floating is ONCE_PER_PROCESS. More details can be found on our Java Hardware (Device) IDs page.
- cacheHardwareId set to true to allow caching of hardware iDs. Default is true. You can change this to false if your hardware Id strategy isn't ONCE_PER_PROCESS.
- enableNegativeConsumptions enables the option to send negative consumptions, default is false.
- requestTimeout set the timeout of requests make to API (in seconds), default is 10 seconds
- storeMachineInfofalse by default. This toggles the collection of additional machine data, which includes:
- hostname
- ipAddress
- macAddress
- vmInfo
- osInfo
- infoToStore- specify what information to store, ignored if storeMachineInfo is false, defaults to ALL if left empty.
After setting up the SDK, there are a number of methods and objects available to the app developer.
To make the FloatingLicenseService, initialize it by passing the FloatingConfiguration object you set up earlier.
Now you can use the methods that FloatingLicenseService provides.
Attempts to activate the product using provided ActivationLicense. Returns the LicenseData object that has been activated. There are two available factory methods to make the ActivationLicense object, the method you need to use depends if your product is license key-based or user-based.
After you activated the license you can now use the check method to prolong the usage of the license and check its validity, since it expires after floating timeout period has passed (this can be set up in product configuration on the LicenseSpring platform). This method returns CheckResponse object that contains LicenseData, InstallationFile and flags if license is active, enabled or expired.
This method can be called periodically if you leave the enablePeriodicCheck true in the FloatingConfiguration so you don't have to worry about the floating license expiring while the user is still using it.
The check subscriber can be added as a custom handler when the check API is called (e.g. in a background thread).
The borrowed license expiration subscriber can be added as a custom handler when the borrowed license borrow time expires.
If your license is the Consumption type you can increase the consumptions by the parameter provided. This method makes a request to the LicenseSpring server to increase the consumptions on the identity you provided.
If your license is the Consumption type and you have certain features in your app that you want to track consumptions for separately, you can increase the consumptions of the feature by the parameter provided. This method makes a request to the LicenseSpring server to increase the feature consumptions on the identity you provided.
Returns the latest valid installation file, if installation files are defined in the LicenseSpring platform. For more details please see Product Versioning.
Tracks device based variables for end uses.
Returns an array of strings with all available versions.
Gets product details from LicenseSpring servers.
A floating cloud license is released from a current device. You need to supply the license identity. This is done automatically before the process shuts down normally if you leave the addShutdownHook property true in the FloatingConfiguration. Additionally, the license is also deactivated for the current device.
A license can be deactivated using this method, then the license can be used on another device. Returns true if deactivation was successful, false if it wasn't.
A license can be borrowed using this method.
![Doc contributor](https://s3.amazonaws.com/archbee-animals/cat.png)
![Doc contributor](https://s3.amazonaws.com/archbee-animals/lion.png)