Package rs.baselib.licensing
Class SimpleLicense
java.lang.Object
rs.baselib.licensing.AbstractLicense
rs.baselib.licensing.SimpleLicense
- All Implemented Interfaces:
java.io.Serializable,ILicense
public class SimpleLicense extends AbstractLicense
A limited, simple implementation of a license.
The license knows the product as an integer only and does
not care for any version.
- Author:
- ralph
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface rs.baselib.licensing.ILicense
EXPIRATION_DATE_KEY, MAXIMUM_VERSION_INCLUDED_KEY, MAXIMUM_VERSION_KEY, MINIMUM_VERSION_INCLUDED_KEY, MINIMUM_VERSION_KEY, OWNER_KEY, PRODUCT_KEY, VERSION_KEY -
Constructor Summary
Constructors Constructor Description SimpleLicense()Constructor. -
Method Summary
Modifier and Type Method Description longgetExpiration()Returns the expiration date.java.util.DategetExpirationDate()Returns the expiration date.java.lang.StringgetOwner()Returns the license owner.intgetProduct()Returns the product ID.voidinit(ILicenseContext context)Initialize the license using the given context.static byte[]serialize(SimpleLicense license)Serializes this license into bytes.voidsetExpirationDate(java.util.Date d)Sets the new expiration datevoidsetOwner(java.lang.String s)Sets the license owner.voidsetProduct(int i)Sets the product ID.voidverify(ILicenseContext context)Verify the license using the given contextMethods inherited from class rs.baselib.licensing.AbstractLicense
getProperty, getPropertyNames, hasProperty, initProperty, removeProperty, setProperty, verifyEqualGreaterThan, verifyEqualLessThan, verifyEquals, verifyGreaterThan, verifyLessThan
-
Constructor Details
-
SimpleLicense
public SimpleLicense()Constructor.
-
-
Method Details
-
init
Initialize the license using the given context.- Parameters:
context- context containing parameters.
-
getProduct
public int getProduct()Returns the product ID.- Returns:
- the product ID
-
setProduct
public void setProduct(int i)Sets the product ID.- Parameters:
i- the product ID
-
getExpirationDate
public java.util.Date getExpirationDate()Returns the expiration date.- Returns:
- the date or
nullif not set
-
getExpiration
public long getExpiration()Returns the expiration date.- Returns:
- the date or
0if not set
-
setExpirationDate
public void setExpirationDate(java.util.Date d)Sets the new expiration date- Parameters:
d- the new date ornullif no expiration
-
getOwner
public java.lang.String getOwner()Returns the license owner.- Returns:
- the license owner
-
setOwner
public void setOwner(java.lang.String s)Sets the license owner.- Parameters:
s- the license owner
-
verify
Verify the license using the given context- Parameters:
context- the context containing verification parameters
-
serialize
Serializes this license into bytes.- Parameters:
license- the license to be serialized- Returns:
- the bytes representing this license.
- Throws:
java.io.UnsupportedEncodingException- when the license cannot be encoded
-