use of com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig in project cloudbreak by hortonworks.
the class SupportedVersionService method collectSupportedVersions.
public SupportedVersions collectSupportedVersions() {
SupportedVersions supportedVersions = new SupportedVersions();
Set<SupportedVersion> supportedVersionsSet = new HashSet<>();
resolver.cdhConfigurations().forEach((key, value) -> {
SupportedVersion supportedVersion = new SupportedVersion();
supportedVersion.setType(key.getStackType());
supportedVersion.setVersion(key.getVersion());
SupportedServices supportedServices = new SupportedServices();
for (CdhService serviceName : value) {
for (ServiceConfig serviceInformation : resolver.serviceConfigs()) {
if (serviceInformation.getName().equals(serviceName.getName())) {
SupportedService supportedService = new SupportedService();
supportedService.setName(serviceInformation.getName());
supportedService.setDisplayName(serviceInformation.getDisplayName());
supportedService.setVersion(serviceName.getVersion());
supportedServices.getServices().add(supportedService);
break;
}
}
}
supportedVersion.setSupportedServices(supportedServices);
supportedVersionsSet.add(supportedVersion);
});
supportedVersions.setSupportedVersions(supportedVersionsSet);
return supportedVersions;
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig in project cloudbreak by hortonworks.
the class GeneratedCmTemplateService method prepareClouderaManagerTemplate.
public GeneratedCmTemplate prepareClouderaManagerTemplate(Set<String> services, String stackType, String version, String uuid) {
CmTemplateProcessor processor = initiateTemplate();
Set<ServiceConfig> serviceConfigs = collectServiceConfigs(services);
Map<String, Set<String>> hostServiceMap = new HashMap<>();
prepareCdhVersion(stackType, version, processor);
processor.setDisplayName(prepareDisplayName(uuid));
processor.setServices(prepareApiClusterTemplateServices(serviceConfigs, hostServiceMap));
processor.setHostTemplates(prepareApiClusterTemplateHostTemplates(hostServiceMap));
return new GeneratedCmTemplate(prepareTemplate(processor));
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig in project cloudbreak by hortonworks.
the class CmTemplateGeneratorConfigurationResolver method readServiceDefinitions.
private Set<ServiceConfig> readServiceDefinitions() {
Set<ServiceConfig> serviceConfigs = new HashSet<>();
String content = readFileFromClasspathQuietly(serviceDefinitionConfigurationPath);
try {
ServiceDependencies serviceDependencies = MAPPER.readValue(content, ServiceDependencies.class);
serviceConfigs = serviceDependencies.getServices();
} catch (IOException ex) {
String message = String.format("Could not read service definitions from: %s", serviceDefinitionConfigurationPath);
LOGGER.error(message, ex);
}
return serviceConfigs;
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig in project cloudbreak by hortonworks.
the class ServiceDependencyMatrixService method collectServiceDependencyMatrix.
public ServiceDependencyMatrix collectServiceDependencyMatrix(Set<String> services, String stackType, String version) {
ServiceDependencyMatrix serviceDependencyMatrix = new ServiceDependencyMatrix();
Services servicesObject = new Services();
servicesObject.setServices(services);
serviceDependencyMatrix.setServices(servicesObject);
Dependencies dependencies = new Dependencies();
Set<String> deps = new HashSet<>();
for (String service : services) {
for (ServiceConfig serviceInformation : resolver.serviceConfigs()) {
if (service.toUpperCase().equals(serviceInformation.getName())) {
for (String dependency : serviceInformation.getDependencies()) {
deps.add(dependency.toUpperCase());
}
break;
}
}
}
dependencies.setServices(deps);
serviceDependencyMatrix.setDependencies(dependencies);
return serviceDependencyMatrix;
}
use of com.sequenceiq.cloudbreak.cmtemplate.generator.configuration.domain.dependencies.ServiceConfig in project cloudbreak by hortonworks.
the class DeclaredVersionService method collectDeclaredVersions.
public SupportedServices collectDeclaredVersions(String blueprintText) {
SupportedServices supportedServices = new SupportedServices();
Set<SupportedService> services = new HashSet<>();
CmTemplateProcessor cmTemplateProcessor = cmTemplateProcessorFactory.get(blueprintText);
String cdhVersion = cmTemplateProcessor.getTemplate().getCdhVersion();
StackVersion stackVersion = new StackVersion();
stackVersion.setVersion(cdhVersion);
stackVersion.setStackType("CDH");
Set<CdhService> cdhServices = cmTemplateGeneratorConfigurationResolver.cdhConfigurations().get(stackVersion);
if (cdhServices == null) {
cdhServices = fallbackForDefault();
}
for (ApiClusterTemplateService service : cmTemplateProcessor.getTemplate().getServices()) {
SupportedService supportedService = new SupportedService();
supportedService.setName(service.getServiceType());
for (CdhService cdhService : cdhServices) {
if (cdhService.getName().equals(service.getServiceType())) {
supportedService.setVersion(cdhService.getVersion());
}
}
for (ServiceConfig serviceConfig : cmTemplateGeneratorConfigurationResolver.serviceConfigs()) {
if (serviceConfig.getName().equals(service.getServiceType())) {
supportedService.setDisplayName(serviceConfig.getDisplayName());
supportedService.setComponentNameInParcel(serviceConfig.getComponentNameInParcel());
}
}
if (!Strings.isNullOrEmpty(supportedService.getDisplayName()) && !Strings.isNullOrEmpty(supportedService.getVersion())) {
services.add(supportedService);
}
}
supportedServices.setServices(services);
return supportedServices;
}
Aggregations