Class LicenseContent

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class LicenseContent
    extends java.lang.Object
    implements java.io.Serializable, java.lang.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, 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
      void addPropertyChangeListener​(java.beans.PropertyChangeListener l)
      Adds a PropertyChangeListener to the listener list.
      protected java.lang.Object clone()
      Deprecated.
      There's no need for this method.
      boolean equals​(java.lang.Object object)
      Returns true if and only if object is an instance of LicenseContent and their properties are considered equal.
      protected void firePropertyChange​(java.beans.PropertyChangeEvent evt)  
      protected void firePropertyChange​(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)  
      int getConsumerAmount()
      Returns the amount of consumers which are allowed to license the subject with this license.
      java.lang.String getConsumerType()
      Returns the type of entity which needs to license the license subject in order to use it.
      java.lang.Object getExtra()
      Returns the value of the property extra.
      javax.security.auth.x500.X500Principal getHolder()
      Returns the legal entity (i.e. the user) to which the license is granted by the issuer.
      java.lang.String getInfo()
      Returns the value of the property info.
      java.util.Date getIssued()
      Returns the time when the license represented by this license content has been issued.
      javax.security.auth.x500.X500Principal getIssuer()
      Returns the legal entity which grants the license to the holder.
      java.util.Date getNotAfter()
      Returns the time when the license ends to be valid.
      java.util.Date getNotBefore()
      Returns the time when the license begins to be valid.
      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.
      int hashCode()  
      void removePropertyChangeListener​(java.beans.PropertyChangeListener l)
      Removes a PropertyChangeListener from the listener list.
      void setConsumerAmount​(int consumerAmount)
      Sets the amount of consumers which are allowed to license the subject with this license.
      void setConsumerType​(java.lang.String consumerType)
      Sets the type of entity which needs to license the license subject in order to use it.
      void setExtra​(java.lang.Object extra)
      Sets the value of the property extra.
      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.
      void setInfo​(java.lang.String info)
      Sets the value of the property info.
      void setIssued​(java.util.Date issued)
      Sets the time when the license represented by this license content has been issued.
      void setIssuer​(javax.security.auth.x500.X500Principal issuer)
      Sets the legal entity which grants the license to the holder.
      void setNotAfter​(java.util.Date notAfter)
      Sets the time when the license ends to be valid.
      void setNotBefore​(java.util.Date notBefore)
      Sets the time when the license begins to be valid.
      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.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LicenseContent

        public LicenseContent()
    • 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 the extra property with this instance. All other mutable property values are cloned.
        Overrides:
        clone in class java.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 is null.
        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 property holder.
        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 is null.
        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 property issuer.
        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 is null.
        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 property subject.
      • getIssued

        public java.util.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()
      • 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 property issued.
      • getNotBefore

        public java.util.Date getNotBefore()
        Returns the time when the license begins to be valid. The default is null.
        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 property notBefore.
      • getNotAfter

        public java.util.Date getNotAfter()
        Returns the time when the license ends to be valid. The default is null.
        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 property notAfter.
      • 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 is null.
        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 property consumerType.
      • 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.
      • 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.
      • getInfo

        public java.lang.String getInfo()
        Returns the value of the property info. This property may be used by applications to store public license text for informational purposes. Its value is displayed in the de.schlichtherle.license.wizard.LicensePanel. The default is null.
      • setInfo

        public void setInfo​(java.lang.String info)
        Sets the value of the property info. This property may be used by applications to store public license text for informational purposes. Its value is displayed in the de.schlichtherle.license.wizard.LicensePanel.
        Parameters:
        info - New value of bound property info.
      • 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 is null.
        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 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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object object)
        Returns true if and only if object is an instance of LicenseContent and their properties are considered equal.
        Overrides:
        equals in class java.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)