public class LicenseManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
applicationID
The identification of the application to be checked.
|
protected java.util.Date |
build
The build date of the application to be checked.
|
static java.lang.String |
CONFIG_AGREE_REQUIRED
Configuration variable.
|
static java.lang.String |
CONFIG_SUPPORT_FROM
Configuration variable.
|
static java.lang.String |
CONFIG_SUPPORT_LEVEL
Configuration variable.
|
static java.lang.String |
CONFIG_SUPPORT_UNTIL
Configuration variable.
|
protected CryptoManager |
cryptoManager
The key management helper.
|
protected byte[] |
encryptedData
The raw license key data.
|
static java.lang.String |
ID_EVALUATION_LICENSE
License type identifier.
|
static java.lang.String |
ID_FLOATING_LICENSE
Server-based licensing for configurable n IP addresses.
|
static java.lang.String |
ID_SINGLE_MACHINE_LICENSE
One single license for a specific IP address like 192.168.1.100
|
static java.lang.String |
ID_SINGLE_USER_LICENSE
One single license for personal use on multiple machines.
|
static java.lang.String |
ID_SITE_LICENSE
Server-based licensing for class C net like 192.168.1.x
|
protected License |
license
The instance holding the license data like "product_id".
|
static int |
MAXLENGTH
The maximum length of the license key (currently 64 kilo bytes).
|
protected PassphraseProvider |
providerAES
The AES key provider (optional).
|
protected PassphraseProvider |
providerSignature
The license signature provider (optional).
|
protected java.lang.String |
recipientUserID
The hexadecimal recipient user ID to decrypt the license file.
|
protected java.lang.String |
signerUserID
The hexadecimal signer user ID to verify the license file (optional).
|
Constructor and Description |
---|
LicenseManager()
Constructor method for i18n purposes only.
|
LicenseManager(java.lang.String appid,
java.util.Date build,
java.lang.String recipient,
java.lang.String signer,
CryptoManager manager,
PassphraseProvider provideraes,
PassphraseProvider providersig)
Constructor for the license manager.
|
Modifier and Type | Method and Description |
---|---|
int |
calculateTrialDaysLeft()
Calculates the remaining days left for evaluation (evaluation license only).
|
void |
debugPrint()
Prints the current license document to
System.out . |
Agreement[] |
getAgreements()
Provides the license agreements in various localizations.
|
Configuration |
getConfiguration()
Provides the application configuration included in the license document.
|
java.lang.Object[][] |
getConfigurationForDisplay(Configuration config)
Provides the application configuration included in the license document to be displayed.
|
java.lang.String |
getConfigUserTextBoolean(boolean value)
Convenience method to get commonly used user texts for displayed configurations.
|
byte[] |
getEncryptedData()
Provides the encrypted license key data.
|
java.util.Date |
getLicenseDate()
Provides the current license creation date.
|
java.lang.String |
getLicenseID()
Provides the current unique license identifier like "lima-0000011111".
|
java.lang.String |
getLicenseProductType()
Provides the product type (e.g.
|
java.lang.String |
getLicenseType()
Provides the current license type like "Single-User License".
|
int |
getLicenseUsers()
Provides the user count for this license.
|
java.util.Properties |
getProperties()
Provides the license data as
Properties . |
boolean |
isAgreeRequired()
Shall the dialog to let the user agree to the license be presented (again)?
|
boolean |
isEvaluationLicense()
Determines whether the license is for evaluation use.
|
boolean |
isFloatingLicense()
Determines whether the license is floating.
|
java.lang.String |
isLicenseValid()
Determines whether the application can be used with the current license.
|
java.lang.String |
isLicenseValid(java.lang.String appid,
java.util.Date build)
Determines whether the given application can be used with the current license.
|
boolean |
isSingleMachineLicense()
Determines whether the license is for a single machine.
|
boolean |
isSingleUserLicense()
Determines whether the license is for a single user.
|
boolean |
isSiteLicense()
Determines whether the license is for sites.
|
boolean |
loadLicense(byte[] rawdata)
Tries to load the license from an array of bytes.
|
boolean |
loadLicense(java.io.File file)
Tries to load the license associated with a name.
|
boolean |
loadLicense(org.apache.commons.vfs2.FileObject file)
Tries to load the license associated with a name.
|
boolean |
loadLicense(java.io.InputStream istream)
Tries to load the license associated with a name.
|
boolean |
loadLicense(java.lang.String filename)
Tries to load the license associated with a name.
|
public static final java.lang.String ID_EVALUATION_LICENSE
public static final java.lang.String ID_SINGLE_USER_LICENSE
public static final java.lang.String ID_SINGLE_MACHINE_LICENSE
public static final java.lang.String ID_FLOATING_LICENSE
public static final java.lang.String ID_SITE_LICENSE
public static final int MAXLENGTH
public static final java.lang.String CONFIG_AGREE_REQUIRED
public static final java.lang.String CONFIG_SUPPORT_LEVEL
public static final java.lang.String CONFIG_SUPPORT_FROM
public static final java.lang.String CONFIG_SUPPORT_UNTIL
protected java.lang.String applicationID
protected java.util.Date build
protected java.lang.String recipientUserID
protected java.lang.String signerUserID
protected License license
protected byte[] encryptedData
protected CryptoManager cryptoManager
protected PassphraseProvider providerAES
protected PassphraseProvider providerSignature
public LicenseManager() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic LicenseManager(java.lang.String appid, java.util.Date build, java.lang.String recipient, java.lang.String signer, CryptoManager manager, PassphraseProvider provideraes, PassphraseProvider providersig)
appid
- The identification of the applicationbuild
- The build date of the application to be checkedrecipient
- The recipient user IDsigner
- The signer user ID (optional)manager
- The key management helperprovideraes
- The AES key provider (optional)providersig
- The signature provider (optional)java.lang.NullPointerException
- If parameters are null
public boolean loadLicense(java.lang.String filename) throws java.io.IOException
filename
- Name of the file to load as licensejava.io.IOException
- An I/O error occurredjava.lang.NullPointerException
- Given file name was null
java.io.FileNotFoundException
- Given file does not existpublic boolean loadLicense(java.io.File file) throws java.io.IOException
file
- The file to load as licensejava.io.IOException
- An I/O error occurredjava.lang.NullPointerException
- Given file name was null
java.io.FileNotFoundException
- Given file does not existpublic boolean loadLicense(org.apache.commons.vfs2.FileObject file) throws java.io.IOException
file
- The VFS file to load as licensejava.io.IOException
- An I/O error occurredjava.lang.NullPointerException
- Given file name was null
java.io.FileNotFoundException
- Given file does not existpublic boolean loadLicense(byte[] rawdata) throws java.io.IOException
rawdata
- The binary datajava.io.IOException
- An I/O error occurredjava.lang.NullPointerException
- Given array was null
public boolean loadLicense(java.io.InputStream istream)
istream
- The input stream to load as licensepublic java.util.Properties getProperties()
Properties
.
The supported properties follow the underlying DTD and use a prefix according to the data
block. For instance the
childs are specified product_id
,
product_type
, product_orderid
, and product_npgrade
since several child tags can be used for multiple blocks.
null
or emptypublic Agreement[] getAgreements()
null
if parsing went wrong or license is not armedpublic byte[] getEncryptedData()
null
if parsing went wrong or license is not armedpublic java.lang.String isLicenseValid()
public java.lang.String isLicenseValid(java.lang.String appid, java.util.Date build)
appid
- Unique application id like "lima-1.6.1_213"build
- The build date, will be normalized to midnightpublic boolean isEvaluationLicense()
public boolean isSingleUserLicense()
public boolean isSingleMachineLicense()
public boolean isFloatingLicense()
public boolean isSiteLicense()
public java.lang.String getLicenseType()
null
if not availablepublic java.lang.String getLicenseID()
null
if not availablepublic java.util.Date getLicenseDate()
null
if not availablepublic java.lang.String getLicenseProductType()
null
if not availablepublic int getLicenseUsers()
public int calculateTrialDaysLeft()
public Configuration getConfiguration()
public java.lang.Object[][] getConfigurationForDisplay(Configuration config)
config
- The variablesString
), may be null
public boolean isAgreeRequired()
true
)?public java.lang.String getConfigUserTextBoolean(boolean value)
value
- Value to maptrue
)?public void debugPrint()
System.out
.
Copyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.