|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jp.protection.pub.LicenseHost
public class LicenseHost
This class is intended to check license and notify interested listeners
about the checking process and its results. It works in conjunction with a
LicenseReader
instance used to locate and read license.
Field Summary | |
---|---|
protected static java.text.DateFormat |
DATE_FORMAT
|
protected boolean |
fAllowFlexibleExpirationDate
|
protected LicenseHostIssueResolver |
fIssueResolver
|
protected LicenseAcceptanceDelegate |
fLicenseAcceptanceDelegate
|
protected java.util.Vector |
fLicenseHostListeners
|
protected LicenseReader |
fLicenseReader
|
protected java.lang.String |
fLicenseTextCommercial
|
protected java.lang.String |
fLicenseTextEvaluation
|
protected java.util.List |
fSecretStorages
|
protected boolean |
fVerbose
|
static java.lang.String |
LICENSE_HOST_HINT_CLEAR_PREVIOUS_SHUTDOWN_DATE
|
static java.lang.String |
PROPERTY_ALREADY_EXPIRED
Defines the name of the property used to store the alreadyExpired
property in the SecretStorages |
protected static java.lang.String |
PROPERTY_FLEXIBLE_EXP_DATE_PROCESSED
|
static java.lang.String |
PROPERTY_LICENSE_ACCEPTED
Defines the name of the property used to store the licenseAccepted
property in the SecretStorages |
static java.lang.String |
PROPERTY_PREVIOUS_EXPIRATION_DATE
Defines the name of the property used to store the previousExpirationDate
property in the SecretStorages |
static java.lang.String |
PROPERTY_PREVIOUS_SHUTDOWN_DATE
Defines the name of the property used to store the previousShutdownDate
property in the SecretStorages |
Constructor Summary | |
---|---|
LicenseHost()
Constructs a LicenseHost instance. |
|
LicenseHost(LicenseReader aLicenseReader)
Constructs a LicenseHost instance and assigns the LicenseReader instance. |
|
LicenseHost(LicenseReader aLicenseReader,
LicenseHostListener aLicenseHostListener)
Constructs a LicenseHost instance, assigns
LicenseReader instance and adds a
LicenseHostListener . |
Method Summary | |
---|---|
void |
addLicenseHostListener(LicenseHostListener l)
Adds a LicenseHostListener to the list of listeners |
void |
addSecretStorage(SecretStorage aSecretStorage)
Adds a SecretStorage instance to the list of secret storages. |
protected boolean |
checkActivation(LicenseImpl aLicense)
|
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 |
checkExpiration(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)
Main method of the LicenseHost that does all the work of license checking
against provided parameters. |
void |
checkLicense(java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion,
boolean aForceLicenseRead)
Main method of the LicenseHost that does all the work of license checking
against provided parameters. |
protected void |
checkLicenseAcceptance(License aLicense)
|
protected boolean |
checkLicenseLock(LicenseImpl aLicense)
|
protected boolean |
checkLicenseUpgrade(License aLicense)
|
protected boolean |
checkProduct(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
protected boolean |
checkProductFeatures(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
protected boolean |
checkProductFeaturesImpl(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
protected boolean |
checkProductImpl(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
protected boolean |
checkProductVersions(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
protected boolean |
checkProductVersionsImpl(LicenseImpl aLicense,
java.lang.String aProduct,
int aProductMajorVersion,
int aProductMinorVersion)
|
protected static boolean |
dateIn(java.util.Date aDate,
java.util.Date aStart,
java.util.Date aFinish)
|
protected void |
error(java.lang.String aMessage)
|
protected void |
error(java.lang.Throwable ex)
|
protected void |
fireFeatureChecked(LicenseHost aSource,
License aLicense,
java.lang.String aFeature,
boolean isEnabled)
|
protected void |
fireLicenseAccepted(LicenseHost aSource,
License aLicense,
boolean isAccepted)
|
protected void |
fireLicenseExpired(LicenseHost aSource,
License aLicense)
|
protected void |
fireLicenseInvalid(LicenseHost aSource,
License aLicense)
|
protected void |
fireLicenseOk(LicenseHost aSource,
License aLicense)
|
protected void |
fireProductFeaturesSupported(License aLicense)
|
protected java.lang.String |
getAlreadyExpiredPropertyName()
|
LicenseHostIssueResolver |
getIssueResolver()
Returns issue resolver instance |
License |
getLicense()
Returns license read by the LicenseReader |
License |
getLicense(boolean aForceRead)
Returns license read by the LicenseReader |
LicenseAcceptanceDelegate |
getLicenseAcceptanceDelegate()
Returns the LicenseAcceptanceDelegate instance used during
the license checking procedure to ensure that the license is accepted or rejected |
java.util.Date |
getLicenseExpirationDate(boolean useGracePeriod)
Returns the license expiration date based on expiration date stored in the current license and pervious expiration read from Secret Storage's. |
java.lang.String |
getLicenseExpireInfo(License aLicense)
Composes and returns textual representation of the license expiration information. |
LicenseReader |
getLicenseReader()
Returns the LicenseReader instance used to read licenses |
java.lang.String |
getLicenseTextCommercial()
Returns the text of the commercial license agreement, which should be assigned to the license during the checking procedure. |
java.lang.String |
getLicenseTextEvaluation()
Returns the text of the evaluation license agreement, which should be assigned to the license during the checking procedure. |
java.util.Date |
getPreviousExpirationDate()
Returns the first known expiration date using values stored in Secret Storage's. |
protected java.lang.String |
getPreviousExpirationDatePropertyName()
|
java.util.List |
getSecretStorages()
Returns the list of secret storages |
boolean |
isAllowFlexibleExpirationDate()
Checks whether the expiration date of the read license should be adjusted based on the combination of the current system date and the specified duration of the evaluation period. |
protected boolean |
isAlreadyExpired()
|
protected boolean |
isFlexibleExpirationDateProcessed(LicenseImpl aLicense)
|
boolean |
isLicenseAccepted()
Checks whether the license is already accepted by the user. |
boolean |
isVerbose()
Checks whether license host runs in verbose mode. |
boolean |
loadSecretStorageBooleanProperty(java.lang.String aPropertyName,
boolean isOrOperation,
boolean aDefaultValue,
boolean aForceLoad)
Loads boolean property value from Secret Storage's. |
java.util.Date |
loadSecretStorageDateProperty(java.lang.String aPropertyName,
boolean isEarliest,
java.util.Date aDefaultValue,
boolean aForceLoad)
Loads date property value from Secret Storage's. |
int |
loadSecretStorageIntProperty(java.lang.String aPropertyName,
boolean isMax,
long aDefaultValue,
boolean aForceLoad)
Loads int property value from Secret Storage's. |
long |
loadSecretStorageLongProperty(java.lang.String aPropertyName,
boolean isMax,
long aDefaultValue,
boolean aForceLoad)
Loads long property value from Secret Storage's. |
java.lang.String |
loadSecretStorageProperty(java.lang.String aPropertyName,
java.lang.String aDefaultValue)
Loads first encountered property value from Secret Storage's. |
static java.lang.String |
loadText(java.lang.Class aBaseClass,
java.lang.String aResourceName)
Utility method for loading text from the application resource. |
protected void |
processFlexibleExpirationDate(LicenseImpl aLicense)
|
void |
release()
Releases all the resources acquired by License Host |
void |
removeLicenseHostListener(LicenseHostListener l)
Removes a LicenseHostListener |
void |
removeSecretStorage(SecretStorage aSecretStorage)
Removes the SecretStorage instance from the list of secret storages. |
void |
saveSecretStorageProperty(java.lang.String aPropertyName,
java.lang.String aValue)
Saves property value to all registered Secret Storage's. |
void |
setAllowFlexibleExpirationDate(boolean anAllowFlexibleExpirationDate)
Specifies whether the expiration date of the read license should be adjusted based on the combination of the current system date and the specified duration of the evaluation period. |
protected void |
setAreadyExpired(boolean aValue)
|
protected void |
setFlexibleExpirationDateProcessed(LicenseImpl aLicense,
boolean aValue)
|
void |
setIssueResolver(LicenseHostIssueResolver aIssueResolver)
Specifies issue resolver |
void |
setLicenseAcceptanceDelegate(LicenseAcceptanceDelegate aLicenseAcceptanceDelegate)
Specifies a LicenseAcceptanceDelegate instance, which should be used during
the license checking procedure to ensure that the license is accepted or rejected |
void |
setLicenseAccepted(boolean aValue)
Specifies whether license is already accepted by the user. |
void |
setLicenseReader(LicenseReader aLicenseReader)
Specifies a LicenseReader instance used to read licenses |
protected void |
setLicenseState(LicenseImpl aLicense,
int aState)
|
void |
setLicenseTextCommercial(java.lang.String aLicenseTextCommercial)
Specifies the text of the commercial license agreement, which should be assigned to the license during the checking procedure. |
void |
setLicenseTextEvaluation(java.lang.String aLicenseTextEvaluation)
Specifies the text of the evaluation license agreement, which should be assigned to the license during the checking procedure. |
protected void |
setPreviousExpirationDate(java.util.Date aDate)
|
void |
setVerbose(boolean aVerbose)
Specifies that license host should run in verbose mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected LicenseReader fLicenseReader
protected java.util.List fSecretStorages
protected LicenseAcceptanceDelegate fLicenseAcceptanceDelegate
protected java.lang.String fLicenseTextCommercial
protected java.lang.String fLicenseTextEvaluation
protected LicenseHostIssueResolver fIssueResolver
protected boolean fVerbose
public static final java.lang.String PROPERTY_LICENSE_ACCEPTED
licenseAccepted
property in the SecretStorages
public static final java.lang.String PROPERTY_ALREADY_EXPIRED
alreadyExpired
property in the SecretStorages
public static final java.lang.String PROPERTY_PREVIOUS_EXPIRATION_DATE
previousExpirationDate
property in the SecretStorages
public static final java.lang.String PROPERTY_PREVIOUS_SHUTDOWN_DATE
previousShutdownDate
property in the SecretStorages
public static final java.lang.String LICENSE_HOST_HINT_CLEAR_PREVIOUS_SHUTDOWN_DATE
protected java.util.Vector fLicenseHostListeners
protected boolean fAllowFlexibleExpirationDate
protected static final java.lang.String PROPERTY_FLEXIBLE_EXP_DATE_PROCESSED
protected static final java.text.DateFormat DATE_FORMAT
Constructor Detail |
---|
public LicenseHost()
LicenseHost
instance. Note: a valid
LicenseReader
instance should be assigned to allow license
checking.
public LicenseHost(LicenseReader aLicenseReader)
LicenseHost
instance and assigns the LicenseReader
instance.
aLicenseReader
- an instance to assignpublic LicenseHost(LicenseReader aLicenseReader, LicenseHostListener aLicenseHostListener)
LicenseHost
instance, assigns
LicenseReader
instance and adds a
LicenseHostListener
.
aLicenseReader
- a LicenseReader
instance to assignaLicenseHostListener
- a LicenseHostListener
to addMethod Detail |
---|
public LicenseHostIssueResolver getIssueResolver()
LicenseHostIssueResolver
public void setIssueResolver(LicenseHostIssueResolver aIssueResolver)
aIssueResolver
- an instance of the LicenseHostIssueResolver
public java.lang.String getLicenseTextCommercial()
public void setLicenseTextCommercial(java.lang.String aLicenseTextCommercial)
aLicenseTextCommercial
- text of the commercial license agreementpublic java.lang.String getLicenseTextEvaluation()
public void setLicenseTextEvaluation(java.lang.String aLicenseTextEvaluation)
aLicenseTextEvaluation
- text of the evaluation license agreementpublic LicenseAcceptanceDelegate getLicenseAcceptanceDelegate()
LicenseAcceptanceDelegate
instance used during
the license checking procedure to ensure that the license is accepted or rejected
LicenseAcceptanceDelegate
instance; null
if not yet assignedpublic void setLicenseAcceptanceDelegate(LicenseAcceptanceDelegate aLicenseAcceptanceDelegate)
LicenseAcceptanceDelegate
instance, which should be used during
the license checking procedure to ensure that the license is accepted or rejected
aLicenseAcceptanceDelegate
- LicenseAcceptanceDelegate
instance to assignpublic void addSecretStorage(SecretStorage aSecretStorage)
SecretStorage
instance to the list of secret storages.
aSecretStorage
- a SecretStorage
instance to addpublic void removeSecretStorage(SecretStorage aSecretStorage)
SecretStorage
instance from the list of secret storages.
aSecretStorage
- a SecretStorage
instance to removepublic java.util.List getSecretStorages()
public LicenseReader getLicenseReader()
LicenseReader
instance used to read licenses
LicenseReader
instancepublic void setLicenseReader(LicenseReader aLicenseReader)
LicenseReader
instance used to read licenses
aLicenseReader
- a LicenseReader
instance to assignpublic void checkLicense(java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
LicenseHost
that does all the work of license checking
against provided parameters. It is possible to analyze checking procedure results after
this method return by reading the license properties or during the license
checking by listening to the various events using the LicenseHostListener
(s)
and the LicenseReaderListener
(s) listeners
aProduct
- 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.public void checkLicense(java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion, boolean aForceLicenseRead)
LicenseHost
that does all the work of license checking
against provided parameters. It is possible to analyze checking results after
this method return by reading the license properties or during the license
checking by listening to the various events using the LicenseHostListener
(s)
and the LicenseReaderListener
(s) listeners
aProduct
- 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 as valid if the aProductMinorVersion
is less or equals
to the license productMinorVersion
property.aForceLicenseRead
- forces LicenseReader
to re-read
licensepublic boolean isVerbose()
true
if license host runs in verbose mode, false
otherwise.public void setVerbose(boolean aVerbose)
std err
. Otherwise
there is no output in order to prevent the code flow analysis.
aVerbose
- true
if reader should run in verbose mode,
false
otherwise.protected void error(java.lang.String aMessage)
protected void error(java.lang.Throwable ex)
protected void fireProductFeaturesSupported(License aLicense)
protected void setLicenseState(LicenseImpl aLicense, int aState)
protected boolean checkProductImpl(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected boolean checkProduct(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected boolean checkProductVersionsImpl(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected boolean checkProductVersions(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected boolean checkProductFeaturesImpl(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected boolean checkProductFeatures(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected static boolean dateIn(java.util.Date aDate, java.util.Date aStart, java.util.Date aFinish)
protected final boolean checkExpiration(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected boolean checkExpirationImpl(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected void checkLicenseAcceptance(License aLicense)
protected void checkCommercial(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
protected boolean checkLicenseUpgrade(License aLicense)
protected boolean checkActivation(LicenseImpl aLicense)
protected boolean checkLicenseLock(LicenseImpl aLicense)
protected void checkEvaluation(LicenseImpl aLicense, java.lang.String aProduct, int aProductMajorVersion, int aProductMinorVersion)
public java.util.Date getLicenseExpirationDate(boolean useGracePeriod)
useGracePeriod
- specifies whether grace period should be used to
clarify result.
null
if unknown.protected java.lang.String getPreviousExpirationDatePropertyName()
public java.util.Date getPreviousExpirationDate()
null
if unknown.protected void setPreviousExpirationDate(java.util.Date aDate)
public java.util.Date loadSecretStorageDateProperty(java.lang.String aPropertyName, boolean isEarliest, java.util.Date aDefaultValue, boolean aForceLoad)
aPropertyName
- name of the property to return.isEarliest
- specifies that the earliest found date should be returned.aDefaultValue
- value should be returned if property is not foundaForceLoad
- forces Secret Storage to reload its state
aDefaultValue
if property is not found
in any storage.public int loadSecretStorageIntProperty(java.lang.String aPropertyName, boolean isMax, long aDefaultValue, boolean aForceLoad)
aPropertyName
- name of the property to return.isMax
- specifies that the maximum found value should be returned; minimum otherwise.aDefaultValue
- value should be returned if property is not foundaForceLoad
- forces Secret Storage to reload its state
aDefaultValue
if property is not found in any storage.public long loadSecretStorageLongProperty(java.lang.String aPropertyName, boolean isMax, long aDefaultValue, boolean aForceLoad)
aPropertyName
- name of the property to return.isMax
- specifies that the maximum found value should be returned; minimum otherwise.aDefaultValue
- value should be returned if property is not foundaForceLoad
- forces Secret Storage to reload its state
aDefaultValue
if property is not found in any storage.public boolean loadSecretStorageBooleanProperty(java.lang.String aPropertyName, boolean isOrOperation, boolean aDefaultValue, boolean aForceLoad)
aPropertyName
- name of the property to return.isOrOperation
- specifies that boolean OR
operation should
be applied to found values; AND
operation
will be applied otherwise.aDefaultValue
- value should be returned if property is not foundaForceLoad
- forces Secret Storage to reload its state
aDefaultValue
if property is not found
in any storage.public void saveSecretStorageProperty(java.lang.String aPropertyName, java.lang.String aValue)
aPropertyName
- name of the property to save.aValue
- value of the property to savepublic java.lang.String loadSecretStorageProperty(java.lang.String aPropertyName, java.lang.String aDefaultValue)
aPropertyName
- name of the property to return.aDefaultValue
- value should be returned if property is not found
aDefaultValue
if property is not found
in any storage.protected java.lang.String getAlreadyExpiredPropertyName()
protected boolean isAlreadyExpired()
protected void setAreadyExpired(boolean aValue)
public void setLicenseAccepted(boolean aValue)
SecretStorages
to save the specified value
aValue
- true
if license is already accepted by the user;
false
otherwisepublic boolean isLicenseAccepted()
SecretStorages
to determine a return value
true
if license is already accepted by the user;
false
otherwisepublic void addLicenseHostListener(LicenseHostListener l)
LicenseHostListener
to the list of listeners
l
- a LicenseHostListener
to be addedpublic void removeLicenseHostListener(LicenseHostListener l)
LicenseHostListener
l
- a LicenseHostListener
to be removedprotected void fireLicenseAccepted(LicenseHost aSource, License aLicense, boolean isAccepted)
protected void fireLicenseExpired(LicenseHost aSource, License aLicense)
protected void fireLicenseOk(LicenseHost aSource, License aLicense)
protected void fireLicenseInvalid(LicenseHost aSource, License aLicense)
protected void fireFeatureChecked(LicenseHost aSource, License aLicense, java.lang.String aFeature, boolean isEnabled)
public License getLicense()
LicenseReader
License
instancepublic License getLicense(boolean aForceRead)
LicenseReader
aForceRead
- forces LicenseReader
to re-read license
License
instancepublic boolean isAllowFlexibleExpirationDate()
true
if this property is turned on; false
otherwisepublic void setAllowFlexibleExpirationDate(boolean anAllowFlexibleExpirationDate)
anAllowFlexibleExpirationDate
- true
if expiration date of read license should be adjusted
according to the current date and duration of the evaluation period; false
otherwiseprotected boolean isFlexibleExpirationDateProcessed(LicenseImpl aLicense)
protected void setFlexibleExpirationDateProcessed(LicenseImpl aLicense, boolean aValue)
protected void processFlexibleExpirationDate(LicenseImpl aLicense)
public void release()
public static java.lang.String loadText(java.lang.Class aBaseClass, java.lang.String aResourceName)
aBaseClass
- a base class to load resource.aResourceName
- a resource name.
public java.lang.String getLicenseExpireInfo(License aLicense)
aLicense
- to return expiration information for.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |