Class LicenseContent
- java.lang.Object
-
- org.zkoss.zkex.license.LicenseContent
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class LicenseContent extends java.lang.Object implements java.io.Serializable, java.lang.CloneableThis 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
nullwhich 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
firePropertyChangemethods 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
ObjectOutputStreamorXMLEncoder.- Author:
- Christian Schlichtherle, Christian Schlichtherle
- See Also:
LicenseNotary, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LicenseContent()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)Adds a PropertyChangeListener to the listener list.protected java.lang.Objectclone()Deprecated.There's no need for this method.booleanequals(java.lang.Object object)Returnstrueif and only ifobjectis an instance ofLicenseContentand their properties are considered equal.protected voidfirePropertyChange(java.beans.PropertyChangeEvent evt)protected voidfirePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)intgetConsumerAmount()Returns the amount of consumers which are allowed to license the subject with this license.java.lang.StringgetConsumerType()Returns the type of entity which needs to license the license subject in order to use it.java.lang.ObjectgetExtra()Returns the value of the property extra.javax.security.auth.x500.X500PrincipalgetHolder()Returns the legal entity (i.e. the user) to which the license is granted by the issuer.java.lang.StringgetInfo()Returns the value of the propertyinfo.java.util.DategetIssued()Returns the time when the license represented by this license content has been issued.javax.security.auth.x500.X500PrincipalgetIssuer()Returns the legal entity which grants the license to the holder.java.util.DategetNotAfter()Returns the time when the license ends to be valid.java.util.DategetNotBefore()Returns the time when the license begins to be valid.java.lang.StringgetSubject()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.inthashCode()voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)Removes a PropertyChangeListener from the listener list.voidsetConsumerAmount(int consumerAmount)Sets the amount of consumers which are allowed to license the subject with this license.voidsetConsumerType(java.lang.String consumerType)Sets the type of entity which needs to license the license subject in order to use it.voidsetExtra(java.lang.Object extra)Sets the value of the property extra.voidsetHolder(javax.security.auth.x500.X500Principal holder)Sets the legal entity (i.e. the user) to which the license is granted by the issuer.voidsetInfo(java.lang.String info)Sets the value of the propertyinfo.voidsetIssued(java.util.Date issued)Sets the time when the license represented by this license content has been issued.voidsetIssuer(javax.security.auth.x500.X500Principal issuer)Sets the legal entity which grants the license to the holder.voidsetNotAfter(java.util.Date notAfter)Sets the time when the license ends to be valid.voidsetNotBefore(java.util.Date notBefore)Sets the time when the license begins to be valid.voidsetSubject(java.lang.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.
-
-
-
Method Detail
-
clone
protected java.lang.Object clone()
Deprecated.There's no need for this method. Since it's protected, it may vanish in the next major version update.Returns a clone of this instance. The returned clone shares the value of theextraproperty with this instance. All other mutable property values are cloned.- Overrides:
clonein classjava.lang.Object
-
getHolder
public javax.security.auth.x500.X500Principal getHolder()
Returns the legal entity (i.e. the user) to which the license is granted by the issuer. The default isnull.- Returns:
- Value of property
holder. - See Also:
getIssuer()
-
setHolder
public void setHolder(javax.security.auth.x500.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 propertyholder.- See Also:
setIssuer(X500Principal)
-
getIssuer
public javax.security.auth.x500.X500Principal getIssuer()
Returns the legal entity which grants the license to the holder. The default isnull.- Returns:
- Value of property
issuer. - See Also:
getHolder()
-
setIssuer
public void setIssuer(javax.security.auth.x500.X500Principal issuer)
Sets the legal entity which grants the license to the holder.- Parameters:
issuer- New value of bound propertyissuer.- See Also:
setHolder(X500Principal)
-
getSubject
public java.lang.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 isnull.- Returns:
- Value of property
subject.
-
setSubject
public void setSubject(java.lang.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 propertysubject.
-
getIssued
public java.util.Date getIssued()
Returns the time when the license represented by this license content has been issued. The default isnull.- Returns:
- Value of property
issued. - See Also:
System.currentTimeMillis()
-
setIssued
public void setIssued(java.util.Date issued)
Sets the time when the license represented by this license content has been issued.- Parameters:
issued- New value of bound propertyissued.
-
getNotBefore
public java.util.Date getNotBefore()
Returns the time when the license begins to be valid. The default isnull.- Returns:
- Value of property
notBefore.
-
setNotBefore
public void setNotBefore(java.util.Date notBefore)
Sets the time when the license begins to be valid.- Parameters:
notBefore- New value of bound propertynotBefore.
-
getNotAfter
public java.util.Date getNotAfter()
Returns the time when the license ends to be valid. The default isnull.- Returns:
- Value of property
notAfter.
-
setNotAfter
public void setNotAfter(java.util.Date notAfter)
Sets the time when the license ends to be valid.- Parameters:
notAfter- New value of bound propertynotAfter.
-
getConsumerType
public java.lang.String getConsumerType()
Returns 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. The default isnull.- Returns:
- Value of property
consumerType.
-
setConsumerType
public void setConsumerType(java.lang.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 propertyconsumerType.
-
getConsumerAmount
public int getConsumerAmount()
Returns the amount of consumers which are allowed to license the subject with this license. The default is1.- Returns:
- Value of property
consumerAmount.
-
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 propertyconsumerAmount.
-
getInfo
public java.lang.String getInfo()
Returns the value of the propertyinfo. This property may be used by applications to store public license text for informational purposes. Its value is displayed in thede.schlichtherle.license.wizard.LicensePanel. The default isnull.
-
setInfo
public void setInfo(java.lang.String info)
Sets the value of the propertyinfo. This property may be used by applications to store public license text for informational purposes. Its value is displayed in thede.schlichtherle.license.wizard.LicensePanel.- Parameters:
info- New value of bound propertyinfo.
-
getExtra
public java.lang.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 isnull.- Since:
- The TrueLicense Library Collection 1.19.
-
setExtra
public void setExtra(java.lang.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
PersistenceServiceExceptionis thrown by these methods instead.)- Parameters:
extra- New value of bound propertyextra. This object must either implement the JavaBeans specification or have direct support by the classXMLEncoder, such as strings and primitive type wrapper objects.- Since:
- The TrueLicense Library Collection 1.19.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
Returnstrueif and only ifobjectis an instance ofLicenseContentand their properties are considered equal.- Overrides:
equalsin classjava.lang.Object
-
addPropertyChangeListener
public final void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a PropertyChangeListener to the listener list.- Parameters:
l- The listener to add.
-
removePropertyChangeListener
public final void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a PropertyChangeListener from the listener list.- Parameters:
l- The listener to remove.
-
firePropertyChange
protected final void firePropertyChange(java.beans.PropertyChangeEvent evt)
-
firePropertyChange
protected final void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
-
-