Package org.apache.dubbo.common.config
Class ConfigurationUtils
java.lang.Object
org.apache.dubbo.common.config.ConfigurationUtils
Utilities for manipulating configurations from different sources
-
Method Summary
Modifier and TypeMethodDescriptionstatic intDeprecated.static intget(ScopeModel scopeModel, String property, int defaultValue) static StringgetCachedDynamicProperty(String key, String defaultValue) Deprecated.static StringgetCachedDynamicProperty(ScopeModel realScopeModel, String key, String defaultValue) static DynamicConfigurationFactorygetDynamicConfigurationFactory(ExtensionAccessor extensionAccessor, String name) Get an instance ofDynamicConfigurationFactoryby the specified name.static ConfigurationDeprecated.Replaced togetDynamicGlobalConfiguration(ScopeModel)static ConfigurationgetDynamicGlobalConfiguration(ScopeModel scopeModel) static StringgetDynamicProperty(String property) Deprecated.Replaced togetDynamicProperty(ScopeModel, String)static StringgetDynamicProperty(String property, String defaultValue) Deprecated.Replaced togetDynamicProperty(ScopeModel, String, String)static StringgetDynamicProperty(ScopeModel scopeModel, String property) static StringgetDynamicProperty(ScopeModel scopeModel, String property, String defaultValue) static ConfigurationDeprecated.Replaced togetEnvConfiguration(ScopeModel)static ConfigurationgetEnvConfiguration(ScopeModel scopeModel) Used to get properties from the os environmentstatic ConfigurationDeprecated.Replaced togetGlobalConfiguration(ScopeModel)static ConfigurationgetGlobalConfiguration(ScopeModel scopeModel) Used to get a composite property value.static StringgetProperty(String property) Deprecated.Replaced togetProperty(ScopeModel, String)static StringgetProperty(String property, String defaultValue) Deprecated.Replaced togetProperty(ScopeModel, String, String)static StringgetProperty(ScopeModel scopeModel, String property) static StringgetProperty(ScopeModel scopeModel, String property, String defaultValue) static intgetServerShutdownTimeout(ScopeModel scopeModel) Server shutdown wait timeout millsgetSubIds(Collection<Map<String, V>> configMaps, String prefix) Search props and extract config idsgetSubProperties(Collection<Map<String, V>> configMaps, String prefix) Search props and extract sub properties.getSubProperties(Map<String, V> configMap, String prefix) static ConfigurationDeprecated.Replaced togetSystemConfiguration(ScopeModel)static ConfigurationgetSystemConfiguration(ScopeModel scopeModel) Used to get properties from the jvmstatic <V> booleanhasSubProperties(Collection<Map<String, V>> configMaps, String prefix) static <V> booleanhasSubProperties(Map<String, V> configMap, String prefix) static booleanisEmptyValue(Object value) parseProperties(String content) static intreCalShutdownTime(int expected) static voidsetExpectedShutdownTime(long expectedShutdownTime)
-
Method Details
-
getSystemConfiguration
Used to get properties from the jvm- Returns:
-
getEnvConfiguration
Used to get properties from the os environment- Returns:
-
getGlobalConfiguration
Used to get a composite property value.Also see
Environment.getConfiguration()- Returns:
-
getDynamicGlobalConfiguration
-
getServerShutdownTimeout
Server shutdown wait timeout mills- Returns:
-
reCalShutdownTime
public static int reCalShutdownTime(int expected) -
setExpectedShutdownTime
public static void setExpectedShutdownTime(long expectedShutdownTime) -
getCachedDynamicProperty
public static String getCachedDynamicProperty(ScopeModel realScopeModel, String key, String defaultValue) -
getDynamicProperty
-
getDynamicProperty
public static String getDynamicProperty(ScopeModel scopeModel, String property, String defaultValue) -
getProperty
-
getProperty
-
get
-
parseProperties
- Throws:
IOException
-
isEmptyValue
-
getSubProperties
public static <V> Map<String,V> getSubProperties(Collection<Map<String, V>> configMaps, String prefix) Search props and extract sub properties.# properties dubbo.protocol.name=dubbo dubbo.protocol.port=1234 # extract protocol props Map props = getSubProperties("dubbo.protocol."); # result props: {"name": "dubbo", "port" : "1234"}- Type Parameters:
V-- Parameters:
configMaps-prefix-- Returns:
-
getSubProperties
-
hasSubProperties
-
hasSubProperties
-
getSubIds
Search props and extract config ids# properties dubbo.registries.registry1.address=xxx dubbo.registries.registry2.port=xxx # extract ids Set configIds = getSubIds("dubbo.registries.") # result configIds: ["registry1", "registry2"]- Parameters:
configMaps-prefix-- Returns:
-
getDynamicConfigurationFactory
public static DynamicConfigurationFactory getDynamicConfigurationFactory(ExtensionAccessor extensionAccessor, String name) Get an instance ofDynamicConfigurationFactoryby the specified name. If not found, take the default extension ofDynamicConfigurationFactory- Parameters:
name- the name of extension ofDynamicConfigurationFactory- Returns:
- non-null
-
getSystemConfiguration
Deprecated.Replaced togetSystemConfiguration(ScopeModel)For compact single instance -
getEnvConfiguration
Deprecated.Replaced togetEnvConfiguration(ScopeModel)For compact single instance -
getGlobalConfiguration
Deprecated.Replaced togetGlobalConfiguration(ScopeModel)For compact single instance -
getDynamicGlobalConfiguration
Deprecated.Replaced togetDynamicGlobalConfiguration(ScopeModel)For compact single instance -
getCachedDynamicProperty
Deprecated.For compact single instance -
getDynamicProperty
Deprecated.Replaced togetDynamicProperty(ScopeModel, String)For compact single instance -
getDynamicProperty
Deprecated.Replaced togetDynamicProperty(ScopeModel, String, String)For compact single instance -
getProperty
Deprecated.Replaced togetProperty(ScopeModel, String)For compact single instance -
getProperty
Deprecated.Replaced togetProperty(ScopeModel, String, String)For compact single instance -
get
Deprecated.Replaced toget(ScopeModel, String, int)For compact single instance
-
get(ScopeModel, String, int)