com.jp.protection.pub.pro
Class LicenseHostPro

java.lang.Object
  extended by com.jp.protection.pub.LicenseHost
      extended by com.jp.protection.pub.pro.LicenseHostPro
All Implemented Interfaces:
NetworkCheckListener, java.util.EventListener

public class LicenseHostPro
extends LicenseHost
implements NetworkCheckListener

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
           
static java.lang.String ACTIVATION_KEY_PATTERN
           
static char ACTIVATION_KEY_PATTERN_CHAR
           
protected  int fActivationLockOptions
           
protected  boolean fAutoIncUseCount
           
protected  boolean fCheckPreviousShutdownDate
           
protected  LicenseHostProContext fContext
           
protected static int fJavaVersion
           
protected  LicenseReaderListener fLicenseReaderListener
           
protected  LicenseUpgradeChecker fLicenseUpgradeChecker
           
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 static boolean fUseJava6Context
           
protected  boolean fUseStrippedActivationKeyChars
           
static int LOCK_ALL
          Option specifies that license should be locked to all supported attributes
static int LOCK_CPU_ID
          Option specifies that license should be locked to the CPU ID.
static int LOCK_CPU_NUMBER
          Option specifies that license should be locked to CPU number
static int LOCK_CUSTOM_ATTRIBUTE
          Option specifies that license should be locked to the custom attribute.
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_MOTHERBOARD_ID
          Option specifies that license should be locked to the moterboard ID.
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
           
static java.lang.String USE_JAVA6_CONTEXT
           
 
Fields inherited from class com.jp.protection.pub.LicenseHost
DATE_FORMAT, fAllowFlexibleExpirationDate, fIssueResolver, fLicenseAcceptanceDelegate, fLicenseHostListeners, fLicenseReader, fLicenseTextCommercial, fLicenseTextEvaluation, fSecretStorages, fVerbose, LICENSE_HOST_HINT_CLEAR_PREVIOUS_SHUTDOWN_DATE, PROPERTY_ALREADY_EXPIRED, PROPERTY_FLEXIBLE_EXP_DATE_PROCESSED, PROPERTY_LICENSE_ACCEPTED, PROPERTY_PREVIOUS_EXPIRATION_DATE, PROPERTY_PREVIOUS_SHUTDOWN_DATE
 
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 canCheckoutLicense()
          Tests whether a License can be checked out for offline use
 boolean canDeactivateLicense()
          Checks whether license can be deactivated
 boolean canTerminateLicensePass()
          Tests whether License Pass can be terminated
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 checkLicensePass(License aLicense, LicensePass aPass)
           
protected  boolean checkLicenseUpgrade(License aLicense)
           
protected  boolean checkLockGracePeriod(LicenseImpl aLicense)
           
protected  void checkNumberOfCopies(License aLicense)
           
 boolean checkoutLicense()
          Checks out a License for offline use without need to lock the License using Licensing Server
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)
           
protected  LicenseHostProContext createContext()
           
protected  LicenseUpgradeChecker createLicenseUpgradeChecker()
           
 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  java.lang.String getCpuID()
           
 java.lang.String getCustomLockAttribute()
           
protected  int getDaysLeft(License aLicense, int aGracePeriod)
           
 int getExpireDaysLeft(License aLicense)
          Returns number of days left till the license will be considered as expired one
protected  java.util.Date getFirstLaunchDate(License aLicense)
           
protected static java.lang.String getFirstLaunchDatePropertyName(License aLicense)
           
protected  int getInstallID()
           
static int getJavaVersion()
           
 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()
           
 LicenseUpgradeChecker getLicenseUpgradeChecker()
          Returns an instance of LicenseUpgradeChecker used to perform check of validity of upgrade license
 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()
           
protected  java.lang.String getMotherboardID()
           
 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
protected static java.lang.String getPropertyNameForLicense(java.lang.String aPropertyName, License aLicense)
           
 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.
static boolean isUseJava6Context()
           
 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 setLicenseUpgradeChecker(LicenseUpgradeChecker aLicenseUpgradeChecker)
          Specifies an instance of LicenseUpgradeChecker should be used to perform check of validity of upgrade license
 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)
           
