Package com.atlassian.jira.license
Interface JiraLicenseManager
- All Known Implementing Classes:
JiraLicenseManagerImpl
public interface JiraLicenseManager
This manager is the primary interface to performing license-related read/write operations, and to reading the
license state of
applications.- Since:
- 4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclearAndSetLicense(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.voidconfirmProceedUnderEvaluationTerms(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 key) Return theLicenseDetailsassociated with the passedApplicationKey.getLicense(String licenseString) Returns theLicenseDetailscorresponding 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.booleanReturns true if the support/maintenance period for this JIRA instance has been exceeded and an instance admin has acknowledged this fact.booleanisDecodeable(String licenseString) This returns true if the provided licence string can be decoded into a valid licencebooleanisLicensed(com.atlassian.application.api.ApplicationKey key) Returnstrueif the given application is licensed.booleanReturns true if at least one license has beenset.voidremoveLicense(com.atlassian.application.api.ApplicationKey application) Removes the license that grants access to the passed application.voidremoveLicenses(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.voidsubscribeToClearCache(Consumer<Void> consumer) Subscribe aConsumerto be called after this manager's cache has been cleared.voidunSubscribeFromClearCache(Consumer<Void> consumer) Un-subscribe aConsumerfrom being called after clearing of this manager's cache.
-
Method Details
-
getServerId
Returns the server ID of this JIRA instance, creating it if necessary.- Returns:
- see above
-
getLicense
Returns theLicenseDetailscorresponding to the given license string after decoding, or throws an exception if the license string is invalid or cannot be decoded.- Parameters:
licenseString- the license string.- Returns:
- the
LicenseDetailsfor license encoded by the given string. - Throws:
com.atlassian.extras.api.LicenseException- if the stored license string cannot be decoded- See Also:
-
isDecodeable(String)StringUtils.isBlank(CharSequence)
-
isLicensed
boolean isLicensed(@Nonnull com.atlassian.application.api.ApplicationKey key) Returnstrueif the given application is licensed.- Parameters:
key- the application- Returns:
trueif the given application is licensed.- Since:
- 7.0
-
isDecodeable
This returns true if the provided licence string can be decoded into a valid licence- Parameters:
licenseString- the license string- Returns:
- true if it is can be decoded and false otherwise
-
setLicense
Sets the current license of this instance.Note that this method will fire a
LicenseChangedEvent.- Parameters:
licenseString- the license string- Returns:
- the JIRA license of this instance, this shouldn't be null if the
licenseis valid.
-
setLicenses
Sets the current licenses of this instance.Note that this method will fire a
LicenseChangedEvent.- Parameters:
licenseStrings- the list of license string to set.- Returns:
- Jira licenses of this instance, this shouldn't be null if
licenseStringsare valid.
-
setLicenseNoEvent
Sets the current license of this instance.This is a special version of
setLicense(String)that will not fire any event and is purely for use during a Data Import.- Parameters:
licenseString- the license string- Returns:
- the JIRA license of this instance, this shouldn't be null if the
licenseis valid.
-
confirmProceedUnderEvaluationTerms
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.- Parameters:
userName- the name of the user that made the confirmation.- See Also:
-
hasLicenseTooOldForBuildConfirmationBeenDone
boolean hasLicenseTooOldForBuildConfirmationBeenDone()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.- Returns:
trueif the licenses in use are too old for the current build number and this instance is in a maintenance grace period.- Since:
- 7.0
- See Also:
-
getLicenses
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.
- Returns:
- all product licenses installed in this instance.
- Since:
- 6.3
-
getAllLicensedApplicationKeys
Retrieve a Set of all installed product license's keys in this instance.- Returns:
- all the installed product license's keys in this instance.
- Since:
- 7.0
-
getSupportEntitlementNumbers
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.- 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.
- Since:
- 7.0
- See Also:
-
getLicense
io.atlassian.fugue.Option<LicenseDetails> getLicense(@Nonnull com.atlassian.application.api.ApplicationKey key) Return theLicenseDetailsassociated with the passedApplicationKey.- Parameters:
key- theApplicationKeyto query.- Returns:
- the
LicenseDetailsassociated with the passed application key orOption.none()if no such application exists. - Since:
- 7.0
-
clearAndSetLicense
Removes all licenses from JIRA and replace them with the new license. If the new license cannot be decoded, this method will throw anIllegalArgumentException.- Throws:
IllegalArgumentException- if the license cannot be decoded.- Since:
- 6.4
-
clearAndSetLicenseNoEvent
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.- Throws:
IllegalArgumentException- if the license cannot be decoded.- Since:
- 6.4
-
removeLicense
void removeLicense(@Nonnull com.atlassian.application.api.ApplicationKey application) throws IllegalStateException 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
- Parameters:
application- the key of the application to check.- Throws:
IllegalStateException- when removal of a license that would leave JIRA inoperable. For example, removing the last license is not allowed.- Since:
- 7.0
-
removeLicenses
void removeLicenses(@Nonnull Iterable<? extends LicenseDetails> licenses) throws IllegalStateException Removes passed licenses.- Parameters:
licenses- to be removed- Throws:
IllegalStateException- when removal of licenses that would leave JIRA inoperable. For example, removing the last license is not allowed.- Since:
- 7.0
-
isLicenseSet
boolean isLicenseSet()Returns true if at least one license has beenset.- Since:
- 7.0
- See Also:
-
subscribeToClearCache
Subscribe aConsumerto be called after this manager's cache has been cleared.- Parameters:
consumer-Consumerthat will be called after this manager's cache has been cleared.- Since:
- 7.0
- See Also:
-
unSubscribeFromClearCache
Un-subscribe aConsumerfrom being called after clearing of this manager's cache.- Parameters:
consumer-Consumerto be un-subscribed from this manager.- Since:
- 7.0
- See Also:
-