pt.digitalis.dif.dem.objects
Class LicenseImpl

java.lang.Object
  extended by pt.digitalis.dif.dem.objects.LicenseImpl
All Implemented Interfaces:
ILicense

public class LicenseImpl
extends Object
implements ILicense

This class will hold the information of a given registration. It allows the management of registrations including creation and deletion. TODO: Candidate for another project.

Author:
Pedro Viegas pviegas@digitalis.pt
Created on:
Sep 26, 2007

Constructor Summary
LicenseImpl()
          Constructor for an unregistered element
LicenseImpl(String name)
          Constructor for an unregistered element
LicenseImpl(String name, String key)
          Constructor for a registered element
 
Method Summary
 String generateKey(String client, String entity, String date, LicenseEditionType edition)
          Generates full version key
protected  String getClientName()
          Get the Client Name
 LicenseEditionType getEdition()
          Returns the License Edition
 Date getExpirationDate()
          Checks if the current license has expired
 String getKey()
           
 String getName()
           
protected  String getSeed()
          The defined default Seed for DIF.
 boolean hasExpirationDate()
          Checks if the current license has an expiration date
 boolean hasExpired()
          Checks if the current license has expired
 boolean isRegistered()
          Checks if it is registered
 boolean isRegistrable()
          Checks if the element is registrable
 boolean register(String key, String entityId)
          Create the registration
 void setName(String name)
           
 void setRegistrable(boolean registrable)
          Sets the registrability of this element
 void unregister()
          Delete the registration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LicenseImpl

public LicenseImpl()
Constructor for an unregistered element


LicenseImpl

public LicenseImpl(String name)
Constructor for an unregistered element

Parameters:
name - the name of the element

LicenseImpl

public LicenseImpl(String name,
                   String key)
Constructor for a registered element

Parameters:
name - the name of the element
key - the key of the registered element
Method Detail

generateKey

public String generateKey(String client,
                          String entity,
                          String date,
                          LicenseEditionType edition)
Description copied from interface: ILicense
Generates full version key

Specified by:
generateKey in interface ILicense
Parameters:
client - the client name to the key association
entity - the entity to register
date - date to use in the encryption
edition - The edition type
Returns:
the generated full version key
See Also:
ILicense.generateKey(java.lang.String, java.lang.String, java.lang.String, pt.digitalis.dif.dem.objects.LicenseEditionType)

getClientName

protected String getClientName()
Get the Client Name

Returns:
the Client Name

getEdition

public LicenseEditionType getEdition()
Description copied from interface: ILicense
Returns the License Edition

Specified by:
getEdition in interface ILicense
Returns:
LicenseEditionType
See Also:
ILicense.getEdition()

getExpirationDate

public Date getExpirationDate()
Description copied from interface: ILicense
Checks if the current license has expired

Specified by:
getExpirationDate in interface ILicense
Returns:
The expiration date, or null it it is a final license
See Also:
ILicense.getExpirationDate()

getKey

public String getKey()
Specified by:
getKey in interface ILicense
Returns:
the key
See Also:
ILicense.getKey()

getName

public String getName()
Specified by:
getName in interface ILicense
Returns:
the name
See Also:
ILicense.getName()

getSeed

protected String getSeed()
The defined default Seed for DIF.

Returns:
the seed

hasExpirationDate

public boolean hasExpirationDate()
Description copied from interface: ILicense
Checks if the current license has an expiration date

Specified by:
hasExpirationDate in interface ILicense
Returns:
T if it has
See Also:
ILicense.hasExpirationDate()

hasExpired

public boolean hasExpired()
Description copied from interface: ILicense
Checks if the current license has expired

Specified by:
hasExpired in interface ILicense
Returns:
T if the expiration date has passed
See Also:
ILicense.hasExpired()

isRegistered

public boolean isRegistered()
Description copied from interface: ILicense
Checks if it is registered

Specified by:
isRegistered in interface ILicense
Returns:
T if the key exists and is correct
See Also:
ILicense.isRegistered()

isRegistrable

public boolean isRegistrable()
Description copied from interface: ILicense
Checks if the element is registrable

Specified by:
isRegistrable in interface ILicense
Returns:
T if it is registrable
See Also:
ILicense.isRegistrable()

register

public boolean register(String key,
                        String entityId)
Description copied from interface: ILicense
Create the registration

Specified by:
register in interface ILicense
Parameters:
key - the key to register
Returns:
the registered record
See Also:
ILicense.register(java.lang.String, java.lang.String)

setName

public void setName(String name)
Specified by:
setName in interface ILicense
Parameters:
name - the name to set
See Also:
ILicense.setName(java.lang.String)

setRegistrable

public void setRegistrable(boolean registrable)
Description copied from interface: ILicense
Sets the registrability of this element

Specified by:
setRegistrable in interface ILicense
Parameters:
registrable - the registrability to set
See Also:
ILicense.setRegistrable(boolean)

unregister

public void unregister()
Description copied from interface: ILicense
Delete the registration

Specified by:
unregister in interface ILicense
See Also:
ILicense.unregister()


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.