static void setUseJava6Context(boolean aUseJava6Context)
           
 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 terminateLicensePass()
          Terminate ability to use a License offline by removing corresponding License Pass
 boolean unlockLicense()
          Release license lock using the Licensing Server
 
Methods inherited from class com.jp.protection.pub.LicenseHost
addLicenseHostListener, addSecretStorage, checkExpiration, checkLicense, checkLicenseAcceptance, checkProduct, checkProductFeatures, checkProductFeaturesImpl, checkProductImpl, checkProductVersions, checkProductVersionsImpl, dateIn, error, error, fireFeatureChecked, fireLicenseAccepted, fireLicenseExpired, fireLicenseInvalid, fireLicenseOk, getAlreadyExpiredPropertyName, getIssueResolver, getLicense, getLicense, getLicenseAcceptanceDelegate, getLicenseExpirationDate, getLicenseReader, getLicenseTextCommercial, getLicenseTextEvaluation, getPreviousExpirationDate, getPreviousExpirationDatePropertyName, getSecretStorages, isAllowFlexibleExpirationDate, isAlreadyExpired, isFlexibleExpirationDateProcessed, isLicenseAccepted, isVerbose, loadSecretStorageBooleanProperty, loadSecretStorageDateProperty, loadSecretStorageIntProperty, loadSecretStorageLongProperty, loadSecretStorageProperty, loadText, processFlexibleExpirationDate, removeLicenseHostListener, removeSecretStorage, saveSecretStorageProperty, setAllowFlexibleExpirationDate, setAreadyExpired, setFlexibleExpirationDateProcessed, setIssueResolver, setLicenseAcceptanceDelegate, setLicenseAccepted, setLicenseTextCommercial, setLicenseTextEvaluation, setPreviousExpirationDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

res

static java.util.ResourceBundle res

PROPERTY_CLEAR_PREVIOUS_SHUTDOWN_DATE

public static final java.lang.String PROPERTY_CLEAR_PREVIOUS_SHUTDOWN_DATE
See Also:
Constant Field Values

fNetworkCheckEnabled

protected boolean fNetworkCheckEnabled

fSignature

protected java.lang.String fSignature

fNetworkCheck

protected NetworkCheck fNetworkCheck

fAutoIncUseCount

protected boolean fAutoIncUseCount

LOCK_MAC_ADDRESS

public static final int LOCK_MAC_ADDRESS
Option specifies that license should be locked to MAC address of network card

See Also:
Constant Field Values

LOCK_USER

public static final int LOCK_USER
Option specifies that license should be locked to the current user

See Also:
Constant Field Values

LOCK_IP_ADDRESS

public static final int LOCK_IP_ADDRESS
Option specifies that license should be locked to IP address of the local host

See Also:
Constant Field Values

LOCK_HOST

public static final int LOCK_HOST
Option specifies that license should be locked to computer name

See Also:
Constant Field Values

LOCK_CPU_NUMBER

public static final int LOCK_CPU_NUMBER
Option specifies that license should be locked to CPU number

See Also:
Constant Field Values

LOCK_INSTALL_ID

public static final int LOCK_INSTALL_ID
Option specifies that license should be locked to internal installation ID randomly generated during the first application run.

See Also:
Constant Field Values

LOCK_CPU_ID

public static final int LOCK_CPU_ID
Option specifies that license should be locked to the CPU ID. Note: use of this attribute requires presense of OSHI library. See lib/deploy.html for more information

Since:
4.9.0
See Also:
Constant Field Values

LOCK_MOTHERBOARD_ID

public static final int LOCK_MOTHERBOARD_ID
Option specifies that license should be locked to the moterboard ID. Note: use of this attribute requires presense of OSHI library. See lib/deploy.html for more information

Since:
4.9.0
See Also:
Constant Field Values

LOCK_CUSTOM_ATTRIBUTE

public static final int LOCK_CUSTOM_ATTRIBUTE
Option specifies that license should be locked to the custom attribute.

Since:
4.9.0
See Also:
Constant Field Values

