org.apache.commons.configuration.ConfigurationUtils Java Examples

The following examples show how to use org.apache.commons.configuration.ConfigurationUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogConfigUtils.java    From singer with Apache License 2.0 6 votes vote down vote up
/**
 * get the PropertiesConfiguration for a specific topic from the file
 * datapipelines.properties
 *
 * @param config    - the properties configuration for the entire
 *                  datapipelines.properties
 * @param topicName - the name of the desired topic
 */
public static PropertiesConfiguration getTopicConfig(Configuration config, String topicName) {
  // get default values, then copy the user-specified values into the default
  // values
  // user values will overwrite any default values.

  // get default settings
  PropertiesConfiguration topicConfig = toPropertiesConfiguration(
      config.subset("singer.default"));

  // add topic-specific default values
  topicConfig.setProperty("logfile_regex", topicName + "_(\\\\d+).log");
  topicConfig.setProperty("writer.kafka.topic", topicName);

  // get user values
  PropertiesConfiguration topicConfigOverrides = toPropertiesConfiguration(
      config.subset(topicName));

  // copy user settings into default values
  ConfigurationUtils.copy(topicConfigOverrides, topicConfig);
  return topicConfig;
}
 
Example #2
Source File: HelixServerStarter.java    From incubator-pinot with Apache License 2.0 6 votes vote down vote up
public HelixServerStarter(String helixClusterName, String zkAddress, Configuration serverConf)
    throws Exception {
  _helixClusterName = helixClusterName;
  _zkAddress = zkAddress;
  // Make a clone so that changes to the config won't propagate to the caller
  _serverConf = ConfigurationUtils.cloneConfiguration(serverConf);

  _host = _serverConf.getString(KEY_OF_SERVER_NETTY_HOST,
      _serverConf.getBoolean(CommonConstants.Helix.SET_INSTANCE_ID_TO_HOSTNAME_KEY, false) ? NetUtil
          .getHostnameOrAddress() : NetUtil.getHostAddress());
  _port = _serverConf.getInt(KEY_OF_SERVER_NETTY_PORT, DEFAULT_SERVER_NETTY_PORT);
  if (_serverConf.containsKey(CONFIG_OF_INSTANCE_ID)) {
    _instanceId = _serverConf.getString(CONFIG_OF_INSTANCE_ID);
  } else {
    _instanceId = PREFIX_OF_SERVER_INSTANCE + _host + "_" + _port;
    _serverConf.addProperty(CONFIG_OF_INSTANCE_ID, _instanceId);
  }
}
 
Example #3
Source File: CatalogConfiguration.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String toString() {
    StringWriter dump = new StringWriter();
    PrintWriter printWriter = new PrintWriter(dump);
    ConfigurationUtils.dump(properties, printWriter);
    printWriter.flush();
    return "CatalogConfiguration{id=" + id + ", prefix=" + prefix + ", properties:" + dump + '}';
}
 
Example #4
Source File: GraknSparkComputer.java    From grakn with GNU Affero General Public License v3.0 4 votes vote down vote up
public GraknSparkComputer(HadoopGraph hadoopGraph) {
    super(hadoopGraph);
    this.sparkConfiguration = new HadoopConfiguration();
    ConfigurationUtils.copy(this.hadoopGraph.configuration(), this.sparkConfiguration);
}
 
Example #5
Source File: Properties.java    From database with GNU General Public License v2.0 4 votes vote down vote up
public String toString() {
	return ConfigurationUtils.toString( this );
}