blackboard.platform
Class LicenseManager

java.lang.Object
  extended by blackboard.platform.LicenseManager

public final class LicenseManager
extends java.lang.Object

Class used to parse and validate license files. Licenses are read from a simple XML file that contains several different components to activate different parts of the application. Each component is represented by a License object.

Note: This object is primarily for Blackboard use and should be considered very unstable. It may change substantially in future releases.

Since:
Bb 6.0
Version:
$Revision: #1 $ $Date: 2005/06/27 $

Constructor Summary
LicenseManager(java.lang.String productName, java.lang.String clientId, java.lang.String productOwnedId, License[] licenses, java.lang.String key)
          Instantiates a LicenseManager object with the specified parameters and license components.
 
Method Summary
 void assertIsLicensed(java.lang.String componentName)
          Similar to isLicensed(), except that exceptions are thrown if the license check fails.
 java.lang.String getAppPack()
           
 java.lang.String getBuildNumber()
           
 java.lang.String getClientId()
          Returns the client id fromt the LicenseFile
 java.lang.String getFamilyNameUpdateHtml()
           
static LicenseManager getInstance(java.io.File licenseFile)
          Returns an instance of LicenseManager initialized with the specified file.
static LicenseManager getInstance(java.io.File licenseFile, boolean validate)
          Returns an instance of LicenseManager initialized with the specified file.
 java.lang.String getKey()
          Returns the validation key from the license file.
 java.util.Date getLicenseExpiration(java.lang.String componentName)
          Returns the expiration for a given license or null if it never expires.
 java.lang.String getLicenseParameter(java.lang.String componentName, java.lang.String propertyName)
          Returns the value of the specified property in the target key or null if the property is not found.
 java.lang.Integer getLicenseUnitsParameter(java.lang.String componentName, java.lang.String propertyName)
          Returns the Integer value of the specified property in the target key or null if the property is not found.
 java.lang.String getLongProductName()
          For the Web: HTML for bold, italic, superscript etc. tagged around each product if multiple products exist.
 java.lang.String getLongProductNameHtml()
          For the Web: HTML for bold, italic, superscript etc. tagged around each product if multiple products exist.
 java.lang.String getLongProductNameHtmlTm()
          For the Web: HTML for bold, italic, TM, superscript etc. tagged around each product if multiple products exist.
 java.lang.String getMajorReleaseNumber()
           
 java.lang.String getProductFamilyName()
          • For the Web: HTML for bold, italic, superscript etc.
 java.lang.String getProductFamilyNameHtml()
          • For the Web: HTML for bold, italic, superscript etc.
 java.lang.String getProductFamilyNameHtmlTm()
          • For the Web: HTML for bold, italic, TM, superscript etc.
 java.lang.String getProductName()
          Returns the product name from the LicenseFile.
 java.lang.String getProductOwnedId()
          Returns the product owned id fromt the LicenseFile
 java.lang.String getUpdateName()
           
 java.lang.String getUpdateNameLong()
           
 boolean isLicensed(java.lang.String componentName)
          Method to check whether the specified component name is available and valid.
 boolean isLicenseUnitsParameterUnlimited(java.lang.String componentName, java.lang.String propertyName)
          Returns true if specified the units parameter is unlimited.
 License[] listLicenses()
          Returns an array of all License objects read from the license file.
 License lookupLicense(java.lang.String componentName)
          Returns the License associated with the specified component key.
 LicenseDescriptor lookupLicenseDescriptor(java.lang.String componentName)
          Looks up human-readable descriptor for specified component.
 void runtimeAssertIsLicensed(java.lang.String componentName)
          Same as assertIsLicensed(), but exceptions are wrapped in a RuntimeBbServiceException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LicenseManager

public LicenseManager(java.lang.String productName,
                      java.lang.String clientId,
                      java.lang.String productOwnedId,
                      License[] licenses,
                      java.lang.String key)
Instantiates a LicenseManager object with the specified parameters and license components.

Parameters:
productName - Product name in top-level element of the license file.
clientId - Client id in the top-level element of the license file.
productOwnedId - Product-owned id in the top-level element of the license file.
licenses - All components successfully parsed from the license file
key - Validation key
Method Detail

