Package de.xima.fc.license
Class LicenseServerUtil
- java.lang.Object
-
- de.xima.fc.license.LicenseServerUtil
-
public class LicenseServerUtil extends Object
Utility class for reading data from and writing data to the product management server via HTTP requests.- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description LicenseServerUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <R> StageChain<IPromaResponse<byte[]>,R>
createDemoLicense(IPublicPromaInvocationContext pc, String parentLicenseKey, String firstname, String lastname, String email, String customerName, String currentHardwareId, Locale locale)
This method creates a demo license based on the passed parameters and returns the status code of the request and on success the license data of the demo license.static <R> StageChain<Boolean,R>
createOrUpdateItemLicense(IPublicPromaInvocationContext pc, String licenseKey, String versionKey, Locale locale, String userName)
This method gets all item licenses of a license from proma and creates or updates them in the database.static <R> StageChain<IPromaResponse<Collection<byte[]>>,R>
getAllClientLicenses(IPublicPromaInvocationContext pc, String licenseKey, Locale locale)
static <R> StageChain<String[],R>
getCurrentHardwareIdArray(IPublicPromaInvocationContext pc, String licenseKey)
static <R> StageChain<IPromaResponse<de.xima.proma.restclient.pub.gen.model.PublicHardwareIdList>,R>
getCurrentHardwareIds(IPublicPromaInvocationContext pc, String licenseKey, String versionUuid)
static <R> StageChain<IPromaResponse<byte[]>,R>
getLicenseKeyStatus(IPublicPromaInvocationContext pc, String licenseKey, String currentHardwareId, Locale locale)
This method builds an http request for checking the license key and return the status code and the license data as byte array.static <R> StageChain<Integer,R>
getLicenseStatus(IPublicPromaInvocationContext pc, String licenseKey, String currentHardwareId, Locale locale)
This method returns the status of the given license key.static <R> StageChain<Integer,R>
getLicenseUpdateStatus(IPublicPromaInvocationContext pc, String licenseKey, String versionKey, Locale locale)
Returns the status code of the given license informations.static ELicenseVersionState
getSystemLicenseVersionState()
static <R> StageChain<Boolean,R>
isDemoAllowed(IPublicPromaInvocationContext pc, Locale locale)
This method determines whether the product is allowed to create demo licenses.static void
setSystemLicenseVersionState(ELicenseVersionState systemLicenseState)
static <R> StageChain<Integer,R>
swapHardwareID(IPublicPromaInvocationContext pc, String licenseKey, String versionKey, String swapTargetId, String currentHardwareId)
Builds an http request for swapping a hardware ID.<R> StageChain<Void,R>
updateClientLicense(IPublicPromaInvocationContext pc, String key, Locale locale)
Tries to update an client-license by the given key<R> StageChain<ELicenseVersionState,R>
updateSystemLicenseVersionState(IPublicPromaInvocationContext pc, Locale locale)
Updates the system license state by an server-side http query
-
-
-
Method Detail
-
updateClientLicense
public <R> StageChain<Void,R> updateClientLicense(IPublicPromaInvocationContext pc, String key, Locale locale)
Tries to update an client-license by the given key- Parameters:
pc
- Context for accessing the PROMA API.key
- the key of the client license to updatelocale
- the locale for localized item informations- Returns:
- A stage that completes when the license was updated.
-
updateSystemLicenseVersionState
public <R> StageChain<ELicenseVersionState,R> updateSystemLicenseVersionState(IPublicPromaInvocationContext pc, Locale locale)
Updates the system license state by an server-side http query- Parameters:
pc
- Context for accessing the PROMA API.locale
- the locale for localized item informations- Returns:
- the new system license version state
-
createDemoLicense
public static <R> StageChain<IPromaResponse<byte[]>,R> createDemoLicense(IPublicPromaInvocationContext pc, String parentLicenseKey, String firstname, String lastname, String email, String customerName, String currentHardwareId, Locale locale)
This method creates a demo license based on the passed parameters and returns the status code of the request and on success the license data of the demo license. If the parent license key is null, it is the creation of a demo system license, which requires a hardware id.- Parameters:
pc
- Context for the PROMA API invocation.parentLicenseKey
- the license key of the parent licensefirstname
- the first name of the customerlastname
- the last name of the customeremail
- mail of the customercustomerName
- full name of the customercurrentHardwareId
- the current hardware idlocale
- the locale for localized license informations- Returns:
- A
Pair
with the status code of the request and if available the demo license data as byte array
-
createOrUpdateItemLicense
public static <R> StageChain<Boolean,R> createOrUpdateItemLicense(IPublicPromaInvocationContext pc, String licenseKey, String versionKey, Locale locale, String userName)
This method gets all item licenses of a license from proma and creates or updates them in the database.- Parameters:
pc
- Context for accessing the PROMA API.licenseKey
- the license key of the parent licenseversionKey
- the version key of the parent licenselocale
- the locale for localized license informationsuserName
- the user name for the item license- Returns:
- true when the request was successful or the status code of the request is a 404. Returns false if an error occurred.
-
getAllClientLicenses
public static <R> StageChain<IPromaResponse<Collection<byte[]>>,R> getAllClientLicenses(IPublicPromaInvocationContext pc, String licenseKey, Locale locale)
-
getCurrentHardwareIds
public static <R> StageChain<IPromaResponse<de.xima.proma.restclient.pub.gen.model.PublicHardwareIdList>,R> getCurrentHardwareIds(IPublicPromaInvocationContext pc, String licenseKey, String versionUuid)
-
getCurrentHardwareIdArray
public static <R> StageChain<String[],R> getCurrentHardwareIdArray(IPublicPromaInvocationContext pc, String licenseKey)
-
getLicenseKeyStatus
public static <R> StageChain<IPromaResponse<byte[]>,R> getLicenseKeyStatus(IPublicPromaInvocationContext pc, String licenseKey, String currentHardwareId, Locale locale)
This method builds an http request for checking the license key and return the status code and the license data as byte array.- Parameters:
pc
- Context for the PROMA API invocation.licenseKey
- the license key to checkcurrentHardwareId
- the current hardware idlocale
- the locale for localized license informations- Returns:
- If available the license data as byte array
-
getLicenseStatus
public static <R> StageChain<Integer,R> getLicenseStatus(IPublicPromaInvocationContext pc, String licenseKey, String currentHardwareId, Locale locale)
This method returns the status of the given license key.- Parameters:
pc
- Context for the PROMA API invocation.licenseKey
- the license key to be checkedcurrentHardwareId
- the current hardware idlocale
- the locale for localized license informations- Returns:
- the status code of the http request
-
getLicenseUpdateStatus
public static <R> StageChain<Integer,R> getLicenseUpdateStatus(IPublicPromaInvocationContext pc, String licenseKey, String versionKey, Locale locale)
Returns the status code of the given license informations.- Parameters:
pc
- Context for the PROMA API invocation.licenseKey
- license key of the license to check for updateversionKey
- version key of the license to check for updatelocale
- the locale for localized license informations- Returns:
- the status code of the license update status
-
getSystemLicenseVersionState
public static ELicenseVersionState getSystemLicenseVersionState()
-
isDemoAllowed
public static <R> StageChain<Boolean,R> isDemoAllowed(IPublicPromaInvocationContext pc, Locale locale)
This method determines whether the product is allowed to create demo licenses.- Parameters:
pc
- Context for the PROMA API invocation.locale
- the locale for localized license informations- Returns:
- true when the returned status code is 200 else return false.
-
setSystemLicenseVersionState
public static void setSystemLicenseVersionState(ELicenseVersionState systemLicenseState)
-
swapHardwareID
public static <R> StageChain<Integer,R> swapHardwareID(IPublicPromaInvocationContext pc, String licenseKey, String versionKey, String swapTargetId, String currentHardwareId)
Builds an http request for swapping a hardware ID.- Parameters:
pc
- Context for the PROMA API invocation.licenseKey
- the license key of the licenseversionKey
- the version key of the licenseswapTargetId
- the hardware id to swapcurrentHardwareId
- the current hardware id- Returns:
- The status code of the request
-
-