Search in sources :

Example 1 with HostgroupEntry

use of com.sequenceiq.cloudbreak.blueprint.HostgroupEntry in project cloudbreak by hortonworks.

the class HostgroupConfigurations method fromConfigEntryMap.

public static HostgroupConfigurations fromConfigEntryMap(Map<HostgroupEntry, List<BlueprintConfigurationEntry>> configuration) {
    HostgroupConfigurations result = new HostgroupConfigurations();
    for (Map.Entry<HostgroupEntry, List<BlueprintConfigurationEntry>> conf : configuration.entrySet()) {
        Map<String, Map<String, String>> config = new HashMap<>();
        for (BlueprintConfigurationEntry blueprintConfigurationEntry : conf.getValue()) {
            if (!config.keySet().contains(blueprintConfigurationEntry.getConfigFile())) {
                config.put(blueprintConfigurationEntry.getConfigFile(), new HashMap<>());
            }
            config.get(blueprintConfigurationEntry.getConfigFile()).put(blueprintConfigurationEntry.getKey(), blueprintConfigurationEntry.getValue());
        }
        result.addHostgroupConfiguration(new HostgroupConfiguration(conf.getKey().getHostGroup(), config));
    }
    return result;
}
Also used : HostgroupEntry(com.sequenceiq.cloudbreak.blueprint.HostgroupEntry) HashMap(java.util.HashMap) List(java.util.List) Map(java.util.Map) HashMap(java.util.HashMap) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry)

Aggregations

BlueprintConfigurationEntry (com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry)1 HostgroupEntry (com.sequenceiq.cloudbreak.blueprint.HostgroupEntry)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1