Class JBAClientImpl
- java.lang.Object
-
- jetbrains.buildServer.license.jba.JBAClientImpl
-
-
Constructor Summary
Constructors Constructor Description JBAClientImpl(ProductKeyPairStorage productKeyPairStorage, BuildServerEx server, HTTPRequestBuilder.RequestHandler requestHandler, ExecutorServices executorServices, CustomDataStorageManager customDataStorageManager, ProjectManager projectManager, EventDispatcher<BuildServerListener> eventDispatcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoPeriodicalVerification()Attempts to update current JWT license by making a call to the JBA endpoints.StringencodeLicense(String serializedLicense)Encodes license with SHA512+Base64URL to send it to JBA endpoints.URLgetActivationUrl()Generates and returns product activation URL Representation: LICENSE_URL/activate?product=...&instPubKey=...&selfSign=...URLgetDeactivationUrl(JwtLicenseKey licenseToDeactivate)Generates and returns product deactivation URL Representation: LICENSE_URL/license/deactivate?product=...&instPubKey=...&selfSign=...&licenseKey=...DategetGracePeriodEnd()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.StringgetLastUpdateErrorMessage()Returns human-readable description of last license verification error or null, if last verification was successful.longgetLastUpdateTime()Returns last license update time if the license is configured.URLgetTeamUrl(JwtLicenseKey licenseKey)Returns URL to the JBA team, which owns given license key.voidhandleLicenseKeysChanged()voidlinkAgents()Attempts to send data about existing license keys with JetBrains Accounts.voidstartLicenseObtain()Launches a periodical task which calls JBA and checks, whether user has completed the license activation on their side.voidstopLicenseObtain()Forcibly stops the current license obtain task.
-
-
-
Constructor Detail
-
JBAClientImpl
public JBAClientImpl(@NotNull ProductKeyPairStorage productKeyPairStorage, @NotNull BuildServerEx server, @NotNull HTTPRequestBuilder.RequestHandler requestHandler, @NotNull ExecutorServices executorServices, @NotNull CustomDataStorageManager customDataStorageManager, @NotNull ProjectManager projectManager, @NotNull EventDispatcher<BuildServerListener> eventDispatcher)
-
-
Method Detail
-
doPeriodicalVerification
public void doPeriodicalVerification() throws JwtLicenseVerificationExceptionDescription copied from interface:JBAClientAttempts to update current JWT license by making a call to the JBA endpoints. If the license was updated, persists it inLicenseList- Specified by:
doPeriodicalVerificationin interfaceJBAClient- Throws:
JwtLicenseVerificationException- on any verification or connection issues
-
linkAgents
public void linkAgents() throws LicensesLinkageExceptionDescription copied from interface:JBAClientAttempts to send data about existing license keys with JetBrains Accounts. This allows JBA to create a license with all purchased agents beforehand.- Specified by:
linkAgentsin interfaceJBAClient- Throws:
LicensesLinkageException- on any linkage or connection issues
-
getActivationUrl
@NotNull public URL getActivationUrl()
Description copied from interface:JBAClientGenerates and returns product activation URL Representation: LICENSE_URL/activate?product=...&instPubKey=...&selfSign=...- Specified by:
getActivationUrlin interfaceJBAClient- Returns:
- see above
-
getDeactivationUrl
@NotNull public URL getDeactivationUrl(@NotNull JwtLicenseKey licenseToDeactivate)
Description copied from interface:JBAClientGenerates and returns product deactivation URL Representation: LICENSE_URL/license/deactivate?product=...&instPubKey=...&selfSign=...&licenseKey=...- Specified by:
getDeactivationUrlin interfaceJBAClient- Parameters:
licenseToDeactivate- license to deactivate- Returns:
- see above
-
getTeamUrl
@Nullable public URL getTeamUrl(@NotNull JwtLicenseKey licenseKey)
Description copied from interface:JBAClientReturns 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.- Specified by:
getTeamUrlin interfaceJBAClient- Parameters:
licenseKey- license key- Returns:
- see above
-
getGracePeriodEnd
@Nullable public Date getGracePeriodEnd()
Description copied from interface:JBAClientIf 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.
- Specified by:
getGracePeriodEndin interfaceJBAClient- Returns:
- see above
-
getLastUpdateTime
public long getLastUpdateTime()
Description copied from interface:JBAClientReturns last license update time if the license is configured. Returns -1 if no JWT license is present, or it was not updated yet.- Specified by:
getLastUpdateTimein interfaceJBAClient- Returns:
- see above
-
getLastUpdateErrorMessage
@Nullable public String getLastUpdateErrorMessage()
Description copied from interface:JBAClientReturns human-readable description of last license verification error or null, if last verification was successful.- Specified by:
getLastUpdateErrorMessagein interfaceJBAClient- Returns:
- see above
-
startLicenseObtain
public void startLicenseObtain()
Description copied from interface:JBAClientLaunches 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.
- Specified by:
startLicenseObtainin interfaceJBAClient
-
stopLicenseObtain
public void stopLicenseObtain()
Description copied from interface:JBAClientForcibly stops the current license obtain task. Does nothing if no obtain task is running.- Specified by:
stopLicenseObtainin interfaceJBAClient- See Also:
JBAClient.startLicenseObtain()
-
handleLicenseKeysChanged
public void handleLicenseKeysChanged()
-
-