main
Class LicenseKey

java.lang.Object
  extended by main.LicenseKey
All Implemented Interfaces:
java.io.Serializable

public class LicenseKey
extends java.lang.Object
implements java.io.Serializable

A serializable license key that stores valid MAC address and users.

This is used to ensure that every user how runs xdat for the first time must accept the license agreement. (Click-wrap license)

See Also:
LicenseChecker, Serialized Form

Field Summary
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.
(package private)  java.util.Vector<java.lang.String> validAddresses
          The valid addresses.
(package private)  java.util.Vector<java.lang.String> validUserNames
          The valid user names.
 
Constructor Summary
LicenseKey()
          Instantiates a new license key.
LicenseKey(java.util.Vector<java.lang.String> validAddresses, java.util.Vector<java.lang.String> validUserNames)
          Instantiates a license key that already contains addresses and usernames.
 
Method Summary
private static long byte2Long(byte[] addr)
          Converts a byte array to a long value.
 java.util.Vector<java.lang.String> getValidAddresses()
          Gets the valid addresses of this key.
 java.util.Vector<java.lang.String> getValidUserNames()
          Gets the valid user names of this key.
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 address to a string.
private static long unsignedByteToLong(byte b)
          Converts an unsigned byte to a long value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
The version tracking unique identifier for Serialization.

See Also:
Constant Field Values

printLog

private static final boolean printLog
Flag to enable debug message printing for this class.

See Also:
Constant Field Values

validAddresses

java.util.Vector<java.lang.String> validAddresses
The valid addresses.


validUserNames

java.util.Vector<java.lang.String> validUserNames
The valid user names.

Constructor Detail

LicenseKey

public LicenseKey()
Instantiates a new license key.


LicenseKey

public LicenseKey(java.util.Vector<java.lang.String> validAddresses,
                  java.util.Vector<java.lang.String> validUserNames)
Instantiates a license key that already contains addresses and usernames.

Parameters:
validAddresses - the valid addresses
validUserNames - the valid user names
Method Detail

macAdressToString

public static java.lang.String macAdressToString(byte[] macAddress)
Converts a Mac address to a string.

Parameters:
macAddress - the mac address
Returns:
the string

byte2Long

private static long byte2Long(byte[] addr)
Converts a byte array to a long value.

Parameters:
addr - the byte array
Returns:
the long

unsignedByteToLong

private static long unsignedByteToLong(byte b)
Converts an unsigned byte to a long value.

Parameters:
b - the byte
Returns:
the long value

getValidAddresses

public java.util.Vector<java.lang.String> getValidAddresses()
Gets the valid addresses of this key.

Returns:
the valid addresses

getValidUserNames

public java.util.Vector<java.lang.String> getValidUserNames()
Gets the valid user names of this key.

Returns:
the valid user names

log

private void log(java.lang.String message)
Prints debug information to stdout when printLog is set to true.

Parameters:
message - the message