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.ConfluenceLicense
Validates and installs a given encrypted license.boolean
boolean
Returns whether there is a currently installed license.boolean
Returns whether currently installed license is for Data Center.boolean
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.ConfluenceLicense
retrieve()
Retrieves the currently installed Confluence license.@NonNull com.atlassian.extras.api.AtlassianLicense
Retrieves 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.ConfluenceLicense
Validates the given encrypted license.@NonNull com.atlassian.extras.api.ProductLicense
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
retrieve
-
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:LicenseService
Retrieves the currently installed Confluence license.This is a convenience method for
LicenseService.retrieveForProduct(Product)
withProduct.CONFLUENCE
.- Specified by:
retrieve
in 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:LicenseService
Retrieves the currently installed Atlassian license.- Specified by:
retrieveAtlassianLicense
in 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
-
retrieveForProduct
public @NonNull Optional<com.atlassian.extras.api.ProductLicense> retrieveForProduct(com.atlassian.extras.api.Product product) throws com.atlassian.extras.api.LicenseException Description copied from interface:LicenseService
Retrieves the license for the requested product.- Specified by:
retrieveForProduct
in 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) throws EmptyLicenseValidationException, ForgedLicenseException, KnownConfluenceLicenseValidationException Description copied from interface:LicenseService
Validates and installs a given encrypted license.- Specified by:
install
in interfaceLicenseService
- Parameters:
licenseString
- the encrypted license- Returns:
- the de-crypted, de-serialised license
- Throws:
EmptyLicenseValidationException
ForgedLicenseException
KnownConfluenceLicenseValidationException
-
isLicensed
public boolean isLicensed() throws com.atlassian.extras.api.LicenseExceptionDescription copied from interface:LicenseServiceInternal
Returns whether there is a currently installed license. This is roughly equivalent to checking if callingLicenseService.retrieveAtlassianLicense()
is non-null.- Specified by:
isLicensed
in 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:LicenseService
Returns whether currently installed license is for Data Center. This is the same as callingProductLicense.isClusteringEnabled()
withLicenseService.retrieve()
.- Specified by:
isLicensedForDataCenter
in interfaceLicenseService
- Returns:
- whether the license is for Data Center.
-
isLicensedForDataCenterOrExempt
public boolean isLicensedForDataCenterOrExempt()Description copied from interface:LicenseService
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.- Specified by:
isLicensedForDataCenterOrExempt
in 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:LicenseService
Validates the given encrypted license.- Specified by:
validate
in interfaceLicenseService
- Throws:
EmptyLicenseValidationException
ForgedLicenseException
KnownConfluenceLicenseValidationException
- 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:LicenseService
Validates the given encrypted license.- Specified by:
validate
in interfaceLicenseService
- Throws:
com.atlassian.extras.api.LicenseException
ForgedLicenseException
- See Also:
-
isDcLicense
public boolean isDcLicense()- Specified by:
isDcLicense
in interfacecom.atlassian.crowd.embedded.spi.DcLicenseChecker
-