use of com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrator in project cloudbreak by hortonworks.
the class GetPlatformOrchestratorsHandler method accept.
@Override
public void accept(Event<GetPlatformOrchestratorsRequest> getPlatformOrchestratorsRequest) {
LOGGER.info("Received event: {}", getPlatformOrchestratorsRequest);
GetPlatformOrchestratorsRequest request = getPlatformOrchestratorsRequest.getData();
try {
Map<Platform, Collection<Orchestrator>> platformCollectionHashMap = Maps.newHashMap();
Map<Platform, Orchestrator> defaults = Maps.newHashMap();
for (Entry<Platform, Collection<Variant>> connector : cloudPlatformConnectors.getPlatformVariants().getPlatformToVariants().entrySet()) {
PlatformOrchestrator platformOrchestrator = cloudPlatformConnectors.getDefault(connector.getKey()).parameters().orchestratorParams();
platformCollectionHashMap.put(connector.getKey(), platformOrchestrator.types());
defaults.put(connector.getKey(), platformOrchestrator.defaultType());
}
GetPlatformOrchestratorsResult getPlatformOrchestratorsResult = new GetPlatformOrchestratorsResult(request, new PlatformOrchestrators(platformCollectionHashMap, defaults));
request.getResult().onNext(getPlatformOrchestratorsResult);
LOGGER.info("Query platform orchestrators types finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new GetPlatformOrchestratorsResult(e.getMessage(), e, request));
}
}
Aggregations