|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jp.protection.pub.LicenseHost
com.jp.protection.pub.pro.LicenseHostPro
public class LicenseHostPro
This class represents Professional edition implementation of the license host. It extends the LicenseHost
functionality by adding support of:
| Field Summary | |
|---|---|
protected static char[] |
ACTIVATION_KEY_CHARS
|
protected static char[] |
ACTIVATION_KEY_CHARS_STRIPPED
|
protected static java.lang.String |
ACTIVATION_KEY_PATTERN
|
protected static char |
ACTIVATION_KEY_PATTERN_CHAR
|
protected int |
fActivationLockOptions
|
protected boolean |
fAutoIncUseCount
|
protected boolean |
fCheckPreviousShutdownDate
|
protected LicenseHostProContext |
fContext
|
protected LicenseReaderListener |
fLicenseReaderListener
|
protected LicensingServiceSupport |
fLicensingServiceSupport
|
protected boolean |
fMaintainPreviousShutdownDate
|
protected static java.text.MessageFormat |
FMT_OR_USAGES_LEFT
|
protected static java.text.MessageFormat |
FMT_USAGES_LEFT
|
protected NetworkCheck |
fNetworkCheck
|
protected boolean |
fNetworkCheckEnabled
|
protected java.lang.Thread |
fShutdownHook
|
protected java.lang.String |
fSignature
|
protected boolean |
fUseStrippedActivationKeyChars
|
static int |
LOCK_ALL
Option specifies that license should be locked to all supported attributes |
static int |
LOCK_CPU_NUMBER
Option specifies that license should be locked to CPU number |
static int |
LOCK_HOST
Option specifies that license should be locked to computer name |
static int |
LOCK_INSTALL_ID
Option specifies that license should be locked to internal installation ID randomly generated during the first application run. |
static int |
LOCK_IP_ADDRESS
Option specifies that license should be locked to IP address of the local host |
static int |
LOCK_MAC_ADDRESS
Option specifies that license should be locked to MAC address of network card |
static int |
LOCK_USER
Option specifies that license should be locked to the current user |
static java.lang.String |
PROPERTY_ACTIVATION_NUMBER
Defines the name of the property used to store the activationNumber
property in the SecretStorages |
static java.lang.String |
PROPERTY_CLEAR_PREVIOUS_SHUTDOWN_DATE
|
static java.lang.String |
PROPERTY_FIRST_LAUNCH_DATE
Defines the name of the property used to store the firstLaunchDate
property in the SecretStorages |
static java.lang.String |
PROPERTY_INSTALL_ID
Defines the name of the property used to store the installID
property in the SecretStorages |
static java.lang.String |
PROPERTY_LATEST_ACTIVATION_KEY
Defines property for storing latest Activation Key |
static java.lang.String |
PROPERTY_LATEST_DEACTIVATION_KEY
Defines property for storing latest Deactivation Key |
static java.lang.String |
PROPERTY_LICENSING_SERVER_ADDRESS
Defines the name of the property used to store the licensingServerAddress
property in the SecretStorages |
static java.lang.String |
PROPERTY_USE_COUNT
Defines property for storing application use count |
(package private) static java.util.ResourceBundle |
res
|
| Constructor Summary | |
|---|---|
LicenseHostPro()
Constructs a LicenseHost instance. |
|
LicenseHostPro(LicenseReader aLicenseReader)
Constructs a LicenseHost instance and assigns the LicenseReader instance. |
|
LicenseHostPro(LicenseReader aLicenseReader,
LicenseHostListener aLicenseHostListener)
Constructs a LicenseHost instance, assigns
the LicenseReader instance and adds a
LicenseHostListener. |
|
| Method Summary | |
|---|---|
boolean |
canDeactivateLicense()
Checks whether license can be deactivated |
protected boolean |
checkActivation(LicenseImpl aLicense)
|
protected boolean |
checkActivationGracePeriod(LicenseImpl aLicense)
|
protected boolean |
checkActivationImpl(LicenseImpl aLicense,
boolean result)
|
protected boolean |
checkActivationLockImpl(LicenseImpl aLicense,
boolean result)
|
protected void |
checkCommercial(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
protected void |
checkEvaluation(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
protected boolean |
checkExpirationImpl(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
void |
checkLicense(java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion,
boolean aForceLicenseRead)
Main method of LicenseHostPro that does all the work of license checking
against provided parameters. |
protected boolean |
checkLicenseLock(LicenseImpl aLicense)
|
protected boolean |
checkLicenseLockImpl(License aLicense)
|
protected boolean |
checkLockGracePeriod(LicenseImpl aLicense)
|
protected void |
checkNumberOfCopies(License aLicense)
|
protected boolean |
checkPreviousShutdownDate()
|
protected boolean |
checkSystemDateTrick()
|
protected boolean |
checkUseCount(License aLicense)
|
protected void |
clearPreviousShutdownDate()
|
protected long |
composeActivationKey(java.lang.String aLicenseNumber)
|
protected long |
composeActivationLockKey(java.lang.String aLicenseNumber,
long anActivationKeyValue)
|
java.lang.String |
deactivateLicense()
Deactivates license on the local computer by writing incremented Activation Number to all registered secret storages. |
protected void |
disallowSeveralInstances(License aLicense)
|
protected void |
fireLicenseAboutToExpire(LicenseHost aSource,
License aLicense,
int aDaysLeft)
|
protected void |
fireLicenseLockExpired(LicenseHost aSource,
License aLicense,
java.lang.String aReason)
|
protected void |
fireLicenseLockRevoked(LicenseHost aSource,
License aLicense,
java.lang.String aReason)
|
protected void |
fireLicenseLockViolation(LicenseHost aSource,
License aLicense)
|
protected void |
fireLicenseNeedActivation(LicenseHost aSource,
License aLicense,
int aDaysLeft)
|
protected void |
fireLicenseNeedLock(LicenseHost aSource,
License aLicense,
int aDaysLeft)
|
protected void |
fireLicenseNotActivated(LicenseHost aSource,
License aLicense)
|
protected void |
fireLicenseNotLocked(LicenseHost aSource,
License aLicense,
java.lang.String aReason)
|
protected void |
fireLicenseUseLimitAboutReach(LicenseHost aSource,
License aLicense,
int aUseLeft)
|
protected void |
fireNumberCopiesViolation(LicenseHost aSource,
License aLicense,
int aNumberInUse)
|
protected void |
fireProductFeaturesSupported(License aLicense)
|
int |
getActivationDaysLeft(License aLicense)
Returns number of days left till the license will be considered as not activated one |
java.lang.String |
getActivationKey()
Generates activation key for the license read by the license reader according to license options |
static java.lang.String |
getActivationKey(byte[] aKey,
char[] aKeyChars)
Returns Activation Key for passed value |
java.lang.String |
getActivationKey(LicenseImpl aLicense)
Returns Activation Key for passed license. |
protected static java.lang.String |
getActivationKey(long aKey)
|
protected static java.lang.String |
getActivationKey(long aKey,
char[] aKeyChars)
|
java.lang.String |
getActivationKey(java.lang.String aLicenseNumber)
Returns Activation Key for passed license number. |
protected char[] |
getActivationKeyChars()
|
static char[] |
getActivationKeyChars(boolean isUseStrippedActivationKeyChars)
Returns array of activation key characters |
protected long |
getActivationLockKey()
|
java.lang.String |
getActivationLockKey(LicenseImpl aLicense)
Returns Activation and Lock Key for passed license. |
java.lang.String |
getActivationLockKey(java.lang.String aLicenseNumber)
Returns Activation and Lock Key for passed license number. |
protected long[] |
getActivationLockKeys()
|
protected java.lang.String[] |
getActivationLockKeys(LicenseImpl aLicense)
|
protected java.lang.String[] |
getActivationLockKeys(java.lang.String aLicenseNumber)
|
int |
getActivationLockOptions()
Returns the attributes a license should be locked to |
protected int |
getActivationNumber(java.lang.String aLicenseNumber)
|
protected static java.lang.String |
getActivationNumberPropertyName(java.lang.String aLicenseNumber)
|
LicenseHostProContext |
getContext()
Returns context object used to obtain various system and application properties |
protected int |
getDaysLeft(License aLicense,
int aGracePeriod)
|
protected java.util.Date |
getFirstLaunchDate(License aLicense)
|
protected static java.lang.String |
getFirstLaunchDatePropertyName(License aLicense)
|
protected int |
getInstallID()
|
java.lang.String |
getLatestActivationKey()
|
protected java.lang.String |
getLatestActivationKey(License aLicense)
|
protected static java.lang.String |
getLatestActivationKeyPropertyName(License aLicense)
|
java.lang.String |
getLatestDeactivationKey()
|
protected java.lang.String |
getLatestDeactivationKey(License aLicense)
|
protected static java.lang.String |
getLatestDeactivationKeyPropertyName(License aLicense)
|
java.lang.String |
getLicenseExpireInfo(License aLicense)
Composes and returns textual representation of the license expiration information. |
protected LicenseReaderListener |
getLicenseReaderListener()
|
LicensingServiceSupport |
getLicensingServiceSupport()
Returns LicensingServiceSupport instance used to support Licensing Server activities. |
int |
getLockDaysLeft(License aLicense)
Returns number of days left till the license will be considered as not locked one |
protected long |
getMACAddress()
|
protected long[] |
getMACAddresses()
|
NetworkCheck |
getNetworkCheck()
Returns a NetworkCheck instance used to check for presence of concurrently running copies over the
network. |
int |
getNetworkCheckHostPolicy()
Returns check host policy. |
java.util.Date |
getPreviousShutdownDate()
Returns the date of last application shutdown |
java.lang.String |
getSignature()
Returns signature that is used during the checking for the number of concurrently running copies to uniquely identify product's publisher. |
protected int |
getUseCount(License aLicense)
|
int |
getUseCountLeft(License aLicense)
Returns number of usage left till the license will be considered as expired one |
protected static java.lang.String |
getUseCountPropertyName(License aLicense)
|
void |
incUseCount()
Increases license usage count. |
boolean |
isAutoIncUseCount()
Returns whether license usage count should be autoincremented during the next license check (if license is OK). |
boolean |
isCheckNumberOfCopies()
Deprecated. use isNetworkCheckEnabled() instead |
boolean |
isCheckPreviousShutdownDate()
Tests whether checking date of previous shutdown is enabled. |
boolean |
isMaintainPreviousShutdownDate()
Returns whether pervious shutdown date is maintained |
boolean |
isNetworkCheckEnabled()
Tests whether using network check for tracking number of concurrently running copies with the same license is enabled. |
boolean |
isUseStrippedActivationKeyChars()
Tests whether using of stripped activation key characters is enabled. |
boolean |
lockLicense()
Locks license using the Licensing Server |
void |
numberCopiesViolation(NetworkCheck aSource,
int aNumberInUse)
NetworkCheck calls this method when it recognizes the violation in the number of concurrently running copies. |
void |
release()
Releases all the resources acquired by License Host |
protected void |
saveFirstLaunchDate()
|
void |
setActivationLockOptions(int aActivationLockOptions)
Specifies the attributes a license should be locked to |
protected void |
setActivationNumber(java.lang.String aLicenseNumber,
int aValue)
|
void |
setAutoIncUseCount(boolean aAutoIncUseCount)
Specifies that license usage count should be autoincremented during the next license check. |
void |
setCheckNumberOfCopies(boolean aCheckNumberOfCopies)
Deprecated. use setNetworkCheckEnabled() instead |
void |
setCheckPreviousShutdownDate(boolean aCheckPreviousShutdownDate)
Specifies that check for application’s previous shutdown date is enabled |
void |
setContext(LicenseHostProContext aContext)
Specifies context object should be used to obtain various system and application properties |
protected void |
setFirstLaunchDate(License aLicense,
java.util.Date aDate)
|
protected void |
setLatestActivationKey(License aLicense,
java.lang.String anActivationKey)
|
protected void |
setLatestDeactivationKey(License aLicense,
java.lang.String aDeactivationKey)
|
void |
setLicenseReader(LicenseReader aLicenseReader)
Specifies a LicenseReader instance used to read licenses |
protected void |
setLicenseState(LicenseImpl aLicense,
int aState)
|
void |
setMaintainPreviousShutdownDate(boolean aMaintainPreviousShutdownDate)
Specifies whether application’s pervious shutdown date should be maintained |
static void |
setNativeLibFolder(java.io.File aFolder)
Specifies the name of folder to find native libraries. |
void |
setNetworkCheckEnabled(boolean aNetworkCheckEnabled)
Specifies that using network check for tracking number of concurrently running copies with the same license is enabled. |
void |
setNetworkCheckHostPolicy(int aCheckHostPolicy)
Specifies check host policy as one of NetworkCheck.POLICY_ constants. |
protected void |
setPreviousShutdownDate(java.util.Date aDate)
|
void |
setSignature(java.lang.String aSignature)
Specifies signature value |
protected void |
setUseCount(License aLicense,
int aUseCount)
|
void |
setUseStrippedActivationKeyChars(boolean aUseStrippedActivationKeyChars)
Specifies that usage of the stripped activation key characters is enabled. |
void |
setVerbose(boolean aVerbose)
Specifies that license host should run in verbose mode. |
void |
stopNetworkCheck()
Stops the network check for presence of concurrently running copies. |
boolean |
unlockLicense()
Release license lock using the Licensing Server |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static java.util.ResourceBundle res
public static final java.lang.String PROPERTY_CLEAR_PREVIOUS_SHUTDOWN_DATE
protected boolean fNetworkCheckEnabled
protected java.lang.String fSignature
protected NetworkCheck fNetworkCheck
protected boolean fAutoIncUseCount
public static final int LOCK_MAC_ADDRESS
public static final int LOCK_USER
public static final int LOCK_IP_ADDRESS
public static final int LOCK_HOST
public static final int LOCK_CPU_NUMBER
public static final int LOCK_INSTALL_ID
public static final int LOCK_ALL
protected int fActivationLockOptions
protected static final char[] ACTIVATION_KEY_CHARS_STRIPPED
protected static final char[] ACTIVATION_KEY_CHARS
protected boolean fUseStrippedActivationKeyChars
protected static final java.lang.String ACTIVATION_KEY_PATTERN
protected static final char ACTIVATION_KEY_PATTERN_CHAR
protected LicensingServiceSupport fLicensingServiceSupport
protected boolean fMaintainPreviousShutdownDate
protected java.lang.Thread fShutdownHook
protected boolean fCheckPreviousShutdownDate
public static final java.lang.String PROPERTY_USE_COUNT
public static final java.lang.String PROPERTY_LICENSING_SERVER_ADDRESS
licensingServerAddress
property in the SecretStorages
public static final java.lang.String PROPERTY_FIRST_LAUNCH_DATE
firstLaunchDate
property in the SecretStorages
public static final java.lang.String PROPERTY_ACTIVATION_NUMBER
activationNumber
property in the SecretStorages
public static final java.lang.String PROPERTY_INSTALL_ID
installID
property in the SecretStorages
protected LicenseHostProContext fContext
protected static final java.text.MessageFormat FMT_OR_USAGES_LEFT
protected static final java.text.MessageFormat FMT_USAGES_LEFT
protected LicenseReaderListener fLicenseReaderListener
public static final java.lang.String PROPERTY_LATEST_DEACTIVATION_KEY
public static final java.lang.String PROPERTY_LATEST_ACTIVATION_KEY
| Constructor Detail |
|---|
public LicenseHostPro()
LicenseHost instance. Note: a valid
LicenseReader instance should be assigned to allow license
checking.
public LicenseHostPro(LicenseReader aLicenseReader)
LicenseHost instance and assigns the LicenseReader instance.
aLicenseReader - an instance to assign
public LicenseHostPro(LicenseReader aLicenseReader,
LicenseHostListener aLicenseHostListener)
LicenseHost instance, assigns
the LicenseReader instance and adds a
LicenseHostListener.
aLicenseReader - a LicenseReader instance to assignaLicenseHostListener - a LicenseHostListener to add| Method Detail |
|---|
protected boolean checkExpirationImpl(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
checkExpirationImpl in class LicenseHostpublic int getUseCountLeft(License aLicense)
aLicense - license to return number of usages for
-1 if usage limit is not specifiedprotected boolean checkUseCount(License aLicense)
protected void checkCommercial(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
checkCommercial in class LicenseHostprotected void saveFirstLaunchDate()
protected void checkEvaluation(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
checkEvaluation in class LicenseHostprotected void clearPreviousShutdownDate()
public void checkLicense(java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion,
boolean aForceLicenseRead)
LicenseHostPro that does all the work of license checking
against provided parameters. It is possible to analyze checking process results after
this method return by reading the license properties or during license
checking by listening to the various events using the LicenseHostListener(s)
and LicenseReaderListener(s) listeners
checkLicense in class LicenseHostaProduct - product identifieraProductMajorVersion - major version of the product. The license is
considered valid if the
aProductMajorVersion is equals to
the license productMajorVersion
property.aProductMinorVersion - minor version of the product. The license is
considered valid if the
aProductMinorVersion is less or equals
to the license productMinorVersion
property.aForceLicenseRead - forces the LicenseReader to re-read
licensepublic boolean isCheckNumberOfCopies()
isNetworkCheckEnabled() instead
true if checking is enabled; false otherwisepublic void setCheckNumberOfCopies(boolean aCheckNumberOfCopies)
setNetworkCheckEnabled() instead
aCheckNumberOfCopies - true if checking should be enabled; false otherwisepublic boolean isNetworkCheckEnabled()
true if network check is enabled; false otherwisepublic void setNetworkCheckEnabled(boolean aNetworkCheckEnabled)
aNetworkCheckEnabled - true if network check should be enabled; false otherwiseprotected void fireProductFeaturesSupported(License aLicense)
fireProductFeaturesSupported in class LicenseHostpublic java.lang.String getSignature()
public void setSignature(java.lang.String aSignature)
aSignature - signature valueprotected void checkNumberOfCopies(License aLicense)
protected void disallowSeveralInstances(License aLicense)
public void stopNetworkCheck()
System.exit() call.
An example of such application would be a servlet or an EJB that can be undeployed without the need to
shutdown the servlet or an EJB container.
public int getNetworkCheckHostPolicy()
NetworkCheck.POLICY_ constants.public void setNetworkCheckHostPolicy(int aCheckHostPolicy)
NetworkCheck.POLICY_ constants.
aCheckHostPolicy - check host policypublic NetworkCheck getNetworkCheck()
NetworkCheck instance used to check for presence of concurrently running copies over the
network.
NetworkCheck instance.
protected void fireNumberCopiesViolation(LicenseHost aSource,
License aLicense,
int aNumberInUse)
protected void fireLicenseAboutToExpire(LicenseHost aSource,
License aLicense,
int aDaysLeft)
protected void fireLicenseNeedLock(LicenseHost aSource,
License aLicense,
int aDaysLeft)
protected void fireLicenseLockExpired(LicenseHost aSource,
License aLicense,
java.lang.String aReason)
protected void fireLicenseLockRevoked(LicenseHost aSource,
License aLicense,
java.lang.String aReason)
protected void fireLicenseUseLimitAboutReach(LicenseHost aSource,
License aLicense,
int aUseLeft)
protected void fireLicenseLockViolation(LicenseHost aSource,
License aLicense)
protected void fireLicenseNotActivated(LicenseHost aSource,
License aLicense)
protected void fireLicenseNotLocked(LicenseHost aSource,
License aLicense,
java.lang.String aReason)
protected void fireLicenseNeedActivation(LicenseHost aSource,
License aLicense,
int aDaysLeft)
public boolean isAutoIncUseCount()
true if license usage count should be autoincremented;false otherwisepublic void setAutoIncUseCount(boolean aAutoIncUseCount)
true by default that is suitable for GUI or console utility applications. For server
application this feature should be turned off to eliminate redundunt increment on startup.
aAutoIncUseCount - true if license usage count should be autoincremented;false
otherwise.
protected void setLicenseState(LicenseImpl aLicense,
int aState)
setLicenseState in class LicenseHost
public void numberCopiesViolation(NetworkCheck aSource,
int aNumberInUse)
numberCopiesViolation in interface NetworkCheckListeneraSource - an instance of the NetworkCheck, which called this methodaNumberInUse - number of copies that are actually are in use nowpublic java.lang.String getActivationKey()
public java.lang.String getActivationKey(LicenseImpl aLicense)
getActivationKey(aLicense.getLicenseNumber()) method
call.
aLicense - license to get Activation Key for
public java.lang.String getActivationKey(java.lang.String aLicenseNumber)
aLicenseNumber - number of license to get Activation Key for
protected long composeActivationKey(java.lang.String aLicenseNumber)
public int getActivationLockOptions()
public void setActivationLockOptions(int aActivationLockOptions)
aActivationLockOptions - the attributes passed as a concatenation of
LOCK_ constants.public java.lang.String getActivationLockKey(LicenseImpl aLicense)
getActivationLockKey(aLicense.getLicenseNumber()) method
call.
aLicense - license to get Activation Key for
protected java.lang.String[] getActivationLockKeys(LicenseImpl aLicense)
public java.lang.String getActivationLockKey(java.lang.String aLicenseNumber)
aLicenseNumber - number of license to get Activation Key for
protected java.lang.String[] getActivationLockKeys(java.lang.String aLicenseNumber)
protected long composeActivationLockKey(java.lang.String aLicenseNumber,
long anActivationKeyValue)
protected char[] getActivationKeyChars()