common-util

local.tomas.license
Class License

java.lang.Object
  extended by local.tomas.license.License
All Implemented Interfaces:
Serializable

public final class License
extends Object
implements Serializable

This is the license bean.

Author:
tomas.teubner
See Also:
Serialized Form

Constructor Summary
License()
           
 
Method Summary
 String getAttribute(String name)
          Get extra attribute.
 int getAttributeCount()
          Get number of extra attributes
 Collection<String> getAttributeNames()
          Get names of extra attributes.
 X509Certificate getCertificate()
          Get certificate this license was signed with.
 String getLicensee()
          Get licensee.
 String getSerial()
          Get serial number.
 byte[] getSignable()
          Get hash value to be signed.
 Date getValidFrom()
          Get start of validity interval.
 Date getValidUntil()
          Get end of validity interval.
 boolean isSigned()
          Check if license is signed.
 String removeAttribute(String name)
          Remove extra attribute.
 void removeSignature()
          Remove signature of license.
 void setAttribute(String name, String value)
          Set extra attribute.
 void setCertificate(X509Certificate certificate)
          Set certificate this license must be signed with.
 void setLicensee(String licensee)
          Set licensee.
 void setSerial(String serial)
          Set serial number.
 void setSignature(byte[] signature)
          Set signature of license.
 void setValidFrom(Date validFrom)
          Set start of validity interval.
 void setValidUntil(Date validUntil)
          Set end of validity interval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

License

public License()
Method Detail

getLicensee

public String getLicensee()
Get licensee.

Returns:
licensee name

setLicensee

public void setLicensee(String licensee)
Set licensee.

Parameters:
licensee - licensee name

getSerial

public String getSerial()
Get serial number.

Returns:
serial number

setSerial

public void setSerial(String serial)
Set serial number.

Parameters:
serial - serial number

getValidFrom

public Date getValidFrom()
Get start of validity interval.

Returns:
start of validity interval

setValidFrom

public void setValidFrom(Date validFrom)
Set start of validity interval.

Parameters:
validFrom - start of validity interval

getValidUntil

public Date getValidUntil()
Get end of validity interval.

Returns:
end of validity interval

setValidUntil

public void setValidUntil(Date validUntil)
Set end of validity interval.

Parameters:
validUntil - end of validity interval

getCertificate

public X509Certificate getCertificate()
Get certificate this license was signed with.

Returns:
certificate

setCertificate

public void setCertificate(X509Certificate certificate)
Set certificate this license must be signed with.

Parameters:
certificate - certificate

getAttribute

public String getAttribute(String name)
Get extra attribute.

Parameters:
name - attribute name
Returns:
attribute value

getAttributeCount

public int getAttributeCount()
Get number of extra attributes

Returns:
number of attributes

getAttributeNames

public Collection<String> getAttributeNames()
Get names of extra attributes.

Returns:
collection of attribute names

setAttribute

public void setAttribute(String name,
                         String value)
Set extra attribute.

Parameters:
name - attribute name
value - attribute value

removeAttribute

public String removeAttribute(String name)
Remove extra attribute.

Parameters:
name - attribute name
Returns:
previous attribute value if any

isSigned

public boolean isSigned()
Check if license is signed.

Returns:

setSignature

public void setSignature(byte[] signature)
Set signature of license.

Parameters:
signature - the signature

removeSignature

public void removeSignature()
Remove signature of license.


getSignable

public byte[] getSignable()
                   throws IOException
Get hash value to be signed.

Returns:
hash value
Throws:
IOException

common-util

Copyright © 2007 Tomas Teubner. All Rights Reserved.