Package com.atlassian.confluence.cluster
Class DefaultClusterConfigurationHelper
java.lang.Object
com.atlassian.confluence.cluster.DefaultClusterConfigurationHelper
- All Implemented Interfaces:
ClusterConfigurationHelper
,ClusterConfigurationHelperInternal
@ParametersAreNonnullByDefault
public class DefaultClusterConfigurationHelper
extends Object
implements ClusterConfigurationHelperInternal
An implementation of
ClusterConfigurationHelper
which assumes that a cluster of some sort is being used. The
specifics of the underlying clustering technology are handled by the ClusterManager
. If no cluster is being
used, then this class is not appropriate, and NonClusterConfigurationHelper
should be used instead.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorDescriptionDefaultClusterConfigurationHelper
(com.atlassian.config.internal.ApplicationConfig applicationConfig, ClusterManagerInternal clusterManager, LicenseServiceInternal licenseService, SingleConnectionProvider databaseHelper, com.atlassian.config.db.HibernateConfig hibernateConfig, ClusterCompatibilityValidator clusterCompatibilityValidator, com.atlassian.security.random.SecureTokenGenerator secureTokenGenerator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bootstrapCluster
(BootstrapDatabaseAccessor.BootstrapDatabaseData bootstrapDatabaseData) Checks whether clustering is enabled, and bootstraps the cluster manager with an appropriate configurationvoid
createCluster
(String clusterName, File clusterHome, @Nullable String networkInterfaceName, ClusterJoinConfig joinConfig) Creates a new cluster with the given name, on the specified network interface, as long as the given cluster does not exist.void
Creates and sets up the cluster config file in the shared home if it doesn't already exist.void
Creates shared home directory if it does not exist already.Return a list of interfaces suitable for clustered communication.protected Optional<com.atlassian.config.internal.ApplicationConfig>
Get the build number stored in the confluence.cfg.xml file in the shared home foldergetSharedProperty
(Object key) Get the value of a property stored in the confluence.cfg.xml config file (in the shared home folder)boolean
boolean
Returns the configured join config if setup has progressed that far.void
Merges the config file in shared home into the current config file (in local home folder).void
This method need to be trigger when we finish setup.void
saveSharedBuildNumber
(String sharedBuildNumber) Store the build number into the confluence.cfg.xml file in the shared home foldervoid
saveSharedProperty
(Object key, Object value) Save a property into the shared confluence.cfg.xml config file (in the shared home folder)Return the shared home directory if one has been configured.
-
Field Details
-
CLUSTER
- See Also:
-
CLUSTER_NAME
- See Also:
-
CLUSTER_INTERFACE
- See Also:
-
CLUSTER_JOIN_TYPE
- See Also:
-
CLUSTER_ADDRESS
- See Also:
-
CLUSTER_TTL
- See Also:
-
CLUSTER_MULTICAST_PORT_SYS_PROP
- See Also:
-
CLUSTER_PEERS
- See Also:
-
CLUSTER_AWS
- See Also:
-
CLUSTER_AWS_ACCESS_KEY
- See Also:
-
CLUSTER_AWS_SECRET_KEY
- See Also:
-
CLUSTER_AWS_IAM_ROLE
- See Also:
-
CLUSTER_AWS_TAG_KEY
- See Also:
-
CLUSTER_AWS_TAG_VALUE
- See Also:
-
CLUSTER_AWS_REGION
- See Also:
-
CLUSTER_AWS_HOST_HEADER
- See Also:
-
CLUSTER_AWS_SECURITY_GROUP_NAME
- See Also:
-
CLUSTER_HOME
- See Also:
-
SHARED_HOME
- See Also:
-
CLUSTER_AUTHENTICATION_ENABLED
- See Also:
-
CLUSTER_AUTHENTICATION_ENABLED_DEFAULT_VAL
- See Also:
-
CLUSTER_AUTHENTICATION_SECRET
- See Also:
-
SUPPORTED_SHARED_HOME_CONFIG_PROPERTIES
-
CLUSTER_SETUP_ENTRIES
-
-
Constructor Details
-
DefaultClusterConfigurationHelper
public DefaultClusterConfigurationHelper(com.atlassian.config.internal.ApplicationConfig applicationConfig, ClusterManagerInternal clusterManager, LicenseServiceInternal licenseService, SingleConnectionProvider databaseHelper, com.atlassian.config.db.HibernateConfig hibernateConfig, ClusterCompatibilityValidator clusterCompatibilityValidator, com.atlassian.security.random.SecureTokenGenerator secureTokenGenerator) - Since:
- 7.17.3
-
-
Method Details
-
getClusterApplicationConfig
- Returns:
- ApplicationConfig for the cluster if the cluster config file exists otherwise an empty Optional
-
createClusterConfig
public void createClusterConfig()Description copied from interface:ClusterConfigurationHelperInternal
Creates and sets up the cluster config file in the shared home if it doesn't already exist. Does nothing if the cluster config file already exists.- Specified by:
createClusterConfig
in interfaceClusterConfigurationHelperInternal
-
populateExistingClusterSetupConfig
public void populateExistingClusterSetupConfig()Description copied from interface:ClusterConfigurationHelperInternal
Merges the config file in shared home into the current config file (in local home folder). Does nothing if the cluster config file doesn't exist.- Specified by:
populateExistingClusterSetupConfig
in interfaceClusterConfigurationHelperInternal
-
isClusteredInstance
public boolean isClusteredInstance()- Specified by:
isClusteredInstance
in interfaceClusterConfigurationHelper
- Returns:
- true if the application is currently configured to be part of a cluster, otherwise false.
-
isClusterHomeConfigured
public boolean isClusterHomeConfigured()- Specified by:
isClusterHomeConfigured
in interfaceClusterConfigurationHelper
- Returns:
- true if the application has the confluence.cluster.home property set, otherwise false.
-
createCluster
public void createCluster(String clusterName, File clusterHome, @Nullable String networkInterfaceName, ClusterJoinConfig joinConfig) throws ClusterException Description copied from interface:ClusterConfigurationHelper
Creates a new cluster with the given name, on the specified network interface, as long as the given cluster does not exist.- Specified by:
createCluster
in interfaceClusterConfigurationHelper
- Throws:
ClusterException
- if an error setting up the cluster.
-
bootstrapCluster
public void bootstrapCluster(BootstrapDatabaseAccessor.BootstrapDatabaseData bootstrapDatabaseData) throws ClusterException Description copied from interface:ClusterConfigurationHelper
Checks whether clustering is enabled, and bootstraps the cluster manager with an appropriate configuration- Specified by:
bootstrapCluster
in interfaceClusterConfigurationHelper
- Parameters:
bootstrapDatabaseData
- contains the build number and cluster upgrade state information to decide whether this node can join- Throws:
ClusterException
- if there was an error configuring the cluster manager, or if the licensed nodes were exceeded by joining the cluster.
-
getClusterableInterfaces
Description copied from interface:ClusterConfigurationHelper
Return a list of interfaces suitable for clustered communication. The list is ordered for suitable rendering in a UI.- Specified by:
getClusterableInterfaces
in interfaceClusterConfigurationHelper
- Returns:
- List of
NetworkInterface
objects
-
joinConfig
Description copied from interface:ClusterConfigurationHelper
Returns the configured join config if setup has progressed that far.- Specified by:
joinConfig
in interfaceClusterConfigurationHelper
- Returns:
- Join configuration
-