Package com.atlassian.confluence.license
Class DefaultLicenseService
- java.lang.Object
-
- com.atlassian.confluence.license.DefaultLicenseService
-
- All Implemented Interfaces:
LicenseServiceInternal,LicenseService,com.atlassian.crowd.embedded.spi.DcLicenseChecker
@ParametersAreNonnullByDefault public class DefaultLicenseService extends Object implements LicenseServiceInternal, com.atlassian.crowd.embedded.spi.DcLicenseChecker
Responsible for the decoding of a license using the v2LicenseManager. Delegates the validation toLicenseValidatorand all storage operations toLicenseStore.
-
-
Constructor Summary
Constructors Constructor Description DefaultLicenseService(LicenseStoreInternal store, com.atlassian.extras.api.LicenseManager decoder, LicenseValidator validator, com.atlassian.extras.core.AtlassianLicenseFactory licenseFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.atlassian.extras.api.confluence.ConfluenceLicenseassertConfluenceLicense(com.atlassian.extras.api.AtlassianLicense license)com.atlassian.extras.api.ProductLicenseassertProductLicense(com.atlassian.extras.api.AtlassianLicense license, com.atlassian.extras.api.Product product)com.atlassian.extras.api.AtlassianLicensedecode(String licenseString)com.atlassian.extras.api.AtlassianLicensedecodeAndValidateLicense(String licenseString)com.atlassian.extras.api.AtlassianLicensegetForgedLicense(com.atlassian.extras.api.AtlassianLicense decode)@NonNull com.atlassian.extras.api.confluence.ConfluenceLicenseinstall(String licenseString)Validates and installs a given encrypted license.booleanisDcLicense()booleanisLicensed()Returns whether there is a currently installed license.booleanisLicensedForDataCenter()Returns whether currently installed license is for Data Center.booleanisLicensedForDataCenterOrExempt()Returns whether the currently installed license is for Data Center, or if the license should be treated as exempt from Data Center checks for testing purposes.@NonNull com.atlassian.extras.api.confluence.ConfluenceLicenseretrieve()Retrieves the currently installed Confluence license.@NonNull com.atlassian.fugue.Maybe<com.atlassian.extras.api.ProductLicense>retrieve(com.atlassian.extras.api.Product product)Deprecated.since 7.0.1.@NonNull com.atlassian.extras.api.AtlassianLicenseretrieveAtlassianLicense()Retrieves the currently installed Atlassian license.Stringsanitise(String licenseString)@NonNull com.atlassian.extras.api.confluence.ConfluenceLicensevalidate(String licenseString)Validates the given encrypted license.@NonNull com.atlassian.extras.api.ProductLicensevalidate(String licenseString, com.atlassian.extras.api.Product product)Validates the given encrypted license.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.license.LicenseService
retrieveForProduct
-
-
-
-
Constructor Detail
-
DefaultLicenseService
public DefaultLicenseService(LicenseStoreInternal store, com.atlassian.extras.api.LicenseManager decoder, LicenseValidator validator, com.atlassian.extras.core.AtlassianLicenseFactory licenseFactory)
-
-
Method Detail
-
retrieve
public @NonNull com.atlassian.extras.api.confluence.ConfluenceLicense retrieve()
Description copied from interface:LicenseServiceRetrieves the currently installed Confluence license.This is a convenience method for
LicenseService.retrieveForProduct(Product)withProduct.CONFLUENCE.- Specified by:
retrievein interfaceLicenseService- Returns:
- the installed Confluence license, never null
-
retrieveAtlassianLicense
public @NonNull com.atlassian.extras.api.AtlassianLicense retrieveAtlassianLicense() throws com.atlassian.extras.api.LicenseExceptionDescription copied from interface:LicenseServiceRetrieves the currently installed Atlassian license.- Specified by:
retrieveAtlassianLicensein interfaceLicenseService- Returns:
- the installed Atlassian license, never null
- Throws:
LicenseException- if no license is installed or the license could not be de-cryptedcom.atlassian.extras.api.LicenseException
-
retrieve
@Deprecated public @NonNull com.atlassian.fugue.Maybe<com.atlassian.extras.api.ProductLicense> retrieve(com.atlassian.extras.api.Product product) throws com.atlassian.extras.api.LicenseException
Deprecated.since 7.0.1. UseLicenseService.retrieveForProduct(Product)Description copied from interface:LicenseServiceRetrieves the license for the requested product.- Specified by:
retrievein interfaceLicenseService- Parameters:
product- the product for which the license is requested- Returns:
- the license for the requested product if it is installed
- Throws:
LicenseException- if no license is installed or the license could not be de-cryptedcom.atlassian.extras.api.LicenseException
-
install
public @NonNull com.atlassian.extras.api.confluence.ConfluenceLicense install(String licenseString)
Description copied from interface:LicenseServiceValidates and installs a given encrypted license.- Specified by:
installin interfaceLicenseService- Parameters:
licenseString- the encrypted license- Returns:
- the de-crypted, de-serialised license
-
isLicensed
public boolean isLicensed() throws com.atlassian.extras.api.LicenseExceptionDescription copied from interface:LicenseServiceInternalReturns whether there is a currently installed license. This is roughly equivalent to checking if callingLicenseService.retrieveAtlassianLicense()is non-null.- Specified by:
isLicensedin interfaceLicenseServiceInternal- Returns:
- whether there is a license.
- Throws:
LicenseException- if no license is installed or the license could not be de-cryptedcom.atlassian.extras.api.LicenseException
-
isLicensedForDataCenter
public boolean isLicensedForDataCenter()
Description copied from interface:LicenseServiceReturns whether currently installed license is for Data Center. This is the same as callingProductLicense.isClusteringEnabled()withLicenseService.retrieve().- Specified by:
isLicensedForDataCenterin interfaceLicenseService- Returns:
- whether the license is for Data Center.
-
isLicensedForDataCenterOrExempt
public boolean isLicensedForDataCenterOrExempt()
Description copied from interface:LicenseServiceReturns whether the currently installed license is for Data Center, or if the license should be treated as exempt from Data Center checks for testing purposes.- Specified by:
isLicensedForDataCenterOrExemptin interfaceLicenseService- Returns:
- Whether the license is for Data Center or should be exempt from DC license checks.
-
validate
public @NonNull com.atlassian.extras.api.confluence.ConfluenceLicense validate(String licenseString)
Description copied from interface:LicenseServiceValidates the given encrypted license.- Specified by:
validatein interfaceLicenseService- See Also:
LicenseService.install(String)
-
validate
public @NonNull com.atlassian.extras.api.ProductLicense validate(String licenseString, com.atlassian.extras.api.Product product) throws com.atlassian.extras.api.LicenseException
Description copied from interface:LicenseServiceValidates the given encrypted license.- Specified by:
validatein interfaceLicenseService- Throws:
com.atlassian.extras.api.LicenseException- See Also:
LicenseService.validate(String, com.atlassian.extras.api.Product)
-
decode
public com.atlassian.extras.api.AtlassianLicense decode(String licenseString)
-
assertConfluenceLicense
public com.atlassian.extras.api.confluence.ConfluenceLicense assertConfluenceLicense(com.atlassian.extras.api.AtlassianLicense license)
-
assertProductLicense
public com.atlassian.extras.api.ProductLicense assertProductLicense(com.atlassian.extras.api.AtlassianLicense license, com.atlassian.extras.api.Product product)
-
decodeAndValidateLicense
public com.atlassian.extras.api.AtlassianLicense decodeAndValidateLicense(@Nonnull String licenseString)
-
getForgedLicense
public com.atlassian.extras.api.AtlassianLicense getForgedLicense(com.atlassian.extras.api.AtlassianLicense decode)
-
isDcLicense
public boolean isDcLicense()
- Specified by:
isDcLicensein interfacecom.atlassian.crowd.embedded.spi.DcLicenseChecker
-
-