Package rs.baselib.licensing
Class DefaultLicense
java.lang.Object
rs.baselib.licensing.AbstractLicense
rs.baselib.licensing.DefaultLicense
- All Implemented Interfaces:
java.io.Serializable,ILicense
public class DefaultLicense extends AbstractLicense
Default implementation of a license.
- 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 DefaultLicense()Constructor. -
Method Summary
Modifier and Type Method Description protected longgetDate(java.lang.Object o)Returns the time in millis for the given object.java.util.DategetExpirationDate()Returns the expiration date.java.lang.StringgetMaxVersion()Returns the maximum version this license is valid for.java.lang.StringgetMinVersion()Returns the minimum version this license is valid for.java.lang.StringgetOwner()Returns the license owner.java.lang.StringgetProduct()Returns the product name.voidinit(ILicenseContext context)Initialize the license using the given context.booleanisMaxVersionIncluded()Returns whether verification includes the maximum version.booleanisMinVersionIncluded()Returns whether verification includes the minimum version.voidsetExpirationDate(java.util.Date d)Sets the new expiration datevoidsetMaxVersion(java.lang.String s)Sets the maximum version this license is valid for.voidsetMaxVersionIncluded(boolean b)Sets whether verification includes the maximum version.voidsetMinVersion(java.lang.String s)Sets the minimum version this license is valid for.voidsetMinVersionIncluded(boolean b)Sets whether verification includes the minimum version.voidsetOwner(java.lang.String s)Sets the license owner.voidsetProduct(java.lang.String s)Sets the product name.java.lang.StringtoString()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
-
DefaultLicense
public DefaultLicense()Constructor.
-
-
Method Details
-
init
Initialize the license using the given context.- Parameters:
context- context containing parameters.
-
getProduct
public java.lang.String getProduct()Returns the product name.- Returns:
- the product name
-
setProduct
public void setProduct(java.lang.String s)Sets the product name.- Parameters:
s- the product name
-
getExpirationDate
public java.util.Date getExpirationDate()Returns the expiration date.- Returns:
- the date or
nullif 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
-
isMinVersionIncluded
public boolean isMinVersionIncluded()Returns whether verification includes the minimum version.- Returns:
truewhen minimum version is included
-
setMinVersionIncluded
public void setMinVersionIncluded(boolean b)Sets whether verification includes the minimum version.- Parameters:
b-truewhen minimum version is included
-
getMinVersion
public java.lang.String getMinVersion()Returns the minimum version this license is valid for.- Returns:
- the minimum version or
nullif no such version
-
setMinVersion
public void setMinVersion(java.lang.String s)Sets the minimum version this license is valid for.- Parameters:
s- the minimum version ornullif no such version
-
isMaxVersionIncluded
public boolean isMaxVersionIncluded()Returns whether verification includes the maximum version.- Returns:
truewhen maximum version is included
-
setMaxVersionIncluded
public void setMaxVersionIncluded(boolean b)Sets whether verification includes the maximum version.- Parameters:
b-truewhen maximum version is included
-
getMaxVersion
public java.lang.String getMaxVersion()Returns the maximum version this license is valid for.- Returns:
- the maximum version or
nullif no such version
-
setMaxVersion
public void setMaxVersion(java.lang.String s)Sets the maximum version this license is valid for.- Parameters:
s- the maximum version ornullif no such version
-
getDate
protected long getDate(java.lang.Object o)Returns the time in millis for the given object.- Parameters:
o- an object (a date or long value)- Returns:
- the time in milliseconds
-
verify
Verify the license using the given context- Parameters:
context- the context containing verification parameters
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-