Class LicenseChecker

java.lang.Object
com.vaadin.pro.licensechecker.LicenseChecker

public class LicenseChecker extends Object
  • Constructor Details

    • LicenseChecker

      public LicenseChecker()
  • Method Details

    • checkLicenseFromStaticBlock

      @Deprecated public static void checkLicenseFromStaticBlock(String productName, String productVersion)
    • checkLicenseFromStaticBlock

      public static void checkLicenseFromStaticBlock(String productName, String productVersion, BuildType buildType)
      Checks the license for the given product version from a static block.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: production or development
      Throws:
      ExceptionInInitializerError - if the license check fails
    • checkLicenseFromStaticBlock

      public static void checkLicenseFromStaticBlock(String productName, String productVersion, BuildType buildType, Capabilities capabilities)
      Checks the license for the given product version from a static block with the given capabilities (extra license checks).
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: production or development
      capabilities - the license checker capabilities to run.
      Throws:
      ExceptionInInitializerError - if the license check fails
    • checkLicense

      @Deprecated public static void checkLicense(String productName, String productVersion)
    • checkLicense

      public static void checkLicense(String productName, String productVersion, BuildType buildType)
      Checks the license for the given product version.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      Throws:
      LicenseException - if the license check fails
    • checkLicense

      public static void checkLicense(String productName, String productVersion, Capabilities capabilities, BuildType buildType)
      Checks the license for the given product version with the given capabilities (extra license checks).
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      capabilities - the license checker capabilities to run
      buildType - the type of build: development or production
      Throws:
      LicenseException - if the license check fails
    • checkLicense

      public static void checkLicense(String productName, String productVersion, BuildType buildType, Consumer<String> noKeyUrlHandler, String machineId, ProKey proKey, SubscriptionKey subscriptionKey, OfflineKey offlineKey)
      Checks the license for the given pro key and product version.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      machineId - the identifier of machine which owns pro key
      proKey - the pro key to be validated
      offlineKey - the offline key to be validated
      Throws:
      LicenseException - if the license check fails
    • checkLicense

      public static void checkLicense(String productName, String productVersion, BuildType buildType, Consumer<String> noKeyUrlHandler, String machineId, ProKey proKey, SubscriptionKey subscriptionKey, OfflineKey offlineKey, Capabilities capabilities)
      Checks the license for the given pro key and product version with the given capabilities (extra license checks).
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      machineId - the identifier of machine which owns pro key
      proKey - the pro key to be validated
      offlineKey - the offline key to be validated
      capabilities - the license checker capabilities to run.
      Throws:
      LicenseException - if the license check fails
    • checkLicense

      @Deprecated public static void checkLicense(String productName, String productVersion, Consumer<String> noKeyUrlHandler)
    • checkLicense

      public static void checkLicense(String productName, String productVersion, BuildType buildType, Consumer<String> noKeyUrlHandler)
      Checks the license for the given product version.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      Throws:
      LicenseException - if the license check fails
    • checkLicense

      public static void checkLicense(String productName, String productVersion, BuildType buildType, Consumer<String> noKeyUrlHandler, Capabilities capabilities)
      Checks the license for the given product version with the given capabilities (extra license checks).
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      capabilities - the license checker capabilities to run.
      Throws:
      LicenseException - if the license check fails
    • checkLicense

      public static void checkLicense(String productName, String productVersion, BuildType buildType, Consumer<String> noKeyUrlHandler, int timeoutKeyUrlHandler)
      Checks the license for the given product version.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      timeoutKeyUrlHandler - timeout for the key url handler
      Throws:
      LicenseException - if the license check fails
    • checkLicense

      public static void checkLicense(String productName, String productVersion, BuildType buildType, Consumer<String> noKeyUrlHandler, int timeoutKeyUrlHandler, Capabilities capabilities)
      Checks the license for the given product version with the given capabilities (extra license checks).
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      timeoutKeyUrlHandler - timeout for the key url handler
      capabilities - the license checker capabilities to run.
      Throws:
      LicenseException - if the license check fails
    • isValidLicense

      public static boolean isValidLicense(String productName, String productVersion, BuildType buildType)
      Checks the license for the given product version. Returns true if the license is valid, false otherwise.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      Returns:
      true if the license is valid, false otherwise
    • checkLicenseAsync

      @Deprecated public static void checkLicenseAsync(String productName, String productVersion, LicenseChecker.Callback callback)
    • checkLicenseAsync

      public static void checkLicenseAsync(String productName, String productVersion, BuildType buildType, LicenseChecker.Callback callback)
      Checks the license for the given product version in the background and invokes the callback when done.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      callback - the callback to invoke with the result
    • checkLicenseAsync

      public static void checkLicenseAsync(String productName, String productVersion, BuildType buildType, LicenseChecker.Callback callback, Capabilities capabilities)
      Checks the license for the given product version in the background and invokes the callback when done with the given capabilities (extra license checks).
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      callback - the callback to invoke with the result
      capabilities - the license checker capabilities to run.
    • checkLicenseAsync

      public static void checkLicenseAsync(String productName, String productVersion, BuildType buildType, LicenseChecker.Callback callback, Consumer<String> noKeyUrlHandler, String machineId, ProKey proKey, SubscriptionKey subscriptionKey, OfflineKey offlineKey)
      Checks the license for the given pro key and product version in the background and invokes the callback when done.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      callback - the callback to invoke with the result
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      machineId - the identifier of machine which owns pro key
      proKey - the pro key to be validated
      offlineKey - the offline key to be validated
      Throws:
      LicenseException - if the license check fails
    • checkLicenseAsync

      public static void checkLicenseAsync(String productName, String productVersion, BuildType buildType, LicenseChecker.Callback callback, Consumer<String> noKeyUrlHandler)
      Checks the license for the given product version in the background and invokes the callback when done.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      callback - the callback to invoke with the result
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
    • checkLicenseAsync

      public static void checkLicenseAsync(String productName, String productVersion, BuildType buildType, LicenseChecker.Callback callback, Consumer<String> noKeyUrlHandler, Capabilities capabilities)
      Checks the license for the given product version in the background and invokes the callback when done with the given capabilities (extra license checks).
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      callback - the callback to invoke with the result
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      capabilities - the license checker capabilities to run.
    • checkLicenseAsync

      public static void checkLicenseAsync(String productName, String productVersion, BuildType buildType, LicenseChecker.Callback callback, Consumer<String> noKeyUrlHandler, int timeoutKeyUrlHandler, Capabilities capabilities)
      Checks the license for the given product version in the background and invokes the callback when done with the given capabilities (extra license checks).
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      callback - the callback to invoke with the result
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is available.
      timeoutKeyUrlHandler - timeout for the key url handler
      capabilities - the license checker capabilities to run.
    • checkLicenseAsync

      public static void checkLicenseAsync(String productName, String productVersion, BuildType buildType, LicenseChecker.Callback callback, Consumer<String> noKeyUrlHandler, int timeoutKeyUrlHandler)
      Checks the license for the given product version in the background and invokes the callback when done.
      Parameters:
      productName - the name of the product to check
      productVersion - the version of the product to check
      buildType - the type of build: development or production
      callback - the callback to invoke with the result
      noKeyUrlHandler - a handler that is invoked to open the vaadin.com URL to download the key file. Used when no key file is avialable.
      timeoutKeyUrlHandler - timeout for the key url handler
    • startPreTrial

      public static PreTrial startPreTrial() throws PreTrialCreationException
      Starts a pre-trial period by using the default machine ID and a predefined user key.

      If a pre-trial is already started it returns the state with updated remaining days. Otherwise, if the pre-trial has expired but cannot yet be renewed a PreTrialCreationException.Expired is thrown.

      Returns:
      detail about the pre-trial.
      Throws:
      PreTrialCreationException.Expired - if the pre-trial is expired and cannot yet be renewed
      PreTrialCreationException - if the License Server prevents the start of a pre-trial
    • startPreTrial

      public static PreTrial startPreTrial(String machineId, String userKey) throws PreTrialCreationException
      Starts a pre-trial period by using given machine ID and given user key.

      If a pre-trial is already started it returns the state with updated remaining days. Otherwise, if the pre-trial has expired but cannot yet be renewed a PreTrialCreationException.Expired is thrown.

      Parameters:
      machineId - the identifier of machine which owns pro key
      userKey - the user key
      Returns:
      detail about the pre-trial.
      Throws:
      PreTrialCreationException.Expired - if the pre-trial is expired and cannot yet be renewed
      PreTrialCreationException - if the License Server prevents the start of a pre-trial
    • getPreTrial

      public static Optional<PreTrial> getPreTrial(Product product)
      Gets the status of a pre-trial period for the given product using the default machine ID.

      It returns the state of the pre-trial with information about remaining days.

      Parameters:
      product - the product to validate
      Returns:
      detail about the pre-trial.
      Throws:
      PreTrialStatusCheckException - if pre-trial status cannot be checked against the License Server.
    • getPreTrial

      public static Optional<PreTrial> getPreTrial(Product product, String machineId)
      Gets the status of a pre-trial period for the given product and machineId.

      It returns the state of the pre-trial with information about remaining days.

      Parameters:
      product - the product to validate
      machineId - the identifier of machine which owns pro key
      Returns:
      detail about the pre-trial.
      Throws:
      PreTrialStatusCheckException - if pre-trial status cannot be checked against the License Server.
    • setStrictOffline

      public static void setStrictOffline(boolean strictOffline)