Class CrowdLicenseManagerImpl
java.lang.Object
com.atlassian.crowd.manager.license.CrowdLicenseManagerImpl
- All Implemented Interfaces:
CrowdLicenseManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EntityQuery<Application>
static final EntityQuery<String>
static final EntityQuery<String>
-
Constructor Summary
ConstructorsConstructorDescriptionCrowdLicenseManagerImpl
(PropertyManager propertyManager, ApplicationManager applicationManager, DirectoryManager directoryManager, CrowdLicenseStore licenseStore, ClusterService clusterService, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionint
Returns pre-calculated number of unique Principals currently being used by Crowd.com.atlassian.extras.api.crowd.CrowdLicense
This will retrieve the license for the currently running Crowd instance.com.atlassian.extras.api.crowd.CrowdLicense
getLicense
(String licenseKey) This will parse a license key into a license.This will retrieve the license key for the currently running Crowd instance.boolean
isBuildWithinMaintenancePeriod
(com.atlassian.extras.api.crowd.CrowdLicense license) Return's true if the current Build is within the maintenance period for the Crowd licenseboolean
isBuildWithinMaintenancePeriod
(String licenseKey) boolean
isLicenseKeyValid
(String licenseKey) Will validate that a given License key is validboolean
This will evaluate against the current license stored in Crowd LicenseStore.boolean
isLicenseValid
(com.atlassian.extras.api.crowd.CrowdLicense license) Same logic asCrowdLicenseManager.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
isResourceTotalUnderLimitInLicenseKey
(String licenseKey) Validate if a given license key has a higher resource limit than current total resource countboolean
isSetupLicenseKeyValid
(String licenseKey) Checks if a license key valid for set up.int
This will calculate the number of unique Principals currently being used by Crowd.com.atlassian.extras.api.crowd.CrowdLicense
storeLicense
(String licenseKey) This will store the license in the LicenseStore for the currently running Crowd instance.
-
Field Details
-
ACTIVE_USERS_QUERY
-
ALL_USERS_QUERY
-
ACTIVE_APPS_QUERY
-
-
Constructor Details
-
CrowdLicenseManagerImpl
public CrowdLicenseManagerImpl(PropertyManager propertyManager, ApplicationManager applicationManager, DirectoryManager directoryManager, CrowdLicenseStore licenseStore, ClusterService clusterService, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
getLicense
public com.atlassian.extras.api.crowd.CrowdLicense getLicense()Description copied from interface:CrowdLicenseManager
This will retrieve the license for the currently running Crowd instance.- Specified by:
getLicense
in interfaceCrowdLicenseManager
- Returns:
- com.atlassian.license.License or null if not set.
- See Also:
-
getLicense
Description copied from interface:CrowdLicenseManager
This will parse a license key into a license.- Specified by:
getLicense
in interfaceCrowdLicenseManager
- Parameters:
licenseKey
- license string- Returns:
- license
-
getRawLicense
Description copied from interface:CrowdLicenseManager
This will retrieve the license key for the currently running Crowd instance.- Specified by:
getRawLicense
in interfaceCrowdLicenseManager
- Returns:
- raw license key.
-
storeLicense
public com.atlassian.extras.api.crowd.CrowdLicense storeLicense(String licenseKey) throws CrowdLicenseManagerException Description copied from interface:CrowdLicenseManager
This will store the license in the LicenseStore for the currently running Crowd instance.- Specified by:
storeLicense
in interfaceCrowdLicenseManager
- Throws:
CrowdLicenseManagerException
-
isLicenseValid
public boolean isLicenseValid()Description copied from interface:CrowdLicenseManager
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.
- Specified by:
isLicenseValid
in interfaceCrowdLicenseManager
- Returns:
- true if License has not gone beyond resource limit or is not an evalution and is expired.
- See Also:
-
isSetupLicenseKeyValid
Description copied from interface:CrowdLicenseManager
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.- Specified by:
isSetupLicenseKeyValid
in interfaceCrowdLicenseManager
- Parameters:
licenseKey
- the String to validate.- Returns:
- true if an only if the license is valid, otherwise false.
-
isLicenseValid
public boolean isLicenseValid(com.atlassian.extras.api.crowd.CrowdLicense license) Description copied from interface:CrowdLicenseManager
Same logic asCrowdLicenseManager.isLicenseValid()
- Specified by:
isLicenseValid
in interfaceCrowdLicenseManager
-
isLicenseKeyValid
Description copied from interface:CrowdLicenseManager
Will validate that a given License key is valid- Specified by:
isLicenseKeyValid
in interfaceCrowdLicenseManager
- Parameters:
licenseKey
- the String to validate- Returns:
- true if an only if the license is valid, otherwise false
-
getCurrentResourceUsageTotal
public int getCurrentResourceUsageTotal()Description copied from interface:CrowdLicenseManager
Returns pre-calculated number of unique Principals currently being used by Crowd.- Specified by:
getCurrentResourceUsageTotal
in interfaceCrowdLicenseManager
- Returns:
- the number of users/principals.
- See Also:
-
recalculateResourceUsageTotal
Description copied from interface:CrowdLicenseManager
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 consider usingCrowdLicenseManager.getCurrentResourceUsageTotal()
Note: Do not call this method from the web layer, as this is wrapped in a Spring managed transaction- Specified by:
recalculateResourceUsageTotal
in interfaceCrowdLicenseManager
- Returns:
- the number of users/principals.
- Throws:
CrowdLicenseManagerException
-
isResourceTotalOverLimit
public boolean isResourceTotalOverLimit(float limit, int currentResourceCount) Description copied from interface:CrowdLicenseManager
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.- Specified by:
isResourceTotalOverLimit
in interfaceCrowdLicenseManager
- Parameters:
limit
- the percentage limit to test againstcurrentResourceCount
- the current number of resources in the system.- Returns:
- true if over limit, false otherwise.
- See Also:
-
isBuildWithinMaintenancePeriod
public boolean isBuildWithinMaintenancePeriod(com.atlassian.extras.api.crowd.CrowdLicense license) Description copied from interface:CrowdLicenseManager
Return's true if the current Build is within the maintenance period for the Crowd license- Specified by:
isBuildWithinMaintenancePeriod
in interfaceCrowdLicenseManager
-
isBuildWithinMaintenancePeriod
- Specified by:
isBuildWithinMaintenancePeriod
in interfaceCrowdLicenseManager
-
isResourceTotalUnderLimitInLicenseKey
Description copied from interface:CrowdLicenseManager
Validate if a given license key has a higher resource limit than current total resource count- Specified by:
isResourceTotalUnderLimitInLicenseKey
in interfaceCrowdLicenseManager
- Parameters:
licenseKey
- the license key String to validate- Returns:
- true if license limit is higher than current total resource count, false otherwise
-