enhance configuration api (#5774)
This commit is contained in:
parent
cca798c086
commit
195b074698
|
|
@ -37,11 +37,40 @@ import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_SE
|
|||
public class ConfigurationUtils {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConfigurationUtils.class);
|
||||
|
||||
/**
|
||||
* Used to get properties from the jvm
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Configuration getSystemConfiguration() {
|
||||
return ApplicationModel.getEnvironment().getSystemConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get properties from the os environment
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Configuration getEnvConfiguration() {
|
||||
return ApplicationModel.getEnvironment().getEnvironmentConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get an composite property value.
|
||||
* <p>
|
||||
* Also see {@link Environment#getConfiguration()}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Configuration getGlobalConfiguration() {
|
||||
return ApplicationModel.getEnvironment().getConfiguration();
|
||||
}
|
||||
|
||||
// FIXME
|
||||
@SuppressWarnings("deprecation")
|
||||
public static int getServerShutdownTimeout() {
|
||||
int timeout = DEFAULT_SERVER_SHUTDOWN_TIMEOUT;
|
||||
Configuration configuration = ApplicationModel.getEnvironment().getConfiguration();
|
||||
Configuration configuration = getGlobalConfiguration();
|
||||
String value = StringUtils.trim(configuration.getString(SHUTDOWN_WAIT_KEY));
|
||||
|
||||
if (value != null && value.length() > 0) {
|
||||
|
|
|
|||
|
|
@ -191,6 +191,26 @@ public class Environment extends LifecycleAdapter implements FrameworkExt {
|
|||
clearAppExternalConfigs();
|
||||
}
|
||||
|
||||
public PropertiesConfiguration getPropertiesConfiguration() {
|
||||
return propertiesConfiguration;
|
||||
}
|
||||
|
||||
public SystemConfiguration getSystemConfiguration() {
|
||||
return systemConfiguration;
|
||||
}
|
||||
|
||||
public EnvironmentConfiguration getEnvironmentConfiguration() {
|
||||
return environmentConfiguration;
|
||||
}
|
||||
|
||||
public InmemoryConfiguration getExternalConfiguration() {
|
||||
return externalConfiguration;
|
||||
}
|
||||
|
||||
public InmemoryConfiguration getAppExternalConfiguration() {
|
||||
return appExternalConfiguration;
|
||||
}
|
||||
|
||||
// For test
|
||||
public void clearExternalConfigs() {
|
||||
this.externalConfiguration.clear();
|
||||
|
|
|
|||
Loading…
Reference in New Issue