com.atlassian.crowd.manager.license
Interface CrowdLicenseManager

All Known Implementing Classes:
CrowdLicenseManagerImpl

public interface CrowdLicenseManager


Method Summary
 int getCurrentResourceUsageTotal()
          This will calculate the number of unique Principals currently being used by Crowd.
 com.atlassian.extras.api.crowd.CrowdLicense getLicense()
          This will retrieve the license for the currently running Crowd instance.
 boolean isBuildWithinMaintenancePeriod()
           
 boolean isBuildWithinMaintenancePeriod(com.atlassian.extras.api.crowd.CrowdLicense license)
          Return's true if the current Build is within the maintenance period for the Crowd license
 boolean isBuildWithinMaintenancePeriod(java.lang.String key)
           
 boolean isLicenseKeyValid(java.lang.String key)
          Will validate that a given License key is valid
 boolean isLicenseValid()
          This will evaluate against the current license stored in Crowd LicenseStore
 boolean isLicenseValid(com.atlassian.extras.api.crowd.CrowdLicense license)
          Same logic as isLicenseValid()
 boolean isResourceTotalOverLimit(float limit, int currentResourceCount)
          Calculates the percentage of currentResourceCount over the user limit on a license and returns true or false if the percentage is above the passed in limit.
 boolean isSetupLicenseKeyValid(java.lang.String key)
          Checks if a license key valid for set up.
 com.atlassian.extras.api.crowd.CrowdLicense storeLicense(java.lang.String license)
          This will store the license in the LicenseStore for the currently running Crowd instance.
 

Method Detail

getLicense

com.atlassian.extras.api.crowd.CrowdLicense getLicense()
This will retrieve the license for the currently running Crowd instance.

Returns:
com.atlassian.license.License or null if not set.

storeLicense

com.atlassian.extras.api.crowd.CrowdLicense storeLicense(java.lang.String license)
This will store the license in the LicenseStore for the currently running Crowd instance.


isLicenseValid

boolean isLicenseValid()
This will evaluate against the current license stored in Crowd LicenseStore

Will return true if the License has not gone beyond its resource total and if the user is not running an evaluation version and it has not expired. This is an overriding method to @see isLicenseValid(License license), so will call getLicense() internally.

Returns:
true if License has not gone beyond resource limit or is not an evalution and is expired.

isLicenseValid

boolean isLicenseValid(com.atlassian.extras.api.crowd.CrowdLicense license)
Same logic as isLicenseValid()


isLicenseKeyValid

boolean isLicenseKeyValid(java.lang.String key)
Will validate that a given License key is valid

Parameters:
key - the String to validate
Returns:
true if an only if the licene is valid, otherwise false

isSetupLicenseKeyValid

boolean isSetupLicenseKeyValid(java.lang.String key)
Checks if a license key valid for set up. In particular, it does not check the current user count as there are no users configured when initially entering a license in the setup process.

Parameters:
key - the String to validate.
Returns:
true if an only if the licene is valid, otherwise false.

getCurrentResourceUsageTotal

int getCurrentResourceUsageTotal()
                                 throws CrowdLicenseManagerException
This will calculate the number of unique Principals currently being used by Crowd. Please note: this is an expensive call and is actually stored in the database by a Quartz process LicenseResourceJob. Please use consider using PropertyManager.getCurrentLicenseResourceTotal() Note: Do not call this method from the web layer, as this is wrapped in a Spring managed transaction

Returns:
the number of users/principals.
Throws:
CrowdLicenseManagerException

isResourceTotalOverLimit

boolean isResourceTotalOverLimit(float limit,
                                 int currentResourceCount)
Calculates the percentage of currentResourceCount over the user limit on a license and returns true or false if the percentage is above the passed in limit.

Parameters:
limit - the percentage limit to test against
currentResourceCount - the current number of resources in the system.
Returns:
true if over limit, false otherwise.

isBuildWithinMaintenancePeriod

boolean isBuildWithinMaintenancePeriod(com.atlassian.extras.api.crowd.CrowdLicense license)
Return's true if the current Build is within the maintenance period for the Crowd license

Parameters:
license -

isBuildWithinMaintenancePeriod

boolean isBuildWithinMaintenancePeriod(java.lang.String key)

isBuildWithinMaintenancePeriod

boolean isBuildWithinMaintenancePeriod()


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.