
org.sapia.util.license.License Maven / Gradle / Ivy
package org.sapia.util.license;
import java.io.IOException;
import java.io.Serializable;
/**
* This interface specifies the basic behavior of all licenses.
*
* @author Yanick Duchesne
*
*
* - Copyright:
- Copyright © 2002-2004 Sapia Open Source Software. All Rights Reserved.
* - License:
- Read the license.txt file of the jar or visit the
* license page at the Sapia OSS web site
*
*/
public interface License extends Serializable{
/**
* Returns if this license is valid or not. This method takes an
* arbitratry context object that can be passed in by client applications.
* This has been thought in cases where license validity may depend on
* external parameters (max connected users, etc.).
*
* This requires client apps to know about the concrete type of licenses
* they deal with.
*
* @return true
if this license is valid.
* @param an arbitraty context Object
.
*/
public boolean isValid(Object context);
/**
* This method is called by application code on the client-side
* to activate this license. This method should only be called once in
* a given license's lifecycle.
*
* An object holding arbitrary contextual data can be passed in. This
* requires client apps to know abou the concrete type of licenses
* that deal with.
*
* @param an arbitraty context Object
.
*/
public void activate(Object context);
/**
* @return the byte representation of this license; these bytes will
* be signed, so the representation must be constant.
*
* @throws IOException if a problem occurs generating the bytes for
* this instance.
*/
public byte[] getBytes() throws IOException;
}