Class XPackLicenseState

java.lang.Object
org.elasticsearch.license.XPackLicenseState

public class XPackLicenseState extends Object
A holder for the current state of the license for all xpack features.
  • Constructor Details

  • Method Details

    • addListener

      public void addListener(LicenseStateListener listener)
      Add a listener to be notified on license change
    • removeListener

      public void removeListener(LicenseStateListener listener)
      Remove a listener
    • getOperationMode

      public License.OperationMode getOperationMode()
      Return the current license type.
    • isActive

      public boolean isActive()
      Return true if the license is currently within its time boundaries, false otherwise.
    • statusDescription

      public String statusDescription()
    • getLastUsed

      public Map<XPackLicenseState.FeatureUsage,Long> getLastUsed()
      Returns a mapping of gold+ features to the last time that feature was used. Note that if a feature has not been used, it will not appear in the map.
    • isFipsAllowedForOperationMode

      public static boolean isFipsAllowedForOperationMode(License.OperationMode operationMode)
    • copyCurrentLicenseState

      public XPackLicenseState copyCurrentLicenseState()
      Creates a copy of this object based on the state at the time the method was called. The returned object will not be modified by a license update/expiration so it can be used to make multiple method calls on the license state safely. This object should not be long lived but instead used within a method when a consistent view of the license state is needed for multiple interactions with the license state.
    • isAllowedByLicense

      @Deprecated public boolean isAllowedByLicense(License.OperationMode minimumMode, boolean needActive)
      Deprecated.
      Test whether a feature is allowed by the status of license.
      Parameters:
      minimumMode - The minimum license to meet or exceed
      needActive - Whether current license needs to be active
      Returns:
      true if feature is allowed, otherwise false
    • isAllowedByLicense

      public boolean isAllowedByLicense(License.OperationMode minimumMode)
      A convenient method to test whether a feature is by license status.
      Parameters:
      minimumMode - The minimum license to meet or exceed
      See Also: