String projectionType = options.valueOf(projectionTypeOption);
String projectionAny = options.valueOf(projectionDataAnyOption);
List<String> projectionHosts = options.valuesOf(projectionDataHostsOption);
List<String> projectionRacks = options.valuesOf(projectionDataRacksOption);
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.operation", "CLUSTERCREATE");
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.applicationId",
appId);
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.clusterId",
clusterId);
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.clusterDef",
clusterDef);
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.projectionType",
projectionType);
if (StringUtils.hasText(projectionAny)) {
appProperties
.setProperty("spring.yarn.internal.ContainerClusterApplication.projectionDataAny", projectionAny);
}
for (Entry<String, Integer> entry : getMapFromString(projectionHosts).entrySet()) {
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.projectionDataHosts."
+ entry.getKey(), entry.getValue().toString());
}
for (Entry<String, Integer> entry : getMapFromString(projectionRacks).entrySet()) {
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.projectionDataRacks."
+ entry.getKey(), entry.getValue().toString());
}
Properties extraProperties = getExtraProperties(options);
if (extraProperties != null) {
for (String key : extraProperties.stringPropertyNames()) {
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.extraProperties."
+ key, extraProperties.getProperty(key));
}
}
app.appProperties(appProperties);
handleOutput(app.run());
}