getProductName

public java.lang.String getProductName()
Returns the product name from the LicenseFile. The name is in the "product-name" attribute of the root <blackboard-licenses> element.

Returns:
"product-name" attribute from license file.

getProductOwnedId

public java.lang.String getProductOwnedId()
Returns the product owned id fromt the LicenseFile

Returns:
"product-owned-id" attribute from the license file

getClientId

public java.lang.String getClientId()
Returns the client id fromt the LicenseFile

Returns:
"client-id" attribute from the license file

getKey

public java.lang.String getKey()
Returns the validation key from the license file. The key is a string representation of the license hash.

Returns:
Hash value for license.

isLicensed

public boolean isLicensed(java.lang.String componentName)
Method to check whether the specified component name is available and valid. License must and pass the following checks:

Parameters:
componentName - Component to check
Returns:
True if component passes checks.

assertIsLicensed

public void assertIsLicensed(java.lang.String componentName)
                      throws LicenseNotFoundException,
                             LicenseExpiredException,
                             UnlicensedServerException
Similar to isLicensed(), except that exceptions are thrown if the license check fails.

Parameters:
componentName - Component to check.
Throws:
LicenseNotFoundException - if the license is not found
LicenseExpiredException - If the license is expired
UnlicensedServerException - If the license is not valid to run on this server

runtimeAssertIsLicensed

public void runtimeAssertIsLicensed(java.lang.String componentName)
                             throws RuntimeBbServiceException
Same as assertIsLicensed(), but exceptions are wrapped in a RuntimeBbServiceException. Use e.getNestedException() to get the actual LicenseException.

Parameters:
componentName - License component to check.
Throws:
RuntimeBbServiceException - If any of the checks fails.

getLicenseExpiration

public java.util.Date getLicenseExpiration(java.lang.String componentName)
                                    throws LicenseNotFoundException,
                                           LicenseExpiredException,
                                           UnlicensedServerException
Returns the expiration for a given license or null if it never expires.

Parameters:
componentName - License component to check
Returns:
Expiration date for the specified component
Throws:
LicenseNotFoundException - if the license is not found
LicenseExpiredException - if the license is expired
UnlicensedServerException - if the license is not valid to run on this server

getLicenseUnitsParameter

public java.lang.Integer getLicenseUnitsParameter(java.lang.String componentName,
                                                  java.lang.String propertyName)
                                           throws LicenseNotFoundException,
                                                  LicenseExpiredException,
                                                  UnlicensedServerException
Returns the Integer value of the specified property in the target key or null if the property is not found. Returns Integer.MAX_VALUE if the units are unlimited. Note that the system will not initialize if any unit parameter is malformed.

Parameters:
componentName - Component to check unit for
propertyName - Unit parameter to check
Returns:
Integer value of the property.
Throws:
LicenseNotFoundException - if the license is not found
LicenseExpiredException - if the license is opined
UnlicensedServerException - if the license is not valid to run on this server

isLicenseUnitsParameterUnlimited

public boolean isLicenseUnitsParameterUnlimited(java.lang.String componentName,
                                                java.lang.String propertyName)
                                         throws LicenseNotFoundException,
                                                LicenseExpiredException,
                                                UnlicensedServerException
Returns true if specified the units parameter is unlimited.

Parameters:
componentName - License component to check
propertyName - Unit parameter to check
Throws:
LicenseNotFoundException - if the license is not found
LicenseExpiredException - if the license is opined
UnlicensedServerException - if the license is not valid to run on this server

getLicenseParameter

public java.lang.String getLicenseParameter(java.lang.String componentName,
                                            java.lang.String propertyName)
                                     throws LicenseNotFoundException,
                                            LicenseExpiredException,
                                            UnlicensedServerException
Returns the value of the specified property in the target key or null if the property is not found.

Parameters:
componentName - License component to check
propertyName - Unit parameter to check
Throws:
LicenseNotFoundException - if the license is not found
LicenseExpiredException - if the license is opined
UnlicensedServerException - if the license is not valid to run on this server

