TrueLicense Core 1.33

de.schlichtherle.license
Class LicenseContent

java.lang.Object
  extended by de.schlichtherle.license.LicenseContent
All Implemented Interfaces:
Serializable, Cloneable

public class LicenseContent
extends Object
implements Serializable, Cloneable

This non-visual JavaBean represents the content of an application license. This encompasses information about which license subjects may be licensed by which kind of license consumers and their quantity (per kind and a maximum total). In addition, an issue time stamp and optional information about the license holder is contained.

This class is not trusted by the license notary. As a result, the license manager validates and verifies the state of this object itself whenever necessary.

In general, all properties may be null which indicates that this information is not (yet) available and should be ignored. Note however that validation may fail if certain properties are not available.

Subclasses are encouraged to use the firePropertyChange methods to notify all listeners of all property events. Subclasses must also implement the JavaBean pattern in order to be usable.

Note that the property change listeners are not persistet when using ObjectOutputStream or XMLEncoder.

Author:
Christian Schlichtherle
See Also:
LicenseNotary, Serialized Form

Field Summary
private  int consumerAmount
           
private  String consumerType
           
private  Object extra
           
private  X500Principal holder
           
private  String info
           
private  Date issued
           
private  X500Principal issuer
           
private  Date notAfter
           
private  Date notBefore
           
private  PropertyChangeSupport propertySupport
          Utility field used by bound properties.
private static long serialVersionUID
           
private  String subject
           
 
Constructor Summary
LicenseContent()
           
 
Method Summary
private static Date clone(Date date)
           
private static boolean equals(Object a, Object b)
           
 int getConsumerAmount()
          Returns the amount of consumers which are allowed to license the subject with this license.
 String getConsumerType()
          Returns a description of the entity which allocates a license for using the licensing subject.
 Object getExtra()
          Returns the value of the property extra.
 X500Principal getHolder()
          Returns the legal entity (i.e. the user) to which the license is granted by the issuer.
 String getInfo()
          Returns the value of the property info.
 Date getIssued()
          Returns the time when the license represented by this license content has been issued.
 X500Principal getIssuer()
          Returns the legal entity which grants the license to the holder.
 Date getNotAfter()
          Returns the time when the license ends to be valid.
 Date getNotBefore()
          Returns the time when the license begins to be valid.
 String getSubject()
          Returns the abstract description of the entity which needs to be licensed in order for it to be used - it could be the name of a software application like e.g.
private static int hash(Object object)
           
 void setConsumerAmount(int consumerAmount)
          Sets the amount of consumers which are allowed to license the subject with this license.
 void setConsumerType(String consumerType)
          Sets the type of entity which needs to license the license subject in order to use it.
 void setExtra(Object extra)
          Sets the value of the property extra.
 void setHolder(X500Principal holder)
          Sets the legal entity (i.e. the user) to which the license is granted by the issuer.
 void setInfo(String info)
          Sets the value of the property info.
 void setIssued(Date issued)
          Sets the time when the license represented by this license content has been issued.
 void setIssuer(X500Principal issuer)
          Sets the legal entity which grants the license to the holder.
 void setNotAfter(Date notAfter)
          Sets the time when the license ends to be valid.
 void setNotBefore(Date notBefore)
          Sets the time when the license begins to be valid.
 void setSubject(String subject)
          Sets the abstract description of the entity which needs to be licensed in order for it to be used - it could be the name of a software application like e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

consumerAmount

private int consumerAmount

consumerType

private String consumerType

extra

private Object extra

holder

private X500Principal holder

info

private String info

issued

private Date issued

issuer

private X500Principal issuer

notAfter

private Date notAfter

notBefore

private Date notBefore

propertySupport

private transient PropertyChangeSupport propertySupport
Utility field used by bound properties.


serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

subject

private String subject
Constructor Detail

LicenseContent

public LicenseContent()
Method Detail

clone

private static Date clone(Date date)

equals

private static boolean equals(Object a,
                              Object b)

getConsumerAmount

public int getConsumerAmount()
Returns the amount of consumers which are allowed to license the subject with this license. The default is 1.

