|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.beesoft.abeona.License
public final class License
This is class for obtaining license properties. Each property is [name :
value] pair (as String instances), backed by java.util.Properties class. One
of the properties should be 'Abeona.Signature' property generated by
LicenseGenerator
. This property is used to check
license validity in method isValid()
.
There are three load() methods to fill license properties:
LicenseServer
)
If there is any problem with license properties loading,
LicenseException
is thrown. This exception is also
thrown when getProperty(String)
method is invoked and properties are
not valid.
Field Summary | |
---|---|
static java.lang.String |
OWNER
Constant for 'Abeona.Owner' name. |
static java.lang.String |
SERIAL_NUMBER
Constant for 'Abeona.Serial.Number' name. |
static java.lang.String |
SIGNATURE
Constant for 'Abeona.Signature' name. |
Constructor Summary | |
---|---|
License()
Default constructor - creates new instance of License. |
Method Summary | |
---|---|
static java.lang.String |
getMacAddress()
Returns MAC address of computer (more precise - its network card). |
java.lang.String |
getProperty(java.lang.String name)
Returns from license file value for given property name. |
java.lang.String |
getProperty(java.lang.String name,
java.lang.String defaultValue)
Returns from license file value for given property name. |
java.util.List<java.lang.String> |
getPropertyNames()
Returns from license file all property names. |
static java.lang.String |
getUserName()
Returns user name from system properties. |
boolean |
isValid()
Checks license validity and returns result. |
void |
load(java.io.InputStream inputStream,
java.lang.String publicKey)
Loads license properties from given input stream and checks their digital signature. |
void |
load(java.util.Properties properties,
java.lang.String publicKey)
Loads license properties from given properties and checks their digital signature. |
void |
load(java.lang.String host,
java.lang.String port,
java.lang.String applicationName,
java.lang.String publicKey)
Loads license properties from license server and - if required - checks their digital signature. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SIGNATURE
public static final java.lang.String SERIAL_NUMBER
public static final java.lang.String OWNER
Constructor Detail |
---|
public License()
Method Detail |
---|
public void load(java.io.InputStream inputStream, java.lang.String publicKey) throws LicenseException
inputStream
- stream to load properties frompublicKey
- public key String to signature check
LicenseException
- when some of arguments is null, I/O error occurred or
signature is invalidpublic void load(java.util.Properties properties, java.lang.String publicKey) throws LicenseException
properties
- properties to load license frompublicKey
- public key String to signature check
LicenseException
- when some of arguments is null, I/O error occurred or
signature is invalidpublic void load(java.lang.String host, java.lang.String port, java.lang.String applicationName, java.lang.String publicKey) throws LicenseException
host
- server name or its IP address (like 127.0.0.1)port
- server port to connect (like 6565)applicationName
- name of application for which is license requestedpublicKey
- public key String to signature check. If null, there is no
check executed and method getProperty(String)
never
throws LicenseException
.
LicenseException
- when some of arguments is null, I/O error occurred or
signature is invalidpublic boolean isValid()
load(InputStream,String)
or load(String,String,String,String)
)
public java.lang.String getProperty(java.lang.String name) throws LicenseException
name
- Property name
LicenseException
- if license is not validpublic java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue) throws LicenseException
name
- Property namedefaultValue
- This value is returned if property with given name does not
exist
LicenseException
- if license is not validpublic java.util.List<java.lang.String> getPropertyNames() throws LicenseException
LicenseException
- if license is not validpublic static java.lang.String getUserName()
public static java.lang.String getMacAddress()
java.lang.RuntimeException
- if cannot obtain MAC address
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |