Package jetbrains.buildServer.license
Class ServerLicenseManager
- java.lang.Object
-
- jetbrains.buildServer.license.ServerLicenseManager
-
- All Implemented Interfaces:
LicenseTokenManager,LicenseKeysManager
public class ServerLicenseManager extends Object implements LicenseTokenManager, LicenseKeysManager
- Author:
- yole
-
-
Field Summary
Fields Modifier and Type Field Description static StringJWT_FEATURE_TOGGLEstatic StringLICENSES_FILE
-
Constructor Summary
Constructors Constructor Description ServerLicenseManager(SQLRunnerEx sqlRunner, ServerPaths paths, SecurityContextEx securityContext, ServerResponsibility serverResponsibility, ProjectManagerEx projectManager, FileWatcherFactory fileWatcherFactory, EventDispatcher<BuildServerListener> serverEventDispatcher, ServiceLocator serviceLocator, SettingsPersister settingsPersister, ExecutorServices executorServices)
-
Method Summary
-
-
-
Field Detail
-
LICENSES_FILE
public static final String LICENSES_FILE
- See Also:
- Constant Field Values
-
JWT_FEATURE_TOGGLE
public static final String JWT_FEATURE_TOGGLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServerLicenseManager
public ServerLicenseManager(@NotNull SQLRunnerEx sqlRunner, @NotNull ServerPaths paths, @NotNull SecurityContextEx securityContext, @NotNull ServerResponsibility serverResponsibility, @NotNull ProjectManagerEx projectManager, @NotNull FileWatcherFactory fileWatcherFactory, @NotNull EventDispatcher<BuildServerListener> serverEventDispatcher, @NotNull ServiceLocator serviceLocator, @NotNull SettingsPersister settingsPersister, @NotNull ExecutorServices executorServices)
-
-
Method Detail
-
getAuthorizedAgentsCountProvider
public AuthorizedAgentsCountProvider getAuthorizedAgentsCountProvider()
-
shutdown
public void shutdown()
-
getLicensedAgentsCount
public int getLicensedAgentsCount()
-
getLicensedBuildTypesCount
public int getLicensedBuildTypesCount()
-
getLicensingPolicy
@NotNull public LicensingPolicyEx getLicensingPolicy()
- Specified by:
getLicensingPolicyin interfaceLicenseKeysManager
-
updateLicenses
public void updateLicenses()
-
markJwtLicenseAsExpiredIfNeeded
public void markJwtLicenseAsExpiredIfNeeded(@NotNull JwtLicenseKey key)
-
addKeys
@NotNull public List<LicenseKey> addKeys(@NotNull List<String> keys) throws PersistFailedException
- Specified by:
addKeysin interfaceLicenseKeysManager- Throws:
PersistFailedException
-
removeKey
public void removeKey(@NotNull String key) throws PersistFailedExceptionDescription copied from interface:LicenseKeysManagerRemoves a single key.- Specified by:
removeKeyin interfaceLicenseKeysManager- Parameters:
key- a key to remove- Throws:
PersistFailedException- in case of error saving license keys on disk
-
removeAllKeys
public void removeAllKeys(@NotNull List<String> keys) throws PersistFailedExceptionDescription copied from interface:LicenseKeysManagerRemoves all of the provided keys. In case of any error no keys will be removed.- Specified by:
removeAllKeysin interfaceLicenseKeysManager- Parameters:
keys- keys to remove- Throws:
PersistFailedException- in case of error saving license keys on disk
-
addJwtKey
@NotNull public LicenseKey addJwtKey(@NotNull String key) throws PersistFailedException, InvalidLicenseKeyException
Description copied from interface:LicenseKeysManagerAdds JWT key.- Specified by:
addJwtKeyin interfaceLicenseKeysManager- Returns:
- parsed license key
- Throws:
PersistFailedExceptionInvalidLicenseKeyException
-
removeJwtKey
public void removeJwtKey() throws PersistFailedExceptionDescription copied from interface:LicenseKeysManagerRemoves JWT key.- Specified by:
removeJwtKeyin interfaceLicenseKeysManager- Throws:
PersistFailedException- in case of error saving license keys on disk
-
validateKeys
@NotNull public List<LicenseKey> validateKeys(@NotNull List<String> keys)
- Specified by:
validateKeysin interfaceLicenseKeysManager
-
addListener
public void addListener(@NotNull LicenseKeysListener listener)Description copied from interface:LicenseKeysManagerAdds listener to license keys manager- Specified by:
addListenerin interfaceLicenseKeysManager- Parameters:
listener- listener
-
removeListener
public void removeListener(@NotNull LicenseKeysListener listener)Description copied from interface:LicenseKeysManagerRemoves listener from the license keys manager- Specified by:
removeListenerin interfaceLicenseKeysManager- Parameters:
listener- listener
-
hasInvalidKeys
public static boolean hasInvalidKeys(@NotNull List<LicenseKey> addedKeys)
-
getLicenseList
@NotNull public LicenseList getLicenseList()
- Specified by:
getLicenseListin interfaceLicenseKeysManager
-
getAuthorizedAgentsCount
public int getAuthorizedAgentsCount()
-
getDaysToLicenseExpiration
public int getDaysToLicenseExpiration()
-
grantLicense
public void grantLicense(@NotNull BuildAgentEx agent) throws LicenseNotGrantedExceptionDescription copied from interface:LicenseTokenManagerChecks whether a license token can be granted to the specified agent. If token cannot be granted LicenseNotGrantedException is thrown.- Specified by:
grantLicensein interfaceLicenseTokenManager- Parameters:
agent- agent to grant license to- Throws:
LicenseNotGrantedException- if there is not enough license tokens
-
getData
public PerUsageLicenseData getData()
-
-