lookupLicense

public License lookupLicense(java.lang.String componentName)
                      throws LicenseNotFoundException
Returns the License associated with the specified component key.

Parameters:
componentName - License to look up
Returns:
Specified license. An exception is thrown if the license is not found.
Throws:
LicenseNotFoundException - Thrown if the specified component is not found.

lookupLicenseDescriptor

public LicenseDescriptor lookupLicenseDescriptor(java.lang.String componentName)
Looks up human-readable descriptor for specified component.

Parameters:
componentName - Component to look up
Returns:
Initialized LicenseDescriptor

listLicenses

public License[] listLicenses()
Returns an array of all License objects read from the license file.

Returns:
Array of License objects.

getInstance

public static final LicenseManager getInstance(java.io.File licenseFile,
                                               boolean validate)
                                        throws InitializationException
Returns an instance of LicenseManager initialized with the specified file.

Parameters:
licenseFile - File to read license data from
validate - Flag indicating whether to validate the licese data
Throws:
InitializationException - Thrown if the file cannot be read or the license contains an invalid key

getInstance

public static final LicenseManager getInstance(java.io.File licenseFile)
                                        throws InitializationException
Returns an instance of LicenseManager initialized with the specified file.

Parameters:
licenseFile - File to read license data from
Returns:
Initialized LicenseManager
Throws:
InitializationException - Thrown if the file cannot be read or the license contains an invalid key

getBuildNumber

public java.lang.String getBuildNumber()
Returns:
Returns the buildNumber.

getLongProductName

public java.lang.String getLongProductName()
For the Web: HTML for bold, italic, superscript etc. tagged around each product if multiple products exist. No font size For the Installer/Updater: Text No Release number Multiple product names will be separated by plain-text commas which can be removed to manage the separate names Blackboard Learning System™, Blackboard Portal System™, currently Blackboard Learning System™ (Release 6) or Blackboard Learning System™ (Release 6)


getLongProductNameHtml

public java.lang.String getLongProductNameHtml()
For the Web: HTML for bold, italic, superscript etc. tagged around each product if multiple products exist. No font size For the Installer/Updater: Text No Release number Multiple product names will be separated by plain-text commas which can be removed to manage the separate names Blackboard Learning System™, Blackboard Portal System™, currently Blackboard Learning System™ (Release 6) or Blackboard Learning System™ (Release 6)


getLongProductNameHtmlTm

public java.lang.String getLongProductNameHtmlTm()
For the Web: HTML for bold, italic, TM, superscript etc. tagged around each product if multiple products exist. No font size For the Installer/Updater: Text No Release number Multiple product names will be separated by plain-text commas which can be removed to manage the separate names Blackboard Learning System™, Blackboard Portal System™, currently Blackboard Learning System™ (Release 6) or Blackboard Learning System™ (Release 6)


getMajorReleaseNumber

public java.lang.String getMajorReleaseNumber()
Returns:
Returns the majorReleaseNumber.

getProductFamilyName

public java.lang.String getProductFamilyName()
• For the Web: HTML for bold, italic, superscript etc. No font size • For the Installer/Updater: Text • No Release number


getProductFamilyNameHtml

public java.lang.String getProductFamilyNameHtml()
• For the Web: HTML for bold, italic, superscript etc. No font size • For the Installer/Updater: Text • No Release number


getProductFamilyNameHtmlTm

public java.lang.String getProductFamilyNameHtmlTm()
• For the Web: HTML for bold, italic, TM, superscript etc. No font size • For the Installer/Updater: Text • No Release number


getUpdateName

public java.lang.String getUpdateName()
Returns:
Returns the updateName.

getUpdateNameLong

public java.lang.String getUpdateNameLong()
Returns:
Returns the updateNameLong.

getFamilyNameUpdateHtml

public java.lang.String getFamilyNameUpdateHtml()
Returns:
Returns the familyNameUpdate.

getAppPack

public java.lang.String getAppPack()


Copyright © 2003 Blackboard, Inc. All Rights Reserved.