SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.license
Class License

java.lang.Object
  extended by com.numericalmethod.suanshu.license.License

public final class License
extends java.lang.Object

This is the license management system. To use this library in the client program, you need a valid license. Before any API calls to this library, the client program needs to specify the license by either:

By default, the license file is assumed to be located under the same directory as the suanshu library jar file, runtime working directory, or classpath. If the license file is moved to elsewhere, the client program can specify the new location by calling setLicenseFile(java.io.File).

Another way to set the license programmatically is to call setLicenseKey(java.lang.String) with the key string. Once you got a valid license, you can copy the license key in the license file. Using setLicenseKey(java.lang.String), the file I/O for loading license file can be avoided.

See Also:
License Agreement

Field Summary
static java.lang.String[] DEFAULT_LICENSE_FILES
          Default license files
static java.lang.String LICENSE_FILE_PROPERTY
          The system property name for setting license file.
 
Method Summary
static java.lang.String getLicenseKey()
          Get the license key string of the current license.
static void setLicenseFile(java.io.File licenseFile)
          Override the default license file.
static void setLicenseKey(java.lang.String key)
          Set the license key for this invocation.
static java.lang.String version()
          Get the version number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LICENSE_FILE_PROPERTY

public static final java.lang.String LICENSE_FILE_PROPERTY
The system property name for setting license file. Besides setLicenseFile(java.io.File), license file can be specified by system property using -D option in 'java' command.

See Also:
Constant Field Values

DEFAULT_LICENSE_FILES

public static final java.lang.String[] DEFAULT_LICENSE_FILES
Default license files

Method Detail

setLicenseFile

public static void setLicenseFile(java.io.File licenseFile)
                           throws java.io.IOException
Override the default license file. This has to be called before the default license is loaded.

A license file can only be set once. All subsequent calls will lead to RuntimeException.

Parameters:
licenseFile - the license file
Throws:
java.io.IOException - if error has occurred when loading the license file

setLicenseKey

public static void setLicenseKey(java.lang.String key)
Set the license key for this invocation.

A license key can only be set once. All subsequent calls will lead to RuntimeException.

Parameters:
key - the license key

version

public static java.lang.String version()
Get the version number. The version number is in the format:
 <major version>.<minor version>.<bugfix version>
 

Returns:
the version number

getLicenseKey

public static java.lang.String getLicenseKey()
Get the license key string of the current license. The returned string can be passed into setLicenseKey(java.lang.String) for setting up license programmatically without file I/O.

Returns:
the license key string

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.