Java Code Examples for org.apache.commons.configuration.Configuration.getProperty()

The following are Jave code examples for showing how to use getProperty() of the org.apache.commons.configuration.Configuration class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-servicecomb-java-chassis   File: ConfigUtil.java   Source Code and License Vote up 6 votes
public static DynamicWatchedConfiguration createConfigFromConfigCenter(Configuration localConfiguration) {
  if (localConfiguration.getProperty(configCenterUrlKey) == null) {
    LOGGER.info("config center URL is missing, skip to load configuration from config center");
    return null;
  }

  ConfigCenterConfigurationSource configCenterConfigurationSource =
      SPIServiceUtils.getTargetService(ConfigCenterConfigurationSource.class);
  if (null == configCenterConfigurationSource) {
    LOGGER.info(
        "config center SPI service can not find, skip to load configuration from config center");
    return null;
  }

  configCenterConfigurationSource.init(localConfiguration);
  return new DynamicWatchedConfiguration(configCenterConfigurationSource);
}
 
Example 2
Project: incubator-servicecomb-java-chassis   File: ConfigUtil.java   Source Code and License Vote up 5 votes
public static Object getProperty(Object config, String key) {
  if (null != config && Configuration.class.isInstance(config)) {
    Configuration configuration = (Configuration) config;
    return configuration.getProperty(key);
  }
  return null;
}