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 void
doPeriodicalVerification()
Attempts to update current JWT license by making a call to the JBA endpoints.String
encodeLicense(String serializedLicense)
Encodes license with SHA512+Base64URL to send it to 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
handleLicenseKeysChanged()
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.
-
-
-
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 JwtLicenseVerificationException
Description copied from interface:JBAClient
Attempts to update current JWT license by making a call to the JBA endpoints. If the license was updated, persists it inLicenseList
- Specified by:
doPeriodicalVerification
in interfaceJBAClient
- Throws:
JwtLicenseVerificationException
- on any verification or connection issues
-
linkAgents
public void linkAgents() throws LicensesLinkageException
Description copied from interface:JBAClient
Attempts to send data about existing license keys with JetBrains Accounts. This allows JBA to create a license with all purchased agents beforehand.- Specified by:
linkAgents
in interfaceJBAClient
- Throws:
LicensesLinkageException
- on any linkage or connection issues
-
getActivationUrl
@NotNull public URL getActivationUrl()
Description copied from interface:JBAClient
Generates and returns product activation URL Representation: LICENSE_URL/activate?product=...&instPubKey=...&selfSign=...- Specified by:
getActivationUrl
in interfaceJBAClient
- Returns:
- see above
-
getDeactivationUrl
@NotNull public URL getDeactivationUrl(@NotNull JwtLicenseKey licenseToDeactivate)
Description copied from interface:JBAClient
Generates and returns product deactivation URL Representation: LICENSE_URL/license/deactivate?product=...&instPubKey=...&selfSign=...&licenseKey=...- Specified by:
getDeactivationUrl
in interfaceJBAClient
- Parameters:
licenseToDeactivate
- license to deactivate- Returns:
- see above
-
getTeamUrl
@Nullable public URL getTeamUrl(@NotNull JwtLicenseKey licenseKey)
Description copied from interface:JBAClient
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.- Specified by:
getTeamUrl
in interfaceJBAClient
- Parameters:
licenseKey
- license key- Returns:
- see above
-
getGracePeriodEnd
@Nullable public Date getGracePeriodEnd()
Description copied from interface:JBAClient
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.
- Specified by:
getGracePeriodEnd
in interfaceJBAClient
- Returns:
- see above
-
getLastUpdateTime
public long getLastUpdateTime()
Description copied from interface:JBAClient
Returns 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:
getLastUpdateTime
in interfaceJBAClient
- Returns:
- see above
-
getLastUpdateErrorMessage
@Nullable public String getLastUpdateErrorMessage()
Description copied from interface:JBAClient
Returns human-readable description of last license verification error or null, if last verification was successful.- Specified by:
getLastUpdateErrorMessage
in interfaceJBAClient
- Returns:
- see above
-
startLicenseObtain
public void startLicenseObtain()
Description copied from interface:JBAClient
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.
- Specified by:
startLicenseObtain
in interfaceJBAClient
-
stopLicenseObtain
public void stopLicenseObtain()
Description copied from interface:JBAClient
Forcibly stops the current license obtain task. Does nothing if no obtain task is running.- Specified by:
stopLicenseObtain
in interfaceJBAClient
- See Also:
JBAClient.startLicenseObtain()
-
handleLicenseKeysChanged
public void handleLicenseKeysChanged()
-
-