use of com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor in project cloudbreak by hortonworks.
the class HdfConfigProvider method createHdfConfig.
public HdfConfigs createHdfConfig(Set<HostGroup> hostgroups, Map<String, List<InstanceMetaData>> groupInstances, String blueprintText) {
BlueprintTextProcessor blueprintTextProcessor = createTextProcessor(blueprintText);
Set<String> nifiMasters = collectNifiMasters(blueprintText);
Set<InstanceGroup> nifiIgs = collectInstanceGroupsWhichContainsNifiMasters(hostgroups, nifiMasters);
List<String> nifiFqdns = collectFqdnsByInstanceGroupName(groupInstances, nifiIgs);
AtomicInteger index = new AtomicInteger(0);
String nodeIdentities = nifiFqdns.stream().map(fqdn -> String.format("<property name=\"Node Identity %s\">CN=%s, OU=NIFI</property>", index.addAndGet(1), fqdn)).collect(Collectors.joining());
return new HdfConfigs(nodeIdentities, getProxyHostsParameter(nifiIgs, blueprintTextProcessor, groupInstances));
}
use of com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor in project cloudbreak by hortonworks.
the class SmartSenseConfigProvider method addSmartSenseServerToBp.
private String addSmartSenseServerToBp(BlueprintTextProcessor blueprintProcessor, Iterable<HostgroupView> hostgroupViews, Collection<String> hostGroupNames) {
if (!blueprintProcessor.componentExistsInBlueprint(HST_SERVER_COMPONENT)) {
String aHostGroupName = hostGroupNames.stream().findFirst().get();
boolean singleNodeGatewayFound = false;
for (HostgroupView hostGroup : hostgroupViews) {
if (hostGroup.isInstanceGroupConfigured() && GATEWAY.equals(hostGroup.getInstanceGroupType()) && hostGroup.getNodeCount().equals(1)) {
aHostGroupName = hostGroup.getName();
singleNodeGatewayFound = true;
break;
}
}
if (!singleNodeGatewayFound && blueprintProcessor.componentExistsInBlueprint(RESOURCEMANAGER_COMPONENT)) {
Optional<String> hostGroupNameOfNameNode = hostGroupNames.stream().filter(hGName -> blueprintProcessor.getComponentsInHostGroup(hGName).contains(RESOURCEMANAGER_COMPONENT)).findFirst();
if (hostGroupNameOfNameNode.isPresent()) {
aHostGroupName = hostGroupNameOfNameNode.get();
}
}
LOGGER.info("Adding '{}' component to '{}' hosgroup in the Blueprint.", HST_SERVER_COMPONENT, aHostGroupName);
final String finalAHostGroupName = aHostGroupName;
blueprintProcessor.addComponentToHostgroups(HST_SERVER_COMPONENT, hg -> finalAHostGroupName.equals(hg));
}
return blueprintProcessor.asText();
}
Aggregations