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 toLicenseValidator
and 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.ConfluenceLicense
assertConfluenceLicense(com.atlassian.extras.api.AtlassianLicense license)
com.atlassian.extras.api.ProductLicense
assertProductLicense(com.atlassian.extras.api.AtlassianLicense license, com.atlassian.extras.api.Product product)
com.atlassian.extras.api.AtlassianLicense
decode(String licenseString)
com.atlassian.extras.api.AtlassianLicense
decodeAndValidateLicense(String licenseString)
com.atlassian.extras.api.AtlassianLicense
getForgedLicense(com.atlassian.extras.api.AtlassianLicense decode)
@NonNull com.atlassian.extras.api.confluence.ConfluenceLicense
install(String licenseString)
Validates and installs a given encrypted license.boolean
isDcLicense()
boolean
isLicensed()
Returns whether there is a currently installed license.boolean
isLicensedForDataCenter()
Returns whether currently installed license is for Data Center.boolean
isLicensedForDataCenterOrExempt()
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.fugue.Maybe<com.atlassian.extras.api.ProductLicense>
retrieve(com.atlassian.extras.api.Product product)
Deprecated.since 7.0.1.@NonNull com.atlassian.extras.api.AtlassianLicense
retrieveAtlassianLicense()
Retrieves the currently installed Atlassian license.String
sanitise(String licenseString)
@NonNull com.atlassian.extras.api.confluence.ConfluenceLicense
validate(String licenseString)
Validates the given encrypted license.@NonNull com.atlassian.extras.api.ProductLicense
validate(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: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.LicenseException
Description 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
-
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:LicenseService
Retrieves the license for the requested product.- Specified by:
retrieve
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)
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
-
isLicensed
public boolean isLicensed() throws com.atlassian.extras.api.LicenseException
Description 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)
Description copied from interface:LicenseService
Validates the given encrypted license.- Specified by:
validate
in 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:LicenseService
Validates the given encrypted license.- Specified by:
validate
in 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:
isDcLicense
in interfacecom.atlassian.crowd.embedded.spi.DcLicenseChecker
-
-