public class

JiraLicenseManagerImpl

extends Object
implements CachingComponent JiraLicenseManager
java.lang.Object
   ↳ com.atlassian.jira.license.JiraLicenseManagerImpl

Summary

Public Constructors
JiraLicenseManagerImpl(SIDManager sidManager, EventPublisher eventPublisher, MultiLicenseStore multiLicenseStore, FeatureManager featureManager, LicenseDetailsFactory licenseDetailsFactory, ApplicationProperties applicationProperties, CacheManager cacheManager)
Public Methods
void clearAndSetLicense(String licenseString)
Removes all licenses from JIRA and replace them with the new license.
LicenseDetails clearAndSetLicenseNoEvent(String licenseString)
Removes all licenses from JIRA and replace them with the new license without raising an event.
void clearCache()
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.
@Nonnull Set<ApplicationKey> getAllLicensedApplicationKeys()
Retrieve a Set of all installed product license's keys in this instance.
Option<LicenseDetails> getLicense(ApplicationKey application)
Return the LicenseDetails associated with the passed com.atlassian.application.api.ApplicationKey.
@Nonnull LicenseDetails getLicense(String licenseString)
Returns the LicenseDetails corresponding to the given license string after decoding, or throws an exception if the license string is invalid or cannot be decoded.
@Nonnull List<LicenseDetails> getLicenses()
Retrieve a collection of all product licenses installed in this instance.
String getServerId()
Gets the server ID of the JIRA instance, creates it if it doesn't already exists.
SortedSet<String> getSupportEntitlementNumbers()
Retrieves the SEN (Support Entitlement Number) of all installed licenses and orders them in a consistent manner.
boolean hasLicenseTooOldForBuildConfirmationBeenDone()
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 licence
boolean isLicenseSet()
Returns true if at least one license has been set.
boolean isLicensed(ApplicationKey application)
Returns true if the given application is licensed.
@EventListener void onCacheClear(ClearCacheEvent clearEvent)
void removeLicense(ApplicationKey application)
Removes the license that grants access to the passed application.
void removeLicenses(Iterable<? extends LicenseDetails> licenses)
Removes passed licenses.
LicenseDetails setLicense(String licenseString)
Sets the current license of this instance.
LicenseDetails setLicenseNoEvent(String licenseString)
Sets the current license of this instance.
void subscribeToClearCache(Consumer<Void> consumer)
Subscribe a Consumer to be called after this manager's cache has been cleared.
void unSubscribeFromClearCache(Consumer<Void> consumer)
Un-subscribe a Consumer from being called after clearing of this manager's cache.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.CachingComponent
From interface com.atlassian.jira.license.JiraLicenseManager

Public Constructors

public JiraLicenseManagerImpl (SIDManager sidManager, EventPublisher eventPublisher, MultiLicenseStore multiLicenseStore, FeatureManager featureManager, LicenseDetailsFactory licenseDetailsFactory, ApplicationProperties applicationProperties, CacheManager cacheManager)

Public Methods

public void clearAndSetLicense (String licenseString)

Removes all licenses from JIRA and replace them with the new license. If the new license cannot be decoded, this method will throw an IllegalArgumentException.

public LicenseDetails clearAndSetLicenseNoEvent (String licenseString)

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 an IllegalArgumentException.

public void clearCache ()

Clear the cache within the component.

public void confirmProceedUnderEvaluationTerms (String userName)

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.

@Nonnull public Set<ApplicationKey> 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.

public Option<LicenseDetails> getLicense (ApplicationKey application)

Return the LicenseDetails associated with the passed com.atlassian.application.api.ApplicationKey.

Parameters
application the ApplicationKey to query.
Returns
  • the LicenseDetails associated with the passed application key or none() if no such application exists.

@Nonnull public LicenseDetails getLicense (String licenseString)

Returns the LicenseDetails corresponding 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

@Nonnull public List<LicenseDetails> 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.

public String getServerId ()

Gets the server ID of the JIRA instance, creates it if it doesn't already exists.

Returns
  • the server ID for this JIRA instance.

public SortedSet<String> 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.

public 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
  • true if the licenses in use are too old for the current build number and this instance is in a maintenance grace period.

public boolean isDecodeable (String licenseString)

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

public boolean isLicenseSet ()

Returns true if at least one license has been set.

public boolean isLicensed (ApplicationKey application)

Returns true if the given application is licensed.

Parameters
application the application
Returns
  • true if the given application is licensed.

@EventListener public void onCacheClear (ClearCacheEvent clearEvent)

public void removeLicense (ApplicationKey application)

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.

public void removeLicenses (Iterable<? extends LicenseDetails> licenses)

Removes passed licenses.

Parameters
licenses to be removed

public LicenseDetails setLicense (String licenseString)

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 license is valid.

public LicenseDetails setLicenseNoEvent (String licenseString)

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 license is valid.

public void subscribeToClearCache (Consumer<Void> consumer)

Subscribe a Consumer to be called after this manager's cache has been cleared.

Parameters
consumer Consumer that will be called after this manager's cache has been cleared.

public void unSubscribeFromClearCache (Consumer<Void> consumer)

Un-subscribe a Consumer from being called after clearing of this manager's cache.

Parameters
consumer Consumer to be un-subscribed from this manager.