ApiService apiService = new ApiService();
apiService.setType(serviceDef.getType().getName());
apiService.setName(serviceDef.getName());
apiService.setDisplayName(serviceDef.getDisplayName());
ApiServiceConfig apiServiceConfig = new ApiServiceConfig();
Set<String> serviceTypes = cluster.allServiceTypes();
if (serviceDef.getType().getDependencies() != null) {
for (AvailableServiceRole.Dependency dependency : serviceDef.getType().getDependencies()) {
for (String dependService : dependency.getServices()) {
if (serviceDef.getType().getDisplayName().equals("IMPALA") && dependService.equals("YARN")) {
// Impala needs Llama role to be able to use YARN for resource management, but this
// is a new added role and not yet supported well
continue;
}
if (serviceTypes.contains(dependService)) {
apiServiceConfig.add(new ApiConfig(dependency.getConfigKey(), cluster.serviceNameOfType(dependService)));
}
}
}
}
if (serviceDef.getConfiguration() != null) {
for (String key : serviceDef.getConfiguration().keySet()) {
apiServiceConfig.add(new ApiConfig(key, serviceDef.getConfiguration().get(key)));
}
}
// update configs if service already exist
if (servicesConfigured