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

The following are Jave code examples for showing how to use getList() 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: obevo   File: DbMergeInfo.java   Source Code and License Vote up 7 votes
public static MutableCollection<DbMergeInfo> parseFromProperties(Configuration config) {
    Set<String> dbs = new HashSet<String>(config.getList("instances"));

    MutableList<DbMergeInfo> dbMergeInfos = Lists.mutable.empty();
    for (String db : dbs) {
        Configuration subset = config.subset(db);
        if (subset.containsKey("inputDir")) {
            File inputDir = new File(subset.getString("inputDir"));
            DbMergeInfo mergeInfo = new DbMergeInfo(db, inputDir);
            if (subset.containsKey("driverClassName")) {
                mergeInfo.setDriverClassName(subset.getString("driverClassName"));
                mergeInfo.setUrl(subset.getString("url"));
                mergeInfo.setUsername(subset.getString("username"));
                mergeInfo.setPassword(subset.getString("password"));
                mergeInfo.setPhysicalSchema(subset.getString("physicalSchema"));
            }

            dbMergeInfos.add(mergeInfo);
        }
    }

    return dbMergeInfos;
}
 
Example 2
Project: incubator-servicecomb-java-chassis   File: ConfigurePropertyUtils.java   Source Code and License Vote up 5 votes
@SuppressWarnings("unchecked")
public static List<BasePath> getMicroservicePaths(Configuration configuration) {
  List<BasePath> basePaths = new ArrayList<>();
  for (Object path : configuration.getList("service_description.paths")) {
    BasePath basePath = new BasePath();
    Map<String, ?> pathMap = (Map<String, ?>) path;
    basePath.setPath(buildPath((String) pathMap.get("path")));
    basePath.setProperty((Map<String, String>) pathMap.get("property"));
    basePaths.add(basePath);
  }
  return basePaths;
}
 
Example 3
Project: spring-configuration-support   File: DatabaseConfigurationPropertiesFactoryBean.java   Source Code and License Vote up 5 votes
/**
 * Creates a properties instance with the key/value pairs specified within the passed configuration object.
 *
 * @param configuration the configuration
 * @return the populated properties instance
 */
protected Properties createPropertiesForConfiguration(Configuration configuration){

	Properties properties = new Properties();

	final Iterator keys = configuration.getKeys();
	while (keys.hasNext()) {
		String key = (String) keys.next();
		List list = configuration.getList(key);
		properties.setProperty(key, (String) list.get(0));
	}

	return properties;
}