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 v2
LicenseManager. Delegates the validation to
LicenseValidator and all storage operations to LicenseStore.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultLicenseService(LicenseStoreInternal store, com.atlassian.extras.api.LicenseManager decoder, LicenseValidator validator, com.atlassian.extras.core.AtlassianLicenseFactory licenseFactory) -
Method Summary
Modifier and TypeMethodDescription@NonNull com.atlassian.extras.api.confluence.ConfluenceLicenseValidates and installs a given encrypted license.booleanbooleanReturns whether there is a currently installed license.booleanReturns whether currently installed license is for Data Center.booleanReturns 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.extras.api.AtlassianLicenseRetrieves the currently installed Atlassian license.@NonNull Optional<com.atlassian.extras.api.ProductLicense> retrieveForProduct(com.atlassian.extras.api.Product product) Retrieves the license for the requested product.@NonNull com.atlassian.extras.api.confluence.ConfluenceLicenseValidates the given encrypted license.@NonNull com.atlassian.extras.api.ProductLicenseValidates the given encrypted license.
-
Constructor Details
-
DefaultLicenseService
public DefaultLicenseService(LicenseStoreInternal store, com.atlassian.extras.api.LicenseManager decoder, LicenseValidator validator, com.atlassian.extras.core.AtlassianLicenseFactory licenseFactory)
-
-
Method Details
-
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:
com.atlassian.extras.api.LicenseException
-
retrieveForProduct
public @NonNull Optional<com.atlassian.extras.api.ProductLicense> retrieveForProduct(com.atlassian.extras.api.Product product) Description copied from interface:LicenseServiceRetrieves the license for the requested product.- Specified by:
retrieveForProductin interfaceLicenseService- Parameters:
product- the product for which the license is requested- Returns:
- the license for the requested product if it is installed
-
install
public @NonNull com.atlassian.extras.api.confluence.ConfluenceLicense install(String licenseString) throws EmptyLicenseValidationException, ForgedLicenseException, KnownConfluenceLicenseValidationException 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
- Throws:
EmptyLicenseValidationExceptionForgedLicenseExceptionKnownConfluenceLicenseValidationException
-
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:
com.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) throws EmptyLicenseValidationException, ForgedLicenseException, KnownConfluenceLicenseValidationException Description copied from interface:LicenseServiceValidates the given encrypted license.- Specified by:
validatein interfaceLicenseService- Throws:
EmptyLicenseValidationExceptionForgedLicenseExceptionKnownConfluenceLicenseValidationException- See Also:
-
validate
public @NonNull com.atlassian.extras.api.ProductLicense validate(String licenseString, com.atlassian.extras.api.Product product) throws com.atlassian.extras.api.LicenseException, ForgedLicenseException Description copied from interface:LicenseServiceValidates the given encrypted license.- Specified by:
validatein interfaceLicenseService- Throws:
com.atlassian.extras.api.LicenseExceptionForgedLicenseException- See Also:
-
isDcLicense
public boolean isDcLicense()- Specified by:
isDcLicensein interfacecom.atlassian.crowd.embedded.spi.DcLicenseChecker
-