public class LicenseManager extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
LicenseManager() |
| Modifier and Type | Method and Description |
|---|---|
License |
activateLicense(com.licensespring.model.ActivationLicense identity)
Activate the license on the remove server.
|
License |
activateOfflineResponse(com.licensespring.model.LicenseIdentity identity,
InputStream inputStream)
Activates the license using ls_activation.lic file that was generated using LicenseSpring platform.
|
License |
activateOfflineResponse(com.licensespring.model.LicenseIdentity identity,
String filePath)
Activates the license using ls_activation.lic file that was generated using LicenseSpring platform.
|
License |
checkLicense(License license)
Check license call.
|
void |
clearLocalStorage()
Clears all local license data.
|
boolean |
deactivateLicense(com.licensespring.model.LicenseIdentity identity)
A license can be deactivated using this method, then the license can be used on another device
|
License |
getCurrent()
Returns the license from the local license file
Updates the usage timestamp
if offline mode, check locally for clock tampering before setting usage timestamp
|
com.licensespring.model.InstallationFile |
getInstallationFile(com.licensespring.model.LicenseIdentity identity)
Gets the latest installation file for the product.
|
static LicenseManager |
getInstance()
Thread-safe method to obtain the instance of LicenseManager
|
com.licensespring.model.Product |
getProductDetails()
Fetches product data from the server
|
com.licensespring.dto.UnactivatedTrialLicense |
getTrialLicense(com.licensespring.model.Customer customer)
For a trial period an email must be provided
|
com.licensespring.dto.UnactivatedTrialLicense |
getTrialLicense(String email)
For a trial period an email must be provided
|
String[] |
getVersions(com.licensespring.model.LicenseIdentity identity)
Gets all the available versions for the product configured via configuration settings
|
void |
initialize(LicenseSpringConfiguration configuration)
Should be called once per runtime.
|
void |
initialize(LicenseSpringConfiguration configuration,
com.licensespring.internal.services.LicenseRepository repository)
Should be called once per runtime.
|
boolean |
isInitialized()
Checks if the LicenseManger has been initialized
|
String |
offlineActivationFile(com.licensespring.model.LicenseIdentity identity,
String destination)
Generates an offline activation file.
|
void |
offlineActivationStream(com.licensespring.model.LicenseIdentity identity,
OutputStream outputStream)
Generates an offline activation request.
|
String |
offlineDeactivationFile(com.licensespring.model.LicenseIdentity identity,
String destination)
Generates an offline deactivation file.
|
void |
offlineDeactivationStream(com.licensespring.model.LicenseIdentity identity,
OutputStream outputStream)
Generates an offline deactivation request.
|
void |
shutdownScheduler()
Calls
ExecutorService.shutdownNow() for the periodic check executor, if period check is enabled
Used for cases where JVM doesn't get the shutdown signal and keeps a thread running indefinitely |
void |
trackVariables(com.licensespring.model.LicenseIdentity identity,
Map<String,String> variables)
Tracks custom device variables which can be seen in the platform.
|
public static LicenseManager getInstance()
public void initialize(LicenseSpringConfiguration configuration) throws com.licensespring.model.exceptions.LicenseSpringException
configuration - the configuration object containing required parameters.com.licensespring.model.exceptions.LicenseSpringExceptionpublic void initialize(LicenseSpringConfiguration configuration, com.licensespring.internal.services.LicenseRepository repository) throws com.licensespring.model.exceptions.LicenseSpringException
configuration - the configuration object containing required parameters.repository - - sdk users can implement their own local license persistence
using this method overloadcom.licensespring.model.exceptions.LicenseSpringExceptionpublic License getCurrent() throws com.licensespring.model.exceptions.LicenseSpringException
com.licensespring.model.exceptions.LicenseSpringExceptionpublic com.licensespring.dto.UnactivatedTrialLicense getTrialLicense(String email) throws com.licensespring.model.exceptions.LicenseSpringException
email - - email of the user who is signing up for the trialcom.licensespring.model.exceptions.LicenseSpringExceptionpublic com.licensespring.dto.UnactivatedTrialLicense getTrialLicense(com.licensespring.model.Customer customer)
throws com.licensespring.model.exceptions.LicenseSpringException
customer - - customer object, can be build using the builder. Only email is requiredcom.licensespring.model.exceptions.LicenseSpringExceptionpublic License activateLicense(com.licensespring.model.ActivationLicense identity) throws com.licensespring.model.exceptions.LicenseSpringException
identity - - license key or (username and password) use the ActivationLicense factory methods to build.com.licensespring.model.exceptions.LicenseSpringExceptionpublic boolean deactivateLicense(com.licensespring.model.LicenseIdentity identity)
throws com.licensespring.model.exceptions.LicenseSpringException
identity - - license key or username use the LicenseIdentity factory methods to build.com.licensespring.model.exceptions.LicenseSpringExceptionpublic License checkLicense(License license) throws com.licensespring.model.exceptions.LicenseSpringException
ServerError or ConnectionException
will perform a local check of the license object - after the grace period has passed, and the check is
performed again the method will rethrow the exception, instead
if the server returns 400 - license_not_found (deleted license),
the license file is deleted from the repositorylicense - - the license can be gotten via the getCurrent() method on the LicenseManagercom.licensespring.model.exceptions.LicenseSpringExceptionpublic com.licensespring.model.InstallationFile getInstallationFile(com.licensespring.model.LicenseIdentity identity)
throws com.licensespring.model.exceptions.LicenseSpringException
identity - - license key or username use the LicenseIdentity factory methods to build.com.licensespring.model.exceptions.LicenseSpringExceptionpublic String[] getVersions(com.licensespring.model.LicenseIdentity identity) throws com.licensespring.model.exceptions.LicenseSpringException
identity - - license key or username use the LicenseIdentity factory methods to build.com.licensespring.model.exceptions.LicenseSpringExceptionpublic void trackVariables(com.licensespring.model.LicenseIdentity identity,
Map<String,String> variables)
throws com.licensespring.model.exceptions.LicenseSpringException
identity - - license key or username use the LicenseIdentity factory methods to build.com.licensespring.model.exceptions.LicenseSpringExceptionpublic void clearLocalStorage()
throws com.licensespring.model.exceptions.LicenseSpringException
com.licensespring.model.exceptions.LicenseSpringExceptionpublic com.licensespring.model.Product getProductDetails()
throws com.licensespring.model.exceptions.LicenseSpringException
com.licensespring.model.exceptions.LicenseSpringExceptionpublic void offlineActivationStream(com.licensespring.model.LicenseIdentity identity,
OutputStream outputStream)
identity - license key or username use the LicenseIdentity factory methods to build.outputStream - the stream to write the offline deactivation requestpublic String offlineActivationFile(com.licensespring.model.LicenseIdentity identity, String destination)
identity - license key or username use the LicenseIdentity factory methods to build.com.licensespring.model.exceptions.LicenseSpringExceptionpublic String offlineDeactivationFile(com.licensespring.model.LicenseIdentity identity, String destination)
identity - license key or username use the LicenseIdentity factory methods to build.destination - - the destination file. If null, the SDK will attempt to locate the user Desktop on any
platform.
If the Desktop folder doesn't exist, it will save the file in user home. Default name is ls_deactivation.reqcom.licensespring.model.exceptions.LicenseSpringExceptionpublic void offlineDeactivationStream(com.licensespring.model.LicenseIdentity identity,
OutputStream outputStream)
identity - license key or username use the LicenseIdentity factory methods to build.outputStream - the stream to write the offline deactivation requestcom.licensespring.model.exceptions.LicenseSpringExceptionpublic License activateOfflineResponse(com.licensespring.model.LicenseIdentity identity, String filePath)
identity - license key or username use the LicenseIdentity factory methods to build.filePath - - the source file. If null, the SDK will attempt to locate the user Desktop on any
platform.
If the Desktop folder doesn't exist, it will load the file from user home. Default name is
ls_activation.liccom.licensespring.model.exceptions.LicenseSpringExceptionpublic License activateOfflineResponse(com.licensespring.model.LicenseIdentity identity, InputStream inputStream)
identity - license key or username use the LicenseIdentity factory methods to build.inputStream - the input stream containing the server response to offline activationcom.licensespring.model.exceptions.LicenseSpringExceptionpublic boolean isInitialized()
public void shutdownScheduler()
ExecutorService.shutdownNow() for the periodic check executor, if period check is enabled
Used for cases where JVM doesn't get the shutdown signal and keeps a thread running indefinitelyCopyright © 2021 Cense Data Inc.. All rights reserved.