Package jetbrains.buildServer.license
Class AbstractLicenseKey<T extends LicenseKeyData>
- java.lang.Object
-
- jetbrains.buildServer.license.AbstractLicenseKey<T>
-
- All Implemented Interfaces:
LicenseKey
- Direct Known Subclasses:
JwtLicenseKey
,LicenseKeyImpl
public abstract class AbstractLicenseKey<T extends LicenseKeyData> extends Object implements LicenseKey
-
-
Field Summary
Fields Modifier and Type Field Description protected String
myKey
protected LicenseInfo
myLicenseInfo
protected boolean
myObsolete
protected String
myValidateError
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLicenseKey(String key, Function<String,? extends LicenseInfo> licenseDecoder)
protected
AbstractLicenseKey(LicenseInfo licenseInfo, String key)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getKey()
abstract T
getLicenseKeyData()
String
getUniquePartOfKey()
String
getValidateError()
int
hashCode()
boolean
hasMaintenancePeriodValidFor(Date releaseDate)
boolean
isEAPLicenseKey()
boolean
isEnterpriseLicense()
boolean
isJwtProfessionalLicense()
boolean
isLicenseExpiringIn(int days)
boolean
isMaintenanceExpiringIn(int days)
boolean
isMultipleTrialKey()
boolean
isObsolete()
boolean
isOpenSourceLicenseKey()
boolean
isPerUsageLicense()
boolean
isTrialLicenseKey()
boolean
isUnlimitedAgentsLicense()
boolean
isValid()
void
setObsolete(boolean obsolete)
void
setValidateError(String validateError)
String
toString()
-
-
-
Field Detail
-
myKey
protected final String myKey
-
myLicenseInfo
@Nullable protected final LicenseInfo myLicenseInfo
-
myValidateError
protected String myValidateError
-
myObsolete
protected boolean myObsolete
-
-
Constructor Detail
-
AbstractLicenseKey
@TestOnly protected AbstractLicenseKey(@NotNull LicenseInfo licenseInfo, @NotNull String key)
-
AbstractLicenseKey
protected AbstractLicenseKey(@NotNull String key, Function<String,? extends LicenseInfo> licenseDecoder)
-
-
Method Detail
-
isMaintenanceExpiringIn
public boolean isMaintenanceExpiringIn(int days)
- Specified by:
isMaintenanceExpiringIn
in interfaceLicenseKey
-
isLicenseExpiringIn
public boolean isLicenseExpiringIn(int days)
- Specified by:
isLicenseExpiringIn
in interfaceLicenseKey
-
getKey
public String getKey()
- Specified by:
getKey
in interfaceLicenseKey
- Returns:
- license key itself
-
getUniquePartOfKey
public String getUniquePartOfKey()
- Specified by:
getUniquePartOfKey
in interfaceLicenseKey
-
setValidateError
public void setValidateError(String validateError)
-
isValid
public boolean isValid()
- Specified by:
isValid
in interfaceLicenseKey
- Returns:
- true if key is valid
-
getValidateError
public String getValidateError()
- Specified by:
getValidateError
in interfaceLicenseKey
- Returns:
- validation error if it exists
-
isTrialLicenseKey
public boolean isTrialLicenseKey()
- Specified by:
isTrialLicenseKey
in interfaceLicenseKey
-
isMultipleTrialKey
public boolean isMultipleTrialKey()
- Specified by:
isMultipleTrialKey
in interfaceLicenseKey
- Returns:
- true if number of performed trials should not be checked for this key
-
isEAPLicenseKey
public boolean isEAPLicenseKey()
- Specified by:
isEAPLicenseKey
in interfaceLicenseKey
-
hasMaintenancePeriodValidFor
public boolean hasMaintenancePeriodValidFor(@NotNull Date releaseDate)
- Specified by:
hasMaintenancePeriodValidFor
in interfaceLicenseKey
- Returns:
- true if this key maintenance period covers provided date
-
isEnterpriseLicense
public boolean isEnterpriseLicense()
- Specified by:
isEnterpriseLicense
in interfaceLicenseKey
-
isOpenSourceLicenseKey
public boolean isOpenSourceLicenseKey()
- Specified by:
isOpenSourceLicenseKey
in interfaceLicenseKey
-
isUnlimitedAgentsLicense
public boolean isUnlimitedAgentsLicense()
- Specified by:
isUnlimitedAgentsLicense
in interfaceLicenseKey
-
isPerUsageLicense
public boolean isPerUsageLicense()
- Specified by:
isPerUsageLicense
in interfaceLicenseKey
-
isJwtProfessionalLicense
public boolean isJwtProfessionalLicense()
- Specified by:
isJwtProfessionalLicense
in interfaceLicenseKey
-
isObsolete
public boolean isObsolete()
- Specified by:
isObsolete
in interfaceLicenseKey
- Returns:
- true if current server release date is after the maintenance date written in the key
-
setObsolete
public void setObsolete(boolean obsolete)
-
getLicenseKeyData
public abstract T getLicenseKeyData()
- Specified by:
getLicenseKeyData
in interfaceLicenseKey
- Returns:
- license key information, or null if license key was not recognized
-
-