Interface JBAClient

  • All Known Implementing Classes:
    JBAClientImpl, SecureJBAClient

    public interface JBAClient
    Represents a client for communication with JetBrains Accounts. The main purpose is actions with JWT licenses.
    Author:
    Daniil.Boger
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void doPeriodicalVerification()
      Attempts to update current JWT license by making a call to the JBA endpoints.
      URL getActivationUrl()
      Generates and returns product activation URL Representation: LICENSE_URL/activate?product=...&instPubKey=...&selfSign=...
      URL getDeactivationUrl​(JwtLicenseKey licenseToDeactivate)
      Generates and returns product deactivation URL Representation: LICENSE_URL/license/deactivate?product=...&instPubKey=...&selfSign=...&licenseKey=...
      Date getGracePeriodEnd()
      If the current JWT license was invalidated by the JBA verification process, but it's not suspended yet on TeamCity's side, returns the date, when this license will become invalid.
      String getLastUpdateErrorMessage()
      Returns human-readable description of last license verification error or null, if last verification was successful.
      long getLastUpdateTime()
      Returns last license update time if the license is configured.
      URL getTeamUrl​(JwtLicenseKey licenseKey)
      Returns URL to the JBA team, which owns given license key.
      void linkAgents()
      Attempts to send data about existing license keys with JetBrains Accounts.
      void startLicenseObtain()
      Launches a periodical task which calls JBA and checks, whether user has completed the license activation on their side.
      void stopLicenseObtain()
      Forcibly stops the current license obtain task.
    • Method Detail

      • linkAgents

        void linkAgents()
                 throws LicensesLinkageException
        Attempts to send data about existing license keys with JetBrains Accounts. This allows JBA to create a license with all purchased agents beforehand.
        Throws:
        LicensesLinkageException - on any linkage or connection issues
      • getActivationUrl

        @NotNull
        URL getActivationUrl()
        Generates and returns product activation URL Representation: LICENSE_URL/activate?product=...&instPubKey=...&selfSign=...
        Returns:
        see above
      • getDeactivationUrl

        @NotNull
        URL getDeactivationUrl​(@NotNull
                               JwtLicenseKey licenseToDeactivate)
        Generates and returns product deactivation URL Representation: LICENSE_URL/license/deactivate?product=...&instPubKey=...&selfSign=...&licenseKey=...
        Parameters:
        licenseToDeactivate - license to deactivate
        Returns:
        see above
      • getTeamUrl

        @Nullable
        URL getTeamUrl​(@NotNull
                       JwtLicenseKey licenseKey)
        Returns URL to the JBA team, which owns given license key. Returns null if given key has invalid data, from which this URL cannot be determined.
        Parameters:
        licenseKey - license key
        Returns:
        see above
      • getGracePeriodEnd

        @Nullable
        Date getGracePeriodEnd()
        If the current JWT license was invalidated by the JBA verification process, but it's not suspended yet on TeamCity's side, returns the date, when this license will become invalid.

        Otherwise, returns null.

        Returns:
        see above
      • getLastUpdateTime

        long getLastUpdateTime()
        Returns last license update time if the license is configured. Returns -1 if no JWT license is present, or it was not updated yet.
        Returns:
        see above
      • getLastUpdateErrorMessage

        @Nullable
        String getLastUpdateErrorMessage()
        Returns human-readable description of last license verification error or null, if last verification was successful.
        Returns:
        see above
      • startLicenseObtain

        void startLicenseObtain()
        Launches a periodical task which calls JBA and checks, whether user has completed the license activation on their side. If the activation is completed, this task obtains the license and installs it into TeamCity. This task is stopped when encountered errors that differ from "unavailable license" reason. Other stop conditions (e.g. max attempts, license already exists) may apply.

        There can be only one obtain task at a time. If called when a task is active, stops the current task and launches a new one.

      • stopLicenseObtain

        void stopLicenseObtain()
        Forcibly stops the current license obtain task. Does nothing if no obtain task is running.
        See Also:
        startLicenseObtain()