LOCK_ALL

public static final int LOCK_ALL
Option specifies that license should be locked to all supported attributes

See Also:
Constant Field Values

fActivationLockOptions

protected int fActivationLockOptions

ACTIVATION_KEY_CHARS_STRIPPED

protected static final char[] ACTIVATION_KEY_CHARS_STRIPPED

ACTIVATION_KEY_CHARS

protected static final char[] ACTIVATION_KEY_CHARS

fUseStrippedActivationKeyChars

protected boolean fUseStrippedActivationKeyChars

ACTIVATION_KEY_PATTERN

public static final java.lang.String ACTIVATION_KEY_PATTERN
See Also:
Constant Field Values

ACTIVATION_KEY_PATTERN_CHAR

public static final char ACTIVATION_KEY_PATTERN_CHAR
See Also:
Constant Field Values

fLicensingServiceSupport

protected LicensingServiceSupport fLicensingServiceSupport

fMaintainPreviousShutdownDate

protected boolean fMaintainPreviousShutdownDate

fShutdownHook

protected java.lang.Thread fShutdownHook

fCheckPreviousShutdownDate

protected boolean fCheckPreviousShutdownDate

PROPERTY_USE_COUNT

public static final java.lang.String PROPERTY_USE_COUNT
Defines property for storing application use count

See Also:
Constant Field Values

PROPERTY_LICENSING_SERVER_ADDRESS

public static final java.lang.String PROPERTY_LICENSING_SERVER_ADDRESS
Defines the name of the property used to store the licensingServerAddress property in the SecretStorages

See Also:
Constant Field Values

PROPERTY_FIRST_LAUNCH_DATE

public static final java.lang.String PROPERTY_FIRST_LAUNCH_DATE
Defines the name of the property used to store the firstLaunchDate property in the SecretStorages

See Also:
Constant Field Values

PROPERTY_ACTIVATION_NUMBER

public static final java.lang.String PROPERTY_ACTIVATION_NUMBER
Defines the name of the property used to store the activationNumber property in the SecretStorages

See Also:
Constant Field Values

PROPERTY_INSTALL_ID

public static final java.lang.String PROPERTY_INSTALL_ID
Defines the name of the property used to store the installID property in the SecretStorages

See Also:
Constant Field Values

fJavaVersion

protected static int fJavaVersion

fContext

protected LicenseHostProContext fContext

USE_JAVA6_CONTEXT

public static final java.lang.String USE_JAVA6_CONTEXT
See Also:
Constant Field Values

fUseJava6Context

protected static boolean fUseJava6Context

FMT_OR_USAGES_LEFT

protected static final java.text.MessageFormat FMT_OR_USAGES_LEFT

FMT_USAGES_LEFT

protected static final java.text.MessageFormat FMT_USAGES_LEFT

fLicenseReaderListener

protected LicenseReaderListener fLicenseReaderListener

PROPERTY_LATEST_DEACTIVATION_KEY

public static final java.lang.String PROPERTY_LATEST_DEACTIVATION_KEY
Defines property for storing latest Deactivation Key

See Also:
Constant Field Values

PROPERTY_LATEST_ACTIVATION_KEY

public static final java.lang.String PROPERTY_LATEST_ACTIVATION_KEY
Defines property for storing latest Activation Key

See Also:
Constant Field Values

fLicenseUpgradeChecker

protected LicenseUpgradeChecker fLicenseUpgradeChecker
Constructor Detail

LicenseHostPro

public LicenseHostPro()
Constructs a LicenseHost instance. Note: a valid LicenseReader instance should be assigned to allow license checking.


LicenseHostPro

public LicenseHostPro(LicenseReader aLicenseReader)
Constructs a LicenseHost instance and assigns the LicenseReader instance.

Parameters:
aLicenseReader - an instance to assign

LicenseHostPro

public LicenseHostPro(LicenseReader aLicenseReader,
                      LicenseHostListener aLicenseHostListener)
Constructs a LicenseHost instance, assigns the LicenseReader instance and adds a LicenseHostListener.