Returns:
Value of property consumerAmount.

getConsumerType

public String getConsumerType()
Returns a description of the entity which allocates a license for using the licensing subject. This could be a computer or a user or something else. The default is null.

Returns:
Value of property consumerType.

getExtra

public Object getExtra()
Returns the value of the property extra. This property may be used by applications to store arbitrary private data which is not displayed to the user or checked by this library. The default is null.

Since:
The TrueLicense Library Collection 1.19.

getHolder

public X500Principal getHolder()
Returns the legal entity (i.e. the user) to which the license is granted by the issuer. The default is null.

Returns:
Value of property holder.
See Also:
getIssuer()

getInfo

public String getInfo()
Returns the value of the property info. This property may be used by applications to store public license text which gets displayed to the user for informational purposes. The default is null.


getIssued

public Date getIssued()
Returns the time when the license represented by this license content has been issued. The default is null.

Returns:
Value of property issued.
See Also:
System.currentTimeMillis()

getIssuer

public X500Principal getIssuer()
Returns the legal entity which grants the license to the holder. The default is null.

Returns:
Value of property issuer.
See Also:
getHolder()

getNotAfter

public Date getNotAfter()
Returns the time when the license ends to be valid. The default is null.

Returns:
Value of property notAfter.

getNotBefore

public Date getNotBefore()
Returns the time when the license begins to be valid. The default is null.

Returns:
Value of property notBefore.

getSubject

public String getSubject()
Returns the abstract description of the entity which needs to be licensed in order for it to be used - it could be the name of a software application like e.g. "TrueMirror". The default is null.

Returns:
Value of property subject.

hash

private static int hash(Object object)

setConsumerAmount

public void setConsumerAmount(int consumerAmount)
Sets the amount of consumers which are allowed to license the subject with this license.

Parameters:
consumerAmount - New value of bound property consumerAmount.

setConsumerType

public void setConsumerType(String consumerType)
Sets the type of entity which needs to license the license subject in order to use it. This could be a computer or a user or something else.

Parameters:
consumerType - New value of bound property consumerType.

setExtra

public void setExtra(Object extra)
Sets the value of the property extra. This property may be used by applications to store arbitrary private data which is not displayed to the user or checked by this library.

Warning: If you use this property, versions of the TrueLicense Library Collection prior to 1.19 will fail to install or verify the generated license key with an AssertionError, which usually causes the application to terminate abnormally!

(Since version 1.19, if an unknown property is found, a PersistenceServiceException is thrown by these methods instead.)

Parameters:
extra - New value of bound property extra. This object must either implement the JavaBeans specification or have direct support by the class XMLEncoder, such as strings and primitive type wrapper objects.
Since:
The TrueLicense Library Collection 1.19.

setHolder

public void setHolder(X500Principal holder)
Sets the legal entity (i.e. the user) to which the license is granted by the issuer.

Parameters:
holder - New value of bound property holder.
See Also:
setIssuer(X500Principal)

setInfo

public void setInfo(String info)
Sets the value of the property info. This property may be used by applications to store public license text which gets displayed to the user for informational purposes.

Parameters:
info - New value of bound property info.

setIssued

public void setIssued(Date issued)
Sets the time when the license represented by this license content has been issued.

Parameters:
issued - New value of bound property issued.

setIssuer

public void setIssuer(X500Principal issuer)
Sets the legal entity which grants the license to the holder.

Parameters:
issuer - New value of bound property issuer.
See Also:
setHolder(X500Principal)

setNotAfter

public void setNotAfter(Date notAfter)
Sets the time when the license ends to be valid.

Parameters:
notAfter - New value of bound property notAfter.

setNotBefore

public void setNotBefore(Date notBefore)
Sets the time when the license begins to be valid.

Parameters:
notBefore - New value of bound property notBefore.

setSubject

public void setSubject(String subject)
Sets the abstract description of the entity which needs to be licensed in order for it to be used - it could be the name of a software application like e.g. "TrueMirror".

Parameters:
subject - New value of bound property subject.

TrueLicense Core 1.33

Copyright © 2005-2015 Schlichtherle IT Services. All Rights Reserved.