eu.beesoft.abeona
Class LicenseGenerator

java.lang.Object
  extended by eu.beesoft.abeona.LicenseGenerator

public final class LicenseGenerator
extends java.lang.Object

The LicenseGenerator is used to generate license properties protected by Abeona signature system.

Generated properties are common Java properties. There are three new properties appended to result of LicenseGenerator:

Yout don't need to do anything with these properies directly. The first should ensure identification of person or company who generated license only. The second has the same meaning. The third is used by License class to verify that generated license is unchanged and valid.

This class can be used in a very simple way. All you need to do is to create new or obtain existing Product, prepare your own java.util.Properties and then use one of generate(Properties, Product) methods to sign your properties. These signed properties you can save to file via method storeLicense(Properties,Product,String).

Warning: This class is protected by Abeona signature system itself. Unauthorized usage returns always the same key-pair which is used for presentation purpose.


Method Summary
 java.util.Properties generate(java.io.InputStream input, Product product)
          For properties from given input generates signed properties.
 java.util.Properties generate(java.util.List<java.lang.String> lines, Product product)
          For properties from given input List of Strings generates signed properties.
 java.util.Properties generate(java.util.Properties properties, Product product)
          Generates resultant properties as license properties.
 java.util.Properties generate(java.lang.String[] lines, Product product)
          For properties from given input array of Strings generates signed properties.
 java.util.Properties generate(java.lang.String text, Product product)
          For properties from given input String generates signed properties.
 void storeLicense(java.util.Properties properties, Product product, java.lang.String fileName)
          Stores signed properties to file with given file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generate

public java.util.Properties generate(java.util.Properties properties,
                                     Product product)
                              throws LicenseException
Generates resultant properties as license properties. Given input properties are enlarged by two new properties: as described in comment to this class.

Attempt to change any one of the signed properties results in signature violation.

Parameters:
properties - Properties to store to properties file
product - Product for which is generated license (and used to encode digital signature)
Returns:
signed properties as storeable license
Throws:
LicenseException - when any error occurs while computing signature

generate

public java.util.Properties generate(java.io.InputStream input,
                                     Product product)
                              throws LicenseException
For properties from given input generates signed properties. See generate(Properties, Product) for details.

Parameters:
input - InputStream to read Properties - most often from a file
product - Product for which is generated license (and used to encode digital signature)
Returns:
signed properties as storeable license
Throws:
LicenseException - when any error occurs

generate

public java.util.Properties generate(java.lang.String text,
                                     Product product)
                              throws LicenseException
For properties from given input String generates signed properties. See generate(Properties, Product) for details.

Parameters:
text - Text of license file, consists of lines separated by a new line character. Individual lines must satisfy line format of property file.
product - Product for which is generated license (and used to encode digital signature)
Returns:
signed properties as storeable license
Throws:
LicenseException - when any error occurs

generate

public java.util.Properties generate(java.util.List<java.lang.String> lines,
                                     Product product)
                              throws LicenseException
For properties from given input List of Strings generates signed properties. See generate(Properties, Product) for details.

Parameters:
lines - List of lines to store to properties file. List can contain null or empty lines, comment lines started with '#' character and property lines in format key=value
product - Product for which is generated license (and used to encode digital signature)
Returns:
signed properties as storeable license
Throws:
LicenseException - when any error occurs

generate

public java.util.Properties generate(java.lang.String[] lines,
                                     Product product)
                              throws LicenseException
For properties from given input array of Strings generates signed properties. See generate(Properties, Product) for details.

Parameters:
lines - Array of lines to store to properties file. Array can contain null or empty lines, comment lines started with '#' character and property lines in format key=value
product - Product for which is generated license (and used to encode digital signature)
Returns:
signed properties as storeable license
Throws:
LicenseException - when any error occurs

storeLicense

public void storeLicense(java.util.Properties properties,
                         Product product,
                         java.lang.String fileName)
                  throws java.io.IOException
Stores signed properties to file with given file name.

Parameters:
properties - properties (license) to store
product - instance of Product which was used to generate license signature
fileName - name of file to store license
Throws:
java.io.IOException - if any error occurs