Parameters:
aLicenseReader - a LicenseReader instance to assign
aLicenseHostListener - a LicenseHostListener to add
Method Detail

checkExpirationImpl

protected boolean checkExpirationImpl(LicenseImpl aLicense,
                                      java.lang.String aProduct,
                                      int aProductMajorVersion,
                                      int aProductMinorVersion)
Overrides:
checkExpirationImpl in class LicenseHost

getExpireDaysLeft

public int getExpireDaysLeft(License aLicense)
Returns number of days left till the license will be considered as expired one

Parameters:
aLicense - license to return number of days for
Returns:
number of days

getUseCountLeft

public int getUseCountLeft(License aLicense)
Returns number of usage left till the license will be considered as expired one

Parameters:
aLicense - license to return number of usages for
Returns:
number of usages left or -1 if usage limit is not specified

checkUseCount

protected boolean checkUseCount(License aLicense)

checkCommercial

protected void checkCommercial(LicenseImpl aLicense,
                               java.lang.String aProduct,
                               int aProductMajorVersion,
                               int aProductMinorVersion)
Overrides:
checkCommercial in class LicenseHost

saveFirstLaunchDate

protected void saveFirstLaunchDate()

checkEvaluation

protected void checkEvaluation(LicenseImpl aLicense,
                               java.lang.String aProduct,
                               int aProductMajorVersion,
                               int aProductMinorVersion)
Overrides:
checkEvaluation in class LicenseHost

clearPreviousShutdownDate

protected void clearPreviousShutdownDate()

checkLicense

public 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. 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

Overrides:
checkLicense in class LicenseHost
Parameters:
aProduct - product identifier
aProductMajorVersion - 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 license

isCheckNumberOfCopies

public boolean isCheckNumberOfCopies()
Deprecated. use isNetworkCheckEnabled() instead

Tests whether checking number of concurrently running copies with the same license is enabled.

Returns:
true if checking is enabled; false otherwise

setCheckNumberOfCopies

public void setCheckNumberOfCopies(boolean aCheckNumberOfCopies)
Deprecated. use setNetworkCheckEnabled() instead

Specifies that checking number of concurrently running copies with the same license is enabled.

Parameters:
aCheckNumberOfCopies - true if checking should be enabled; false otherwise

isNetworkCheckEnabled

public boolean isNetworkCheckEnabled()
Tests whether using network check for tracking number of concurrently running copies with the same license is enabled.

Returns:
true if network check is enabled; false otherwise

setNetworkCheckEnabled

public void setNetworkCheckEnabled(boolean aNetworkCheckEnabled)
Specifies that using network check for tracking number of concurrently running copies with the same license is enabled.

Parameters:
aNetworkCheckEnabled - true if network check should be enabled; false otherwise

fireProductFeaturesSupported

protected void fireProductFeaturesSupported(License aLicense)
Overrides:
fireProductFeaturesSupported in class LicenseHost

getSignature

public 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. The publisher's company name can be considered as good signature.

Returns:
signature value

setSignature

public void setSignature(java.lang.String aSignature)
Specifies signature value

Parameters:
aSignature - signature value

checkNumberOfCopies

protected void checkNumberOfCopies(License aLicense)

disallowSeveralInstances

protected void disallowSeveralInstances(License aLicense)

stopNetworkCheck

public void stopNetworkCheck()
Stops the network check for presence of concurrently running copies. This method should be called only if application does not exit using the 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.


getNetworkCheckHostPolicy

public int getNetworkCheckHostPolicy()
Returns check host policy.

Returns:
check host policy as one of NetworkCheck.POLICY_ constants.

setNetworkCheckHostPolicy

public void setNetworkCheckHostPolicy(int aCheckHostPolicy)
Specifies check host policy as one of NetworkCheck.POLICY_ constants.

Parameters:
aCheckHostPolicy - check host policy

getNetworkCheck

public NetworkCheck getNetworkCheck()
Returns a NetworkCheck instance used to check for presence of concurrently running copies over the network.

Returns:
a NetworkCheck instance.

fireNumberCopiesViolation

protected void fireNumberCopiesViolation(LicenseHost aSource,
                                         License aLicense,
                                         int aNumberInUse)

fireLicenseAboutToExpire

protected void fireLicenseAboutToExpire(LicenseHost aSource,
                                        License aLicense,
                                        int aDaysLeft)

fireLicenseNeedLock

protected void fireLicenseNeedLock(LicenseHost aSource,
                                   License aLicense,
                                   int aDaysLeft)

fireLicenseLockExpired

protected void fireLicenseLockExpired(LicenseHost aSource,
                                      License aLicense,
                                      java.lang.String aReason)

fireLicenseLockRevoked

protected void fireLicenseLockRevoked(LicenseHost aSource,
                                      License aLicense,
                                      java.lang.String aReason)

fireLicenseUseLimitAboutReach

protected void fireLicenseUseLimitAboutReach(LicenseHost aSource,
                                             License aLicense,
                                             int aUseLeft)

fireLicenseLockViolation

protected void fireLicenseLockViolation(LicenseHost aSource,
                                        License aLicense)

fireLicenseNotActivated

protected void fireLicenseNotActivated(LicenseHost aSource,
                                       License aLicense)

fireLicenseNotLocked

protected void fireLicenseNotLocked(LicenseHost aSource,
                                    License aLicense,
                                    java.lang.String aReason)

fireLicenseNeedActivation

protected void fireLicenseNeedActivation(LicenseHost aSource,
                                         License aLicense,
                                         int aDaysLeft)

isAutoIncUseCount

public boolean isAutoIncUseCount()
Returns whether license usage count should be autoincremented during the next license check (if license is OK).

Returns:
true if license usage count should be autoincremented;false otherwise

setAutoIncUseCount

public void setAutoIncUseCount(boolean aAutoIncUseCount)
Specifies that license usage count should be autoincremented during the next license check. This value is 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.

Parameters:
aAutoIncUseCount - true if license usage count should be autoincremented;false otherwise.

setLicenseState

protected void setLicenseState(LicenseImpl aLicense,
                               int aState)
Overrides:
setLicenseState in class LicenseHost

numberCopiesViolation

public void numberCopiesViolation(NetworkCheck aSource,
                                  int aNumberInUse)
NetworkCheck calls this method when it recognizes the violation in the number of concurrently running copies.

Specified by:
numberCopiesViolation in interface NetworkCheckListener
Parameters:
aSource - an instance of the NetworkCheck, which called this method
aNumberInUse - number of copies that are actually are in use now

getActivationKey

public java.lang.String getActivationKey()
Generates activation key for the license read by the license reader according to license options

Returns:
textual representation of activation key

getActivationKey

public java.lang.String getActivationKey(LicenseImpl aLicense)
Returns Activation Key for passed license. Implementation simply returns result of getActivationKey(aLicense.getLicenseNumber()) method call.

Parameters:
aLicense - license to get Activation Key for
Returns:
Activation Key

getActivationKey

public java.lang.String getActivationKey(java.lang.String aLicenseNumber)
Returns Activation Key for passed license number.

Parameters:
aLicenseNumber - number of license to get Activation Key for
Returns:
Activation Key

composeActivationKey

protected long composeActivationKey(java.lang.String aLicenseNumber)

getActivationLockOptions

public int getActivationLockOptions()
Returns the attributes a license should be locked to

Returns:
the attributes

setActivationLockOptions

public void setActivationLockOptions(int aActivationLockOptions)
Specifies the attributes a license should be locked to

Parameters:
aActivationLockOptions - the attributes passed as a concatenation of LOCK_ constants.

getActivationLockKey

public java.lang.String getActivationLockKey(LicenseImpl aLicense)
Returns Activation and Lock Key for passed license. Implementation simply returns result of getActivationLockKey(aLicense.getLicenseNumber()) method call.

Parameters:
aLicense - license to get Activation Key for
Returns:
Activation Key

getActivationLockKeys

protected java.lang.String[] getActivationLockKeys(LicenseImpl aLicense)

getActivationLockKey

public java.lang.String getActivationLockKey(java.lang.String aLicenseNumber)
Returns Activation and Lock Key for passed license number.

