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 Details

    • getServerId

      @Nonnull String getServerId()
      Returns the server ID of this JIRA instance, creating it if necessary.
      Returns:
      see above
    • getLicense

      @Nonnull LicenseDetails getLicense(@Nonnull 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:
      the LicenseDetails for license encoded by the given string.
      Throws:
      com.atlassian.extras.api.LicenseException - if the stored license string cannot be decoded
      See Also:
    • isLicensed

      boolean isLicensed(@Nonnull com.atlassian.application.api.ApplicationKey key)
      Returns true if the given application is licensed.
      Parameters:
      key - the application
      Returns:
      true if the given application is licensed.
      Since:
      7.0
    • isDecodeable

      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
    • setLicense

      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.
    • setLicenses

      Set<LicenseDetails> setLicenses(Collection<String> licenseStrings)
      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 licenseStrings are valid.
    • setLicenseNoEvent

      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.
    • confirmProceedUnderEvaluationTerms

      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.
      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:
      true if 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

      @Nonnull 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.
      Since:
      6.3
    • getAllLicensedApplicationKeys

      @Nonnull Set<com.atlassian.application.api.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.
      Since:
      7.0
    • getSupportEntitlementNumbers

      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.
      Since:
      7.0
      See Also:
    • getLicense

      io.atlassian.fugue.Option<LicenseDetails> getLicense(@Nonnull com.atlassian.application.api.ApplicationKey key)
      Return the LicenseDetails associated with the passed ApplicationKey.
      Parameters:
      key - the ApplicationKey to query.
      Returns:
      the LicenseDetails associated with the passed application key or Option.none() if no such application exists.
      Since:
      7.0
    • clearAndSetLicense

      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.
      Since:
      6.4
    • clearAndSetLicenseNoEvent

      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.
      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 been set.
      Since:
      7.0
      See Also:
    • subscribeToClearCache

      @Internal void subscribeToClearCache(@Nonnull 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.
      Since:
      7.0
      See Also:
    • unSubscribeFromClearCache

      @Internal void unSubscribeFromClearCache(@Nonnull 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.
      Since:
      7.0
      See Also: