com.chainkey.jchain.sa.licensee
Class Licensee
java.lang.Object
|
+--com.chainkey.jchain.sa.licensee.Licensee
- public final class Licensee
- extends java.lang.Object
The class for managing software license on the end-user's side.
Use this class for:
- checking end-users' license status,
- displaying the wizard for end-users,
- taking in a license key,
- etc...
Check out the Tutorial for a sample code.
[Note]
The package and name of this class has changed since v1.6 (from "com.chainkey.jchain.CkLicensee").
- Since:
- JChain SA v1.0
- Version:
- 1.6.5
- Author:
- ChainKey, Inc.
|
Constructor Summary |
Licensee()
Sole constructor. |
|
Method Summary |
java.lang.String[] |
getCustomParameters()
Gets the custom license parameters set by the licensor,
when the key is generated. |
int |
getDaysToExpiration(int FID)
Calculates the remaining days for a module (or feature) designated by its FID (feature ID). |
static Licensee |
getInstance()
Gets an instance of the Licensee class. |
int |
getLicenseStatus(int FID)
Gets the license status, of the current end-user's computer,
for the module of the designated FID (feature ID),
by checking the key, the computer, and the protected software product. |
int |
getLicenseStatus()
Gets the license status of the current end-user's computer, by checking the key, the computer, and the protected software product. |
int |
getRemainingDays()
Deprecated. |
int |
getTotalModules()
Gets the number of modules in this application, for modular licensing. |
java.lang.String |
getVersion()
Gets the version of this Licensee object. |
boolean |
keyExists()
Checks whether this computer has a key file for this application. |
javax.swing.JDialog |
prompt()
Starts a graphical wizard for the end-user to manage the software license. |
void |
setInterval(double interval)
Sets the time-interval of updating the license key by deamon. |
void |
showExpirationReminder()
Starts a dialog to remind the expiration date,
if the dialog has not been shown for the last 24 hours,
and guides end-users for requesting a new key. |
void |
startKeyUpdateDaemon()
Manually starts the license key updater. |
void |
stopKeyUpdateDaemon()
Manually stops the license key updater. |
int |
takeInKey()
Takes in a key file and process it. |
int |
takeInKey(java.lang.String selected)
Takes in a designated key file and process it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Licensee
public Licensee()
- Sole constructor.
getVersion
public java.lang.String getVersion()
- Gets the version of JChain library used for this Licensee object.
- Returns:
- the version
setInterval
public void setInterval(double interval)
- Sets the time-interval of updating the license key by the key update deamon.
- Parameters:
interval - the interval in hour (e.g. 0.1 means 6 minutes)
getDaysToExpiration
public int getDaysToExpiration(int FID)
- Calculates the remaining days for a module (or feature) designated by its FID (feature ID). For modular licensing.
- Returns:
- the remaining days or the days to expiration:
- -1: if permanent
- 0: if expired already
- 1: if today is the last day
- 2: if tommorow is the last day
- ...
- N: if the Nth day is the last day
getInstance
public static Licensee getInstance()
- Gets an instance of the Licensee class.
- Returns:
- the instance.
keyExists
public boolean keyExists()
- Checks whether this computer has a key file for this application.
This method does not authorize the key.
- Returns:
- true if and only if the key file exists
getRemainingDays
public int getRemainingDays()
- Deprecated.
- Gets the remaining days for the module of primary FID. Generalized and replaced by getDaysToExpiration(int).
- See Also:
getDaysToExpiration( int FID )
getTotalModules
public int getTotalModules()
- Gets the number of modules in this application, for modular licensing.
showExpirationReminder
public void showExpirationReminder()
- Starts a dialog to remind the expiration date,
if the dialog has not been shown for the last 24 hours,
and guides the end-user for requesting a new key.
getCustomParameters
public java.lang.String[] getCustomParameters()
- Gets the custom license parameters set by the licensor,
when the key is generated. For additional (your own) license control that is not covered by JChain.
- Returns:
- the license parameters as an array of String;
null if no key can be found
takeInKey
public int takeInKey()
- Takes in a key file and activates the application.
A file chooser dialog will be shown for the end-user to choose
a key file.
- Returns:
- 0: successfully taken in; 1: failed to take in
takeInKey
public int takeInKey(java.lang.String selected)
- Takes in a designated key file and activates the application.
- Parameters:
selected - the absolute path of the key file- Returns:
- 0: successfully taken in; 1: failed to take in
startKeyUpdateDaemon
public void startKeyUpdateDaemon()
- Manually starts the key updater (i.e. a thread to update end-user's key at a certain interval). If JChain authorizes an end-user's computer, JChain automatically starts the thread, and you don't have to call this method explicitly. (By calling the getLicenseStatus method, JChain authorizes the computer, if it has a valid key.) This method is provided for re-starting the thread after you call stopKeyUpdateDaemon().
- See Also:
setInterval( double interval ),
stopKeyUpdateDaemon()
stopKeyUpdateDaemon
public void stopKeyUpdateDaemon()
- Manually stops the key updater (i.e. a thread to update end-user's key at a certain interval). If JChain authorizes an end-user's computer, JChain automatically starts the thread. (By calling the getLicenseStatus method, JChain authorizes the computer, if it has a valid key.) This method is provided for stopping the thread.
- See Also:
startKeyUpdateDaemon(),
setInterval( double interval )
getLicenseStatus
public int getLicenseStatus(int FID)
- Gets the license status, of the current end-user's computer,
for the module of the designated FID (feature ID),
by checking the key, the computer, and the protected software product.
- Parameters:
FID - the FID- Returns:
- -1: error
- 0: unauthorized
- 1: authorized (permanent license)
- 2: authorized (trial license)
- 3: authorized (lease license)
- See Also:
getDaysToExpiration( int FID ), getLicenseStatus()
getLicenseStatus
public int getLicenseStatus()
- Gets the license status of the current end-user's computer, by checking the key, the computer, and the protected software product. Call this method to authorize the computer for using your software product.
When using modular licensing, this method gets the status for the primary module (or feature).
- Returns:
- 0: unauthorized
- 1: authorized (permanent license)
- 2: authorized (trial license)
- 3: authorized (lease license)
- -1: error
- See Also:
getLicenseStatus( int FID )
prompt
public javax.swing.JDialog prompt()
- Starts a graphical wizard for the end-user to manage the software license. See the tutorial for the details and appearance of this wizard.
Once you use a JDialog, you must explicitly call System.exit, in order to quit the program.
- Returns:
- the wizard as a JDialog object. Null, if the wizard can not be displayed.
- See Also:
startKeyUpdateDaemon(),
stopKeyUpdateDaemon()