Parameters:
aLicenseNumber - number of license to get Activation Key for
Returns:
Activation Key

getActivationLockKeys

protected java.lang.String[] getActivationLockKeys(java.lang.String aLicenseNumber)

composeActivationLockKey

protected long composeActivationLockKey(java.lang.String aLicenseNumber,
                                        long anActivationKeyValue)

getActivationKeyChars

protected char[] getActivationKeyChars()

getActivationKeyChars

public static char[] getActivationKeyChars(boolean isUseStrippedActivationKeyChars)
Returns array of activation key characters

Parameters:
isUseStrippedActivationKeyChars - identifies whether stripped key characters should be used.
Returns:
array of activation key characters

getActivationLockKeys

protected long[] getActivationLockKeys()

getActivationLockKey

protected long getActivationLockKey()

checkSystemDateTrick

protected boolean checkSystemDateTrick()

getActivationDaysLeft

public int getActivationDaysLeft(License aLicense)
Returns number of days left till the license will be considered as not activated one

Parameters:
aLicense - license to return number of days for
Returns:
number of days

getDaysLeft

protected int getDaysLeft(License aLicense,
                          int aGracePeriod)

getLockDaysLeft

public int getLockDaysLeft(License aLicense)
Returns number of days left till the license will be considered as not locked one

Parameters:
aLicense - license to return number of days for
Returns:
number of days

checkActivationGracePeriod

protected boolean checkActivationGracePeriod(LicenseImpl aLicense)

checkLockGracePeriod

protected boolean checkLockGracePeriod(LicenseImpl aLicense)

checkActivation

protected boolean checkActivation(LicenseImpl aLicense)
Overrides:
checkActivation in class LicenseHost

checkActivationLockImpl

protected boolean checkActivationLockImpl(LicenseImpl aLicense,
                                          boolean result)
                                   throws LicenseOutdatedException
Throws:
LicenseOutdatedException

checkActivationImpl

protected boolean checkActivationImpl(LicenseImpl aLicense,
                                      boolean result)
                               throws LicenseOutdatedException
Throws:
LicenseOutdatedException

checkLicenseLock

protected boolean checkLicenseLock(LicenseImpl aLicense)
Overrides:
checkLicenseLock in class LicenseHost

checkLicenseLockImpl

protected boolean checkLicenseLockImpl(License aLicense)

checkLicensePass

protected boolean checkLicensePass(License aLicense,
                                   LicensePass aPass)

getLicensingServiceSupport

public LicensingServiceSupport getLicensingServiceSupport()
Returns LicensingServiceSupport instance used to support Licensing Server activities.

Returns:
LicensingServiceSupport instance

lockLicense

public boolean lockLicense()
Locks license using the Licensing Server

Returns:
true if license lock is acquired; false otherwise

unlockLicense

public boolean unlockLicense()
Release license lock using the Licensing Server

Returns:
true if license lock is released; false otherwise

getMACAddress

protected long getMACAddress()

getMACAddresses

protected long[] getMACAddresses()

getCpuID

protected java.lang.String getCpuID()

getMotherboardID

protected java.lang.String getMotherboardID()

getCustomLockAttribute

public java.lang.String getCustomLockAttribute()

setNativeLibFolder

public static void setNativeLibFolder(java.io.File aFolder)
Specifies the name of folder to find native libraries. Default folder is ../native_lib/

Parameters:
aFolder - the name of the folder

isUseStrippedActivationKeyChars

public boolean isUseStrippedActivationKeyChars()
Tests whether using of stripped activation key characters is enabled. Stripped characters set contains all letters and digits but excludes the following: 2, Z, 0, O, I, 1, S. Removal of these characters and numbers from generated Activation Keys will reduce errors that could potentially occur during the manual typing of them by the end-users or sales personnel during offline activation.

Returns:
true if using of stripped activation key characters is enabled; false otherwise.

setUseStrippedActivationKeyChars

public void setUseStrippedActivationKeyChars(boolean aUseStrippedActivationKeyChars)
Specifies that usage of the stripped activation key characters is enabled. If enabled then usage of the following alpha-numeric characters: 2, Z, 0, O, I, L, 1, 5, S is removed from the alphabet that is used to generate Serial Number. Removal of these characters and numbers from generated Serial Number will reduce errors that could potentially occur during the manual typing of the Serial Number by the end-users

Parameters:
aUseStrippedActivationKeyChars - true if using of stripped activation key characters is enabled; false otherwise.

getActivationKey

protected static java.lang.String getActivationKey(long aKey)

getActivationKey

protected static java.lang.String getActivationKey(long aKey,
                                                   char[] aKeyChars)

getActivationKey

public static java.lang.String getActivationKey(byte[] aKey,
                                                char[] aKeyChars)
Returns Activation Key for passed value

Parameters:
aKey - a key to get Activation Key for
aKeyChars - a key characters should be used to generate Activation Key
Returns:
Activation Key

getPreviousShutdownDate

public java.util.Date getPreviousShutdownDate()
Returns the date of last application shutdown

Returns:
date of last application shutdown

setPreviousShutdownDate

protected void setPreviousShutdownDate(java.util.Date aDate)

isCheckPreviousShutdownDate

public boolean isCheckPreviousShutdownDate()
Tests whether checking date of previous shutdown is enabled. When this check is turned on system is able to prevent unauthorized use of application with specified expiration date by changing system time backward.

Returns:
true if checking date of previous shutdown is enabled; false otherwise

setCheckPreviousShutdownDate

public void setCheckPreviousShutdownDate(boolean aCheckPreviousShutdownDate)
Specifies that check for application's previous shutdown date is enabled

Parameters:
aCheckPreviousShutdownDate - true if checking should be enabled; false otherwise.

isMaintainPreviousShutdownDate

public boolean isMaintainPreviousShutdownDate()
Returns whether pervious shutdown date is maintained

Returns:
true if pervious shutdown date is maintained; false otherwise.

setMaintainPreviousShutdownDate

public void setMaintainPreviousShutdownDate(boolean aMaintainPreviousShutdownDate)
Specifies whether application's pervious shutdown date should be maintained

Parameters:
aMaintainPreviousShutdownDate - true if pervious shutdown date should be maintained; false otherwise.

release

public void release()
Releases all the resources acquired by License Host

Overrides:
release in class LicenseHost

checkPreviousShutdownDate

protected boolean checkPreviousShutdownDate()

getUseCountPropertyName

protected static java.lang.String getUseCountPropertyName(License aLicense)

getUseCount

protected int getUseCount(License aLicense)

setUseCount

protected void setUseCount(License aLicense,
                           int aUseCount)

incUseCount

public void incUseCount()
Increases license usage count. This method can be used from the server applications to track usages according to request, sessions or other suitable criteria.


getFirstLaunchDatePropertyName

protected static java.lang.String getFirstLaunchDatePropertyName(License aLicense)

getFirstLaunchDate

protected java.util.Date getFirstLaunchDate(License aLicense)

setFirstLaunchDate

protected void setFirstLaunchDate(License aLicense,
                                  java.util.Date aDate)

getActivationNumberPropertyName

protected static java.lang.String getActivationNumberPropertyName(java.lang.String aLicenseNumber)

getActivationNumber

protected int getActivationNumber(java.lang.String aLicenseNumber)

setActivationNumber

protected void setActivationNumber(java.lang.String aLicenseNumber,
                                   int aValue)

canDeactivateLicense

public boolean canDeactivateLicense()
Checks whether license can be deactivated

Returns:
true if license can be deactivated; false otherwise.

deactivateLicense

public java.lang.String deactivateLicense()
Deactivates license on the local computer by writing incremented Activation Number to all registered secret storages.

Returns:
deactivation key that contains encoded operation result. Operation is considered successful if incremented Activation Number value was written to at least one Secret Storage.

getInstallID

protected int getInstallID()

getContext

public LicenseHostProContext getContext()
Returns context object used to obtain various system and application properties

Returns:
context object

setContext

public void setContext(LicenseHostProContext aContext)
Specifies context object should be used to obtain various system and application properties

