Module com.aoapps.appcluster.core
Package com.aoapps.appcluster
Class AppClusterPropertiesConfiguration
java.lang.Object
com.aoapps.appcluster.AppClusterPropertiesConfiguration
- All Implemented Interfaces:
AppClusterConfiguration
The configuration is provided in a properties file.
- Author:
- AO Industries, Inc.
-
Constructor Summary
ConstructorDescriptionLoads the properties from the provided file.AppClusterPropertiesConfiguration
(Properties properties) Uses the provided configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Will be called when the configuration has changed in any way.boolean
getBoolean
(String propertyName) int
Set
<? extends NodePropertiesConfiguration> Gets the set of nodes for the cluster.Set
<? extends ResourceConfiguration<?, ?>> Gets the set of resources for the cluster.getSchedule
(String propertyName) Gets a trimmed property value, if required, not allowing null or empty string.getUniqueNames
(String propertyName) Gets a unique set of trimmed names.getUniqueStrings
(String propertyName, boolean required) Gets a unique set of trimmed strings.boolean
void
Removes listener of configuration changes.void
start()
Called as the AppCluster starts, before any configuration values are accessed or listeners are added.void
stop()
Called as the AppCluster stops, after all configuration values have been accessed and all listeners have been removed.
-
Constructor Details
-
AppClusterPropertiesConfiguration
Loads the properties from the provided file. Will detect changes in the file based on modified time, checking once every FILE_CHECK_INTERVAL milliseconds. -
AppClusterPropertiesConfiguration
Uses the provided configuration. No changes to the properties will be detected.
-
-
Method Details
-
start
Description copied from interface:AppClusterConfiguration
Called as the AppCluster starts, before any configuration values are accessed or listeners are added.- Specified by:
start
in interfaceAppClusterConfiguration
- Throws:
AppClusterConfigurationException
-
stop
public void stop()Description copied from interface:AppClusterConfiguration
Called as the AppCluster stops, after all configuration values have been accessed and all listeners have been removed.- Specified by:
stop
in interfaceAppClusterConfiguration
-
addConfigurationListener
Description copied from interface:AppClusterConfiguration
Will be called when the configuration has changed in any way.- Specified by:
addConfigurationListener
in interfaceAppClusterConfiguration
-
removeConfigurationListener
Description copied from interface:AppClusterConfiguration
Removes listener of configuration changes.- Specified by:
removeConfigurationListener
in interfaceAppClusterConfiguration
-
getString
public String getString(String propertyName, boolean required) throws AppClusterConfigurationException Gets a trimmed property value, if required, not allowing null or empty string. If not required, will convert empty string to null.- Throws:
AppClusterConfigurationException
-
getBoolean
- Throws:
AppClusterConfigurationException
-
getInt
- Throws:
AppClusterConfigurationException
-
getName
- Throws:
AppClusterConfigurationException
-
getSchedule
- Throws:
AppClusterConfigurationException
-
getUniqueStrings
public Set<String> getUniqueStrings(String propertyName, boolean required) throws AppClusterConfigurationException Gets a unique set of trimmed strings. Must have at least one value when required.- Throws:
AppClusterConfigurationException
-
getUniqueNames
public Set<? extends Name> getUniqueNames(String propertyName) throws AppClusterConfigurationException Gets a unique set of trimmed names. Must have at least one value.- Throws:
AppClusterConfigurationException
-
isEnabled
- Specified by:
isEnabled
in interfaceAppClusterConfiguration
- Throws:
AppClusterConfigurationException
- See Also:
-
getDisplay
- Specified by:
getDisplay
in interfaceAppClusterConfiguration
- Throws:
AppClusterConfigurationException
- See Also:
-
getNodeConfigurations
public Set<? extends NodePropertiesConfiguration> getNodeConfigurations() throws AppClusterConfigurationExceptionDescription copied from interface:AppClusterConfiguration
Gets the set of nodes for the cluster.- Specified by:
getNodeConfigurations
in interfaceAppClusterConfiguration
- Throws:
AppClusterConfigurationException
-
getResourceConfigurations
public Set<? extends ResourceConfiguration<?,?>> getResourceConfigurations() throws AppClusterConfigurationExceptionDescription copied from interface:AppClusterConfiguration
Gets the set of resources for the cluster.- Specified by:
getResourceConfigurations
in interfaceAppClusterConfiguration
- Throws:
AppClusterConfigurationException
-