Package com.atlassian.jira.license
Class JiraLicenseManagerImpl
java.lang.Object
com.atlassian.jira.license.JiraLicenseManagerImpl
- All Implemented Interfaces:
CachingComponent
,InitializingComponent
,JiraLicenseManager
public class JiraLicenseManagerImpl
extends Object
implements JiraLicenseManager, CachingComponent, InitializingComponent
- Since:
- v4.0
-
Constructor Summary
ConstructorsConstructorDescriptionJiraLicenseManagerImpl
(com.atlassian.license.SIDManager sidManager, com.atlassian.event.api.EventPublisher eventPublisher, MultiLicenseStore multiLicenseStore, LicenseDetailsFactory licenseDetailsFactory, ApplicationProperties applicationProperties, com.atlassian.cache.CacheManager cacheManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called after all the beans are constructed and the ApplicationContext is fully populated.void
clearAndSetLicense
(String licenseString) Removes all licenses from JIRA and replace them with the new license.clearAndSetLicenseNoEvent
(String licenseString) Removes all licenses from JIRA and replace them with the new license without raising an event.void
Clear the cache within the component.void
confirmProceedUnderEvaluationTerms
(String userName) Records that the user has acknowledged that one or more of their licenses is out of maintenance.Set
<com.atlassian.application.api.ApplicationKey> Retrieve a Set of all installed product license's keys in this instance.io.atlassian.fugue.Option
<LicenseDetails> getLicense
(com.atlassian.application.api.ApplicationKey application) Return theLicenseDetails
associated with the passedApplicationKey
.getLicense
(String licenseString) Returns theLicenseDetails
corresponding to the given license string after decoding, or throws an exception if the license string is invalid or cannot be decoded.Retrieve a collection of all product licenses installed in this instance.Returns the server ID of this JIRA instance, creating it if necessary.Retrieves the SEN (Support Entitlement Number) of all installed licenses and orders them in a consistent manner.boolean
Returns true if the support/maintenance period for this JIRA instance has been exceeded and an instance admin has acknowledged this fact.boolean
isDecodeable
(String licenseString) This returns true if the provided licence string can be decoded into a valid licenceboolean
isLicensed
(com.atlassian.application.api.ApplicationKey application) Returnstrue
if the given application is licensed.boolean
Returns true if at least one license has beenset
.void
onCacheClear
(ClearCacheEvent clearEvent) void
removeLicense
(com.atlassian.application.api.ApplicationKey application) Removes the license that grants access to the passed application.void
removeLicenses
(Iterable<? extends LicenseDetails> licenses) Removes passed licenses.setLicense
(String licenseString) Sets the current license of this instance.setLicenseNoEvent
(String licenseString) Sets the current license of this instance.setLicenses
(Collection<String> licenseStrings) Sets the current licenses of this instance.void
subscribeToClearCache
(Consumer<Void> consumer) Subscribe aConsumer
to be called after this manager's cache has been cleared.void
unSubscribeFromClearCache
(Consumer<Void> consumer) Un-subscribe aConsumer
from being called after clearing of this manager's cache.
-
Constructor Details
-
JiraLicenseManagerImpl
public JiraLicenseManagerImpl(com.atlassian.license.SIDManager sidManager, com.atlassian.event.api.EventPublisher eventPublisher, MultiLicenseStore multiLicenseStore, LicenseDetailsFactory licenseDetailsFactory, ApplicationProperties applicationProperties, com.atlassian.cache.CacheManager cacheManager)
-
-
Method Details
-
afterInstantiation
Description copied from interface:InitializingComponent
Called after all the beans are constructed and the ApplicationContext is fully populated. Order of execution is order of bean creation, driven by InitializingComponentProcessor.- Specified by:
afterInstantiation
in interfaceInitializingComponent
- Throws:
Exception
-
getServerId
Description copied from interface:JiraLicenseManager
Returns the server ID of this JIRA instance, creating it if necessary.- Specified by:
getServerId
in interfaceJiraLicenseManager
- Returns:
- see above
-
getLicense
Description copied from interface:JiraLicenseManager
Returns theLicenseDetails
corresponding to the given license string after decoding, or throws an exception if the license string is invalid or cannot be decoded.- Specified by:
getLicense
in interfaceJiraLicenseManager
- Parameters:
licenseString
- the license string.- Returns:
- the
LicenseDetails
for license encoded by the given string. - See Also:
-
getLicenses
Description copied from interface:JiraLicenseManager
Retrieve a collection of all product licenses installed in this instance.In pre-7.0 JIRA this method returns an iterable containing at most one license.
- Specified by:
getLicenses
in interfaceJiraLicenseManager
- Returns:
- all product licenses installed in this instance.
-
getAllLicensedApplicationKeys
Description copied from interface:JiraLicenseManager
Retrieve a Set of all installed product license's keys in this instance.- Specified by:
getAllLicensedApplicationKeys
in interfaceJiraLicenseManager
- Returns:
- all the installed product license's keys in this instance.
-
getSupportEntitlementNumbers
Description copied from interface:JiraLicenseManager
Retrieves the SEN (Support Entitlement Number) of all installed licenses and orders them in a consistent manner. The order is guaranteed for a given set of licenses. It may change when licenses are added or removed.- Specified by:
getSupportEntitlementNumbers
in interfaceJiraLicenseManager
- Returns:
- of the SEN. The order of SENs in the set will be maintained as far as the set of installed licenses doesn't change.
- See Also:
-
getLicense
public io.atlassian.fugue.Option<LicenseDetails> getLicense(@Nonnull com.atlassian.application.api.ApplicationKey application) Description copied from interface:JiraLicenseManager
Return theLicenseDetails
associated with the passedApplicationKey
.- Specified by:
getLicense
in interfaceJiraLicenseManager
- Parameters:
application
- theApplicationKey
to query.- Returns:
- the
LicenseDetails
associated with the passed application key orOption.none()
if no such application exists.
-
isLicensed
public boolean isLicensed(@Nonnull com.atlassian.application.api.ApplicationKey application) Description copied from interface:JiraLicenseManager
Returnstrue
if the given application is licensed.- Specified by:
isLicensed
in interfaceJiraLicenseManager
- Parameters:
application
- the application- Returns:
true
if the given application is licensed.
-
isDecodeable
Description copied from interface:JiraLicenseManager
This returns true if the provided licence string can be decoded into a valid licence- Specified by:
isDecodeable
in interfaceJiraLicenseManager
- Parameters:
licenseString
- the license string- Returns:
- true if it is can be decoded and false otherwise
-
setLicense
Description copied from interface:JiraLicenseManager
Sets the current license of this instance.Note that this method will fire a
LicenseChangedEvent
.- Specified by:
setLicense
in interfaceJiraLicenseManager
- Parameters:
licenseString
- the license string- Returns:
- the JIRA license of this instance, this shouldn't be null if the
license
is valid.
-
setLicenses
Description copied from interface:JiraLicenseManager
Sets the current licenses of this instance.Note that this method will fire a
LicenseChangedEvent
.- Specified by:
setLicenses
in interfaceJiraLicenseManager
- Parameters:
licenseStrings
- the list of license string to set.- Returns:
- all license details of all the giving
- Throws:
IllegalArgumentException
- if any of is invalid.com.atlassian.extras.api.LicenseException
- if any of was null or could not be decoded
-
setLicenseNoEvent
Description copied from interface:JiraLicenseManager
Sets the current license of this instance.This is a special version of
JiraLicenseManager.setLicense(String)
that will not fire any event and is purely for use during a Data Import.- Specified by:
setLicenseNoEvent
in interfaceJiraLicenseManager
- Parameters:
licenseString
- the license string- Returns:
- the JIRA license of this instance, this shouldn't be null if the
license
is valid.
-
removeLicense
public void removeLicense(@Nonnull com.atlassian.application.api.ApplicationKey application) Description copied from interface:JiraLicenseManager
Removes the license that grants access to the passed application. Note: While this could potentially lead to losing access to another application the real world scenarios are:- You have just one ELA license with multiple applications
- You have multiple licenses with a single application
- Specified by:
removeLicense
in interfaceJiraLicenseManager
- Parameters:
application
- the key of the application to check.
-
removeLicenses
Description copied from interface:JiraLicenseManager
Removes passed licenses.- Specified by:
removeLicenses
in interfaceJiraLicenseManager
- Parameters:
licenses
- to be removed
-
isLicenseSet
public boolean isLicenseSet()Description copied from interface:JiraLicenseManager
Returns true if at least one license has beenset
.- Specified by:
isLicenseSet
in interfaceJiraLicenseManager
- See Also:
-
clearAndSetLicense
Description copied from interface:JiraLicenseManager
Removes all licenses from JIRA and replace them with the new license. If the new license cannot be decoded, this method will throw anIllegalArgumentException
.- Specified by:
clearAndSetLicense
in interfaceJiraLicenseManager
-
clearAndSetLicenseNoEvent
Description copied from interface:JiraLicenseManager
Removes all licenses from JIRA and replace them with the new license without raising an event. If the new license cannot be decoded, this method will throw anIllegalArgumentException
.- Specified by:
clearAndSetLicenseNoEvent
in interfaceJiraLicenseManager
-
onCacheClear
-
confirmProceedUnderEvaluationTerms
Description copied from interface:JiraLicenseManager
Records that the user has acknowledged that one or more of their licenses is out of maintenance. This triggers JIRA to grant a 30 day grace period whereby these licenses behave as 30 day evaluation licenses. This is so that admins are able to keep their JIRA running. This flag is reset automatically when all the invalid licenses are updated.- Specified by:
confirmProceedUnderEvaluationTerms
in interfaceJiraLicenseManager
- Parameters:
userName
- the name of the user that made the confirmation.- See Also:
-
hasLicenseTooOldForBuildConfirmationBeenDone
public boolean hasLicenseTooOldForBuildConfirmationBeenDone()Description copied from interface:JiraLicenseManager
Returns true if the support/maintenance period for this JIRA instance has been exceeded and an instance admin has acknowledged this fact. Typically, JIRA allows for a 30 day grace (evaluation) period.- Specified by:
hasLicenseTooOldForBuildConfirmationBeenDone
in interfaceJiraLicenseManager
- Returns:
true
if the licenses in use are too old for the current build number and this instance is in a maintenance grace period.- See Also:
-
subscribeToClearCache
Description copied from interface:JiraLicenseManager
Subscribe aConsumer
to be called after this manager's cache has been cleared.- Specified by:
subscribeToClearCache
in interfaceJiraLicenseManager
- Parameters:
consumer
-Consumer
that will be called after this manager's cache has been cleared.- See Also:
-
unSubscribeFromClearCache
Description copied from interface:JiraLicenseManager
Un-subscribe aConsumer
from being called after clearing of this manager's cache.- Specified by:
unSubscribeFromClearCache
in interfaceJiraLicenseManager
- Parameters:
consumer
-Consumer
to be un-subscribed from this manager.- See Also:
-
clearCache
public void clearCache()Description copied from interface:CachingComponent
Clear the cache within the component.- Specified by:
clearCache
in interfaceCachingComponent
-