Parameters:
aContext - context to set

setVerbose

public void setVerbose(boolean aVerbose)
Description copied from class: LicenseHost
Specifies that license host should run in verbose mode. If it runs in verbose mode all exceptions stack traces and error messages will be printed to std err. Otherwise there is no output in order to prevent the code flow analysis.

Overrides:
setVerbose in class LicenseHost
Parameters:
aVerbose - true if reader should run in verbose mode, false otherwise.

getJavaVersion

public static int getJavaVersion()

setUseJava6Context

public static void setUseJava6Context(boolean aUseJava6Context)

isUseJava6Context

public static boolean isUseJava6Context()

createContext

protected LicenseHostProContext createContext()

getLicenseExpireInfo

public java.lang.String getLicenseExpireInfo(License aLicense)
Description copied from class: LicenseHost
Composes and returns textual representation of the license expiration information.

Overrides:
getLicenseExpireInfo in class LicenseHost
Parameters:
aLicense - to return expiration information for.
Returns:
textual representation of the license expiration information.

setLicenseReader

public void setLicenseReader(LicenseReader aLicenseReader)
Description copied from class: LicenseHost
Specifies a LicenseReader instance used to read licenses

Overrides:
setLicenseReader in class LicenseHost
Parameters:
aLicenseReader - a LicenseReader instance to assign

getLicenseReaderListener

protected LicenseReaderListener getLicenseReaderListener()

getLatestDeactivationKeyPropertyName

protected static java.lang.String getLatestDeactivationKeyPropertyName(License aLicense)

getLatestDeactivationKey

public java.lang.String getLatestDeactivationKey()

getLatestDeactivationKey

protected java.lang.String getLatestDeactivationKey(License aLicense)

setLatestDeactivationKey

protected void setLatestDeactivationKey(License aLicense,
                                        java.lang.String aDeactivationKey)

getLatestActivationKeyPropertyName

protected static java.lang.String getLatestActivationKeyPropertyName(License aLicense)

getLatestActivationKey

public java.lang.String getLatestActivationKey()

getLatestActivationKey

protected java.lang.String getLatestActivationKey(License aLicense)

setLatestActivationKey

protected void setLatestActivationKey(License aLicense,
                                      java.lang.String anActivationKey)

checkoutLicense

public boolean checkoutLicense()
Checks out a License for offline use without need to lock the License using Licensing Server

Returns:
true if license has been successfully checked out; false otherwise
Since:
v5.0

canCheckoutLicense

public boolean canCheckoutLicense()
Tests whether a License can be checked out for offline use

Returns:
true if license can be checked out; false otherwise
Since:
v5.0

terminateLicensePass

public boolean terminateLicensePass()
Terminate ability to use a License offline by removing corresponding License Pass

Returns:
true if License Pass has been terminated; false otherwise
Since:
v5.0

canTerminateLicensePass

public boolean canTerminateLicensePass()
Tests whether License Pass can be terminated

Returns:
true if License can be terminated; false otherwise
Since:
v5.0

getPropertyNameForLicense

protected static java.lang.String getPropertyNameForLicense(java.lang.String aPropertyName,
                                                            License aLicense)

checkLicenseUpgrade

protected boolean checkLicenseUpgrade(License aLicense)
Overrides:
checkLicenseUpgrade in class LicenseHost

getLicenseUpgradeChecker

public LicenseUpgradeChecker getLicenseUpgradeChecker()
Returns an instance of LicenseUpgradeChecker used to perform check of validity of upgrade license

Returns:
an instance of LicenseUpgradeChecker
Since:
v5.0

setLicenseUpgradeChecker

public void setLicenseUpgradeChecker(LicenseUpgradeChecker aLicenseUpgradeChecker)
Specifies an instance of LicenseUpgradeChecker should be used to perform check of validity of upgrade license

Parameters:
aLicenseUpgradeChecker - an instance of LicenseUpgradeChecker
Since:
v5.0

createLicenseUpgradeChecker

protected LicenseUpgradeChecker createLicenseUpgradeChecker()