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
  • Constructor Details

  • Method Details

    • init

      public void init​(ILicenseContext context)
      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 null if not set
    • getExpiration

      public long getExpiration()
      Returns the expiration date.
      Returns:
      the date or 0 if not set
    • setExpirationDate

      public void setExpirationDate​(java.util.Date d)
      Sets the new expiration date
      Parameters:
      d - the new date or null if 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

      public void verify​(ILicenseContext context)
      Verify the license using the given context
      Parameters:
      context - the context containing verification parameters
    • serialize

      public static byte[] serialize​(SimpleLicense license) throws java.io.UnsupportedEncodingException
      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