Class NonClusterConfigurationHelper
- java.lang.Object
-
- com.atlassian.confluence.cluster.nonclustered.NonClusterConfigurationHelper
-
- All Implemented Interfaces:
ClusterConfigurationHelper
,ClusterConfigurationHelperInternal
public class NonClusterConfigurationHelper extends Object implements ClusterConfigurationHelperInternal
An implementation ofClusterConfigurationHelper
for use when clustering is not being used. Some methods may throw exceptions if they are used, soisClusteredInstance()
should be used to check in advance if the other methods are appropriate to use.
-
-
Constructor Summary
Constructors Constructor Description NonClusterConfigurationHelper(com.atlassian.config.ApplicationConfig applicationConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bootstrapCluster(BootstrapDatabaseAccessor.BootstrapDatabaseData bootstrapDatabaseData)
Checks whether clustering is enabled, and bootstraps the cluster manager with an appropriate configurationvoid
createCluster(String clusterName, File clusterHome, 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
createClusterConfig()
Creates and sets up the cluster config file in the shared home if it doesn't already exist.void
createSharedHome()
Creates shared home directory if it does not exist already.List<NetworkInterface>
getClusterableInterfaces()
Return a list of interfaces suitable for clustered communication.Optional<String>
getSharedBuildNumber()
Get the build number stored in the confluence.cfg.xml file in the shared home folderOptional<Object>
getSharedProperty(Object key)
Get the value of a property stored in the confluence.cfg.xml config file (in the shared home folder)boolean
isClusteredInstance()
boolean
isClusterHomeConfigured()
Optional<ClusterJoinConfig>
joinConfig()
Returns the configured join config if setup has progressed that far.void
populateExistingClusterSetupConfig()
Merges the config file in shared home into the current config file (in local home folder).void
saveSetupConfigIntoSharedHome()
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)Optional<File>
sharedHome()
Return the shared home directory if one has been configured.
-
-
-
Method Detail
-
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, 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)
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
-
getClusterableInterfaces
public List<NetworkInterface> 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
-
sharedHome
public Optional<File> sharedHome()
Description copied from interface:ClusterConfigurationHelper
Return the shared home directory if one has been configured.- Specified by:
sharedHome
in interfaceClusterConfigurationHelper
- Returns:
- shared home directory
-
joinConfig
public Optional<ClusterJoinConfig> 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
-
createSharedHome
public void createSharedHome()
Description copied from interface:ClusterConfigurationHelperInternal
Creates shared home directory if it does not exist already.Shared home is created only if not clustering.
- Specified by:
createSharedHome
in interfaceClusterConfigurationHelperInternal
-
saveSetupConfigIntoSharedHome
public void saveSetupConfigIntoSharedHome()
Description copied from interface:ClusterConfigurationHelperInternal
This method need to be trigger when we finish setup. If we setup Confluence Cluster then this method will write all necessary information so from second node won't go to setup again- Specified by:
saveSetupConfigIntoSharedHome
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
-
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
-
saveSharedProperty
public void saveSharedProperty(Object key, Object value)
Description copied from interface:ClusterConfigurationHelperInternal
Save a property into the shared confluence.cfg.xml config file (in the shared home folder)- Specified by:
saveSharedProperty
in interfaceClusterConfigurationHelperInternal
- Parameters:
key
- the key of the propertyvalue
- the value of the property
-
getSharedProperty
public Optional<Object> getSharedProperty(Object key)
Description copied from interface:ClusterConfigurationHelperInternal
Get the value of a property stored in the confluence.cfg.xml config file (in the shared home folder)- Specified by:
getSharedProperty
in interfaceClusterConfigurationHelperInternal
- Parameters:
key
- the key of the property- Returns:
- the value of the property
-
saveSharedBuildNumber
public void saveSharedBuildNumber(String sharedBuildNumber)
Description copied from interface:ClusterConfigurationHelperInternal
Store the build number into the confluence.cfg.xml file in the shared home folder- Specified by:
saveSharedBuildNumber
in interfaceClusterConfigurationHelperInternal
- Parameters:
sharedBuildNumber
- the shared build number to be saved
-
getSharedBuildNumber
public Optional<String> getSharedBuildNumber()
Description copied from interface:ClusterConfigurationHelperInternal
Get the build number stored in the confluence.cfg.xml file in the shared home folder- Specified by:
getSharedBuildNumber
in interfaceClusterConfigurationHelperInternal
- Returns:
- the shared build number
-
-