public interface

JiraLicenseManager

com.atlassian.jira.license.JiraLicenseManager
Known Indirect Subclasses

Class Overview

This manager is the primary interface to performing license-related read/write operations, and to reading the license state of com.atlassian.application.api.ApplicationKey applications.

Summary

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 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 key)
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 Iterable<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 key)
Returns true if the given application is licensed.
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.
@Internal void subscribeToClearCache(Consumer<Void> consumer)
Subscribe a Consumer to be called after this manager's cache has been cleared.
@Internal void unSubscribeFromClearCache(Consumer<Void> consumer)
Un-subscribe a Consumer from being called after clearing of this manager's cache.

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.

Throws
IllegalArgumentException if the license cannot be decoded.

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.

Throws
IllegalArgumentException if the license cannot be decoded.

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 key)

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

Parameters
key 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
Throws
LicenseException if the stored license string cannot be decoded

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

See Also

public boolean isLicensed (ApplicationKey key)

Returns true if the given application is licensed.

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

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.
Throws
IllegalStateException when removal of a license that would leave JIRA inoperable. For example, removing the last license is not allowed.

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

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.

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.

@Internal public void subscribeToClearCache (Consumer<Void> consumer)

@Internal

This method is an internal implementation detail and will change without notice.

Clients that depend on @Internal classes and interfaces can not expect to be compatible with any version other than the version they were compiled against (even minor version and milestone releases may break binary compatibility with respect to @Internal elements).

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.

@Internal public void unSubscribeFromClearCache (Consumer<Void> consumer)

@Internal

This method is an internal implementation detail and will change without notice.

Clients that depend on @Internal classes and interfaces can not expect to be compatible with any version other than the version they were compiled against (even minor version and milestone releases may break binary compatibility with respect to @Internal elements).

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

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