|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmain.LicenseChecker
public class LicenseChecker
Class that is able to read, check, and create license key files.
LicenseKey
,
Serialized FormField Summary | |
---|---|
private boolean |
licenseAccepted
Stores whether the license was accepted by the user. |
private java.lang.String |
licenseFileName
The license file name. |
private static boolean |
printLog
Flag to enable debug message printing for this class. |
(package private) static long |
serialVersionUID
The version tracking unique identifier for Serialization. |
Constructor Summary | |
---|---|
LicenseChecker()
Instantiates a new license checker. |
Method Summary | |
---|---|
private static long |
byte2Long(byte[] addr)
Converts Byte data to an address in long format. |
boolean |
checkHostid(LicenseKey key)
Checks whether the MAC address of this machine matches the MAC adress in the license file. |
boolean |
checkUsername(LicenseKey key)
Checks, whether the current username matches one of the usernames stored in the license key. |
boolean |
createKeyFile(LicenseKey key)
Creates a new license key file after the user confirmed that he agrees to the license. |
private void |
log(java.lang.String message)
Prints debug information to stdout when printLog is set to true. |
static java.lang.String |
macAdressToString(byte[] macAddress)
Converts a Mac adress to a string. |
LicenseKey |
readKeyFile()
Reads information from a license key file. |
void |
setLicenseAccepted(boolean licenseAccepted)
Specifies whether the license was accepted. |
private static long |
unsignedByteToLong(byte b)
Unsigned byte to long. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
private static final boolean printLog
private boolean licenseAccepted
private java.lang.String licenseFileName
Constructor Detail |
---|
public LicenseChecker()
Method Detail |
---|
public boolean createKeyFile(LicenseKey key)
key
- the license key key
public LicenseKey readKeyFile() throws java.io.InvalidClassException, java.io.IOException
java.io.InvalidClassException
- the invalid class exception
java.io.IOException
- Signals that an I/O exception has occurred.public boolean checkHostid(LicenseKey key)
key
- the license key
public boolean checkUsername(LicenseKey key)
This ensures that every user on this machine has to accept the license agreement.
key
- the license key
public static java.lang.String macAdressToString(byte[] macAddress)
macAddress
- the mac address
private static long byte2Long(byte[] addr)
addr
- the byte array
private static long unsignedByteToLong(byte b)
b
- the byte
public void setLicenseAccepted(boolean licenseAccepted)
licenseAccepted
- Specifies whether the license was accepted.private void log(java.lang.String message)
message
- the message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |