|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.vs.ezlicrun.EzLicenseInfo
The class manages the state of the information pertaining to
a license key and provides a method to check a license key.
How to use for checking a license key in an ISV product:
1. Instantiate this class:
info = new EzLicenseInfo();
2. Check the license key:
int warningBitmap = info.checkLicenseKey(
licenseKey, etc.);
3. If no exception, the key is good, and the accessors
for the class can be invoked to obtain the decomposed
info such as quota limit, expiration date, concurrent-user
limit, etc.
4. If the returned warning bit map is non-zero, appropriate
warning messages / alerts may be issued by the ISV
application to the end user informing them of impending
expirations, quota exhaustion, etc.
Field Summary | |
static int |
EZLIC_MODE_CUSTOM_COOKIE
Custom cookie |
static int |
EZLIC_MODE_CUSTOM_KEY
Custom key |
static int |
EZLIC_MODE_METERED
Metered |
static int |
EZLIC_MODE_OPTIONS
Option-enabling |
static int |
EZLIC_MODE_TIME
Time limited |
static int |
EZLIC_MODEL_SERVER
Server license model |
static int |
EZLIC_MODEL_USER
Single-user license model |
static int |
EZLIC_TYPE_SVR_CONC
Concurrent user |
static int |
EZLIC_TYPE_SVR_CPU
CPU count |
static int |
EZLIC_TYPE_SVR_MHZ
CPU MHZ |
static int |
EZLIC_TYPE_SVR_NMU
Named-user |
static int |
EZLIC_TYPE_U_FLOAT
Floating |
static int |
EZLIC_TYPE_U_NODE
Node-locked |
static int |
EZLIC_TYPE_U_USER
User-locked |
Constructor Summary | |
EzLicenseInfo()
|
Method Summary | |
int |
checkLicenseKey(java.lang.String licenseKey,
EzLicCustomLicenseInterface customKeyHandler,
java.lang.Object customKeyContext,
int daysLeftThreshold,
long quotaUsageToDate,
long quotaThreshold,
int daysGracePeriod,
long quotaGrace,
java.lang.String userHostNet,
long currUsageValue)
(Full version:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. |
java.lang.String |
checkLicenseKeySecure(java.lang.String licenseKey,
java.lang.String keyCookie,
EzLicExceptionBase customException,
EzLicCustomLicenseInterface customKeyHandler,
java.lang.Object customKeyContext,
int daysLeftThreshold,
long quotaUsageToDate,
long quotaThreshold,
int daysGracePeriod,
long quotaGrace,
java.lang.String userHostNet,
long currUsageValue)
(Secure version:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. |
int |
checkMultiUserLicenseKeyBasic(java.lang.String licenseKey,
int daysLeftThreshold,
long quotaUsageToDate,
long quotaThreshold,
int daysGracePeriod,
long quotaGrace,
java.lang.String hostNetName,
long currUsageValue)
(Basic multi-user license check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. |
int |
checkSingleUserLicenseKeyBasic(java.lang.String licenseKey,
int daysLeftThreshold,
long quotaUsageToDate,
long quotaThreshold,
int daysGracePeriod,
long quotaGrace,
java.lang.String userHostName)
(Basic single-user license check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. |
static java.lang.String |
createKeyCookieSeed(java.lang.String userHost)
createKeyCookieSeed: Create a key cookie seed that is the first key cookie passed into the "checkLicenseKeySecure" API call by an application. |
java.lang.String |
getCustomCookie()
getCustomCookie: returns custom cookie contained in the license key, null if none |
java.lang.String |
getCustomKey()
getCustomKey: returns custom key contained in the license key, null if none |
boolean |
getEnforce()
getEnforce: returns whether user / host name check is enforced |
java.util.Date |
getExpirationDate()
getExpirationDate: returns expiration date, null if none |
java.lang.String |
getLicenseKey()
getLicenseKey: returns license key |
int |
getLicenseModeBitmap()
getLicenseModeBitmap: returns license mode bitmap, bits set per EZLIC_MODE_*. |
int |
getLicenseModelCode()
getLicenseModelCode: returns license model code |
int |
getLicenseTypeCode()
getLicenseTypeCode: returns license type code |
java.lang.String |
getOptions()
getOptions: returns options string, null if none |
long |
getQuotaValue()
getQuotaValue: returns quota limit value, -1 if no quota limit. |
long |
getUsageValue()
getUsageValue: returns usage limit value (cpu / CPU MHZ etc.) for the license key, -1 if no limit. |
java.lang.String |
getUserHostNetName()
getUserOrHostName: returns user / host name, null if none |
int |
getWarningsBitmap()
getWarningsBitmap: returns warning bitmap for license key |
void |
setCustomCookie(java.lang.String customCookie)
setCustomCookie: sets custom cookie value |
void |
setCustomKey(java.lang.String customKey)
setCustomKey: sets custom key value |
void |
setEnforce(boolean enforce)
setEnforce: sets user / host enforcement policy |
void |
setExpirationDate(java.util.Date expirationDate)
setExpirationDate: sets license expiration date |
void |
setLicenseKey(java.lang.String licenseKey)
setLicenseKey: sets license key |
void |
setLicenseModeBitmap(int licenseModeBitmap)
setLicenseModeBitmap: sets license mode bitmap |
void |
setLicenseModelCode(int licenseModelCode)
setLicenseModelCode: sets license model code |
void |
setLicenseTypeCode(int licenseTypeCode)
setLicenseTypeCode: sets license type code |
void |
setOptions(java.lang.String options)
setOptions: sets options string |
void |
setQuotaValue(long quotaValue)
setQuotaValue: sets usage quota value |
void |
setUsageValue(long usageValue)
setUsageValue: sets value for usage limit |
void |
setUserHostNetName(java.lang.String userHostNetName)
setUserHostNetName: sets user / host / network name according to context |
void |
setWarningsBitmap(int warningsBitmap)
setWarningsBitmap: sets warning bitmap |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int EZLIC_MODEL_USER
public static final int EZLIC_MODEL_SERVER
public static final int EZLIC_TYPE_U_USER
public static final int EZLIC_TYPE_U_NODE
public static final int EZLIC_TYPE_U_FLOAT
public static final int EZLIC_TYPE_SVR_CONC
public static final int EZLIC_TYPE_SVR_CPU
public static final int EZLIC_TYPE_SVR_MHZ
public static final int EZLIC_TYPE_SVR_NMU
public static final int EZLIC_MODE_TIME
public static final int EZLIC_MODE_METERED
public static final int EZLIC_MODE_OPTIONS
public static final int EZLIC_MODE_CUSTOM_KEY
public static final int EZLIC_MODE_CUSTOM_COOKIE
Constructor Detail |
public EzLicenseInfo()
Method Detail |
public java.lang.String getLicenseKey()
public int getLicenseModelCode()
public int getLicenseTypeCode()
public int getLicenseModeBitmap()
public java.lang.String getCustomKey()
public java.lang.String getCustomCookie()
public java.lang.String getUserHostNetName()
public java.util.Date getExpirationDate()
public java.lang.String getOptions()
public boolean getEnforce()
public long getQuotaValue()
public long getUsageValue()
public int getWarningsBitmap()
public void setLicenseKey(java.lang.String licenseKey)
licenseKey:
- the license keypublic void setLicenseModelCode(int licenseModelCode)
licenseModelCode:
- license model code for the license keypublic void setLicenseTypeCode(int licenseTypeCode)
licenseTypeCode:
- license type code for the license keypublic void setLicenseModeBitmap(int licenseModeBitmap)
licenseModeBitmap:
- license mode bitmap for the license keypublic void setCustomKey(java.lang.String customKey)
customKey:
- custom key for the license keypublic void setCustomCookie(java.lang.String customCookie)
customCookie:
- custom cookie for the license keypublic void setUserHostNetName(java.lang.String userHostNetName)
userHostNetName:
- user / host / network namepublic void setExpirationDate(java.util.Date expirationDate)
expirationDate:
- license key expiration datepublic void setOptions(java.lang.String options)
options:
- String representing optionspublic void setEnforce(boolean enforce)
enforce:
- user / host enforcement policypublic void setQuotaValue(long quotaValue)
quotaValue:
- value for usage quotapublic void setUsageValue(long usageValue)
usageValue:
- usage limit value.public void setWarningsBitmap(int warningsBitmap)
warningsBitmap:
- warning bitmappublic static java.lang.String createKeyCookieSeed(java.lang.String userHost)
userHost:
- the user or host name corresponding to the keypublic int checkSingleUserLicenseKeyBasic(java.lang.String licenseKey, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostName) throws EzLicExceptionBase
licenseKey:
- license key.daysLeftThreshold:
- threshold for # of days
remaining in a time-limited license in order
to trigger an "about-to-expire" warning.quotaUsageToDate:
- amount of used quota to date
expressed in license units, if this is
expected to be a metered license.quotaThreshold:
- threshold for # of license
units remaining in a metered license in order
to trigger an "about-to-expire" warning.userHostName:
- user or host name, for a
user / node locked license.EzLicExceptionBase
- in the event of a malformed key or invalid
license.EzLicExceptionBase
public int checkMultiUserLicenseKeyBasic(java.lang.String licenseKey, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String hostNetName, long currUsageValue) throws EzLicExceptionBase
licenseKey:
- license key.daysLeftThreshold:
- threshold for # of days
remaining in a time-limited license in order
to trigger an "about-to-expire" warning.quotaUsageToDate:
- amount of remaining quota
expressed in license units, if this is
expected to be a metered license.quotaThreshold:
- threshold for # of license
units remaining in a metered license in order
to trigger an "about-to-expire" warning.hostNetName:
- (floating) network or (server) host name
for floating / server license.currUsageValue:
- current usage value for
floating / concurrent-user / cpu / mhz
usage models.EzLicExceptionBase
- in the event of a malformed key or invalid
license.EzLicExceptionBase
public int checkLicenseKey(java.lang.String licenseKey, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue) throws EzLicExceptionBase
licenseKey:
- license key.customKeyHandler:
- optional custom license
key handler for processing custom key in
an ISV specific manner. Null if not
specified.customKeyContext:
- optional run time context
for custom license key handler above.daysLeftThreshold:
- threshold for # of days
remaining in a time-limited license in order
to trigger an "about-to-expire" warning.quotaUsageToDate:
- amount of remaining quota
expressed in license units, if this is
expected to be a metered license.quotaThreshold:
- threshold for # of license
units remaining in a metered license in order
to trigger an "about-to-expire" warning.daysGracePeriod:
- grace period for time limited license
- if today is past expiration date by
less than this many days, set a warning instead of
throwing an exception.quotaGrace:
- grace quota - if quota is exceeded by
less than this amount, set a warning instead of
throwing an exception.userHostNet:
- user or host or network name, for a
user / node locked / floating license.currUsageValue:
- current usage value for
floating / concurrent-user / cpu / mhz
usage models.EzLicExceptionBase
- in the event of a malformed key or invalid
license.EzLicExceptionBase
public java.lang.String checkLicenseKeySecure(java.lang.String licenseKey, java.lang.String keyCookie, EzLicExceptionBase customException, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue) throws EzLicExceptionBase
licenseKey:
- license key.keyCookie:
- the key cookie that was returned
from the previous call to this method for
this key, or from the createKeyCookieSeed()
method if none.customException:
- a "success" exception class custom-defined
by the application to be a subclass of
EzLicExceptionBase. If the caller catches this
exception, it signifies success, in which case
the handler's "getMessage()" method returns the
new cookie, and its "getMessageCode()" method
returns the warning bitmap. If a null handler
is specified, control returns normally from this
call with the new cookie as the return value.
The reason for specifying a custom exception handler
is to help foil attempts at hacking the application
code by manipulating binary code that corresponds to
the check for the return value of the license key check
call.customKeyHandler:
- optional custom license
key handler for processing custom key in
an ISV specific manner. Null if not
specified.customKeyContext:
- optional run time context
for custom license key handler above.daysLeftThreshold:
- threshold for # of days
remaining in a time-limited license in order
to trigger an "about-to-expire" warning.quotaUsageToDate:
- amount of remaining quota
expressed in license units, if this is
expected to be a metered license.quotaThreshold:
- threshold for # of license
units remaining in a metered license in order
to trigger an "about-to-expire" warning.daysGracePeriod:
- grace period for time limited license
- if today is past expiration date by
less than this many days, set a warning instead of
throwing an exception.quotaGrace:
- grace quota - if quota is exceeded by
less than this amount, set a warning instead of
throwing an exception.userHostNet:
- user or host or network name, for a
user / node locked / floating license.currUsageValue:
- current usage value for
floating / concurrent-user / cpu / mhz
usage models.EzLicExceptionBase
- in the event of a malformed key or invalid
license, and also in the event of a successful
license key when a non-null custom exception class is
provided.EzLicExceptionBase
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |