com.atomikos.license
Class License

java.lang.Object
  extended by com.atomikos.license.License
Direct Known Subclasses:
DeveloperLicense, ThirtyMinutesLicense

public abstract class License
extends Object

A utility class for checking if the local machine is allowed to run the software according to the specified license file. The license file is checked for integrity by checking the signature. A license is assigned based on the IP address or domain of the host.


Field Summary
static String DEVELOPER_TYPE_PROPERTY_VALUE
          Value of license type property that indicates development use only.
static String DOMAIN_PROPERTY_NAME
          The name of the license file property indicating what domain the license is for.
static String DOMAIN_TYPE_PROPERTY_VALUE
          The value of the license type property indicating a domain-based license.
static String EVAL_TYPE_PROPERTY_VALUE
          The value of the license type property indicating an evaluation license.
static String EXPIRES_PROPERTY_NAME
          The name of the property whose value indicates the expiration date of the license.
static String HOST_TYPE_PROPERTY_VALUE
          The value of the license type property indicating a host-based license.
static String HOSTS_PROPERTY_NAME
          The name of the license property that indicates the different hosts a license is for.
static String LICENSE_FILE_BASE_NAME
          The base name of the license files.
static String LICENSE_PROPERTY_FILE_NAME
          The name of the property license file.
static String LICENSE_SIGNATURE_FILE_NAME
          The name of the signature license file.
static String LICENSE_TYPE_PROPERTY_NAME
          The name of the license property that indicates the type of license.
static String OWNER_PROPERTY_NAME
          The name of the property indicating the license owner.
static String PRODUCT_NAME_PROPERTY_NAME
          The name of the property that holds the product name.
static String UNLIMITED_TYPE_PROPERTY_VALUE
          The value of the license type property indicating an unlimited hosts license.
 
Constructor Summary
protected License(Properties properties)
           
 
Method Summary
 void checkLocalHost(String productName)
          Checks if the local host is allowed to run a product of the specified version.
static License createInformationalLicense()
          Create a purely information license instance based on the URL.
static License createLicense(String key)
          Create a license instance.
 void filterProductFeatures(Properties productFeatures)
          Filter out any license-bound product features.
protected  String getProperty(String name)
           
 void printInfo(PrintWriter out)
          Print information about the license to the supplied output.
protected  void sendForm(String productName, String ownerName)
           
static void setDigestName(String name)
          Set the digest algorithm name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LICENSE_FILE_BASE_NAME

public static final String LICENSE_FILE_BASE_NAME
The base name of the license files.

See Also:
Constant Field Values

LICENSE_PROPERTY_FILE_NAME

public static final String LICENSE_PROPERTY_FILE_NAME
The name of the property license file.

See Also:
Constant Field Values

LICENSE_SIGNATURE_FILE_NAME

public static final String LICENSE_SIGNATURE_FILE_NAME
The name of the signature license file.

See Also:
Constant Field Values

PRODUCT_NAME_PROPERTY_NAME

public static final String PRODUCT_NAME_PROPERTY_NAME
The name of the property that holds the product name. The value should NOT include the version number.

See Also:
Constant Field Values

LICENSE_TYPE_PROPERTY_NAME

public static final String LICENSE_TYPE_PROPERTY_NAME
The name of the license property that indicates the type of license. Must be present!

See Also:
Constant Field Values

HOSTS_PROPERTY_NAME

public static final String HOSTS_PROPERTY_NAME
The name of the license property that indicates the different hosts a license is for.

See Also:
Constant Field Values

DOMAIN_PROPERTY_NAME

public static final String DOMAIN_PROPERTY_NAME
The name of the license file property indicating what domain the license is for.

See Also:
Constant Field Values

EXPIRES_PROPERTY_NAME

public static final String EXPIRES_PROPERTY_NAME
The name of the property whose value indicates the expiration date of the license.

See Also:
Constant Field Values

EVAL_TYPE_PROPERTY_VALUE

public static final String EVAL_TYPE_PROPERTY_VALUE
The value of the license type property indicating an evaluation license. If this is the value of the LICENSE_TYPE_PROPERTY_NAME then the property EXPIRES_PROPERTY_NAME must also be set to a long value that denotes the expiry date.

See Also:
Constant Field Values

HOST_TYPE_PROPERTY_VALUE

public static final String HOST_TYPE_PROPERTY_VALUE
The value of the license type property indicating a host-based license. If this is the value of LICENSE_TYPE_PROPERTY_NAME, then the property HOSTS_PROPERTY_NAME must also be set to an enumeration of allowed host IP addresses.

See Also:
Constant Field Values

DOMAIN_TYPE_PROPERTY_VALUE

public static final String DOMAIN_TYPE_PROPERTY_VALUE
The value of the license type property indicating a domain-based license. If this is the value of LICENSE_TYPE_PROPERTY_ NAME, then the property DOMAIN_PROPERTY_NAME must also be set to the appropriate IP domain name.

See Also:
Constant Field Values

UNLIMITED_TYPE_PROPERTY_VALUE

public static final String UNLIMITED_TYPE_PROPERTY_VALUE
The value of the license type property indicating an unlimited hosts license. If this is the value of LICENSE_TYPE_PROPERTY_ NAME, then no additional property is needed to indicate which hosts.

See Also:
Constant Field Values

DEVELOPER_TYPE_PROPERTY_VALUE

public static final String DEVELOPER_TYPE_PROPERTY_VALUE
Value of license type property that indicates development use only. In this case, no additional host properties are needed.

See Also:
Constant Field Values

OWNER_PROPERTY_NAME

public static final String OWNER_PROPERTY_NAME
The name of the property indicating the license owner.

See Also:
Constant Field Values
Constructor Detail

License

protected License(Properties properties)
Method Detail

setDigestName

public static void setDigestName(String name)
Set the digest algorithm name.

Parameters:
name - The name of the alg to use.

createLicense

public static License createLicense(String key)
                             throws CorruptLicenseException,
                                    IOException
Create a license instance.

Parameters:
key - The key data to be used for checking the license signature.
Returns:
License The license instance.
Throws:
CorruptLicenseException - If the license file appears to be corrupt.
IOException - If the file(s) could not be read.

createInformationalLicense

public static License createInformationalLicense()
                                          throws IOException
Create a purely information license instance based on the URL. An informational license is one without integrity guarantees. Instances are useful mostly for showing information to the user.

Returns:
Throws:
IOException

getProperty

protected String getProperty(String name)

checkLocalHost

public void checkLocalHost(String productName)
                    throws UnknownHostException,
                           CorruptLicenseException,
                           InvalidMachineLicenseException,
                           ExpiredLicenseException,
                           WrongProductLicenseException
Checks if the local host is allowed to run a product of the specified version.

Parameters:
productName - The name of the product.
Throws:
CorruptLicenseException - If tampering is detected.
InvalidMachineLicenseException - If the IP is wrong.
ExpiredLicenseException - If the license has expired.
UnknownHostException - If the IP could not be determined.
WrongProductLicenseException - If the wrong product for this license.

printInfo

public void printInfo(PrintWriter out)
Print information about the license to the supplied output.

Parameters:
out - The output.

filterProductFeatures

public void filterProductFeatures(Properties productFeatures)
Filter out any license-bound product features.

Parameters:
productFeatures - The product features in the form of Properties. Any license-bound properties will be set during this method.

sendForm

protected void sendForm(String productName,
                        String ownerName)


Copyright © 2012. All Rights Reserved.