use of com.sequenceiq.cloudbreak.cloud.event.platform.PlatformParametersRequest in project cloudbreak by hortonworks.
the class PlatformParametersHandler method accept.
@Override
public void accept(Event<PlatformParametersRequest> platformParameterRequestEvent) {
LOGGER.info("Received event: {}", platformParameterRequestEvent);
PlatformParametersRequest request = platformParameterRequestEvent.getData();
Map<Platform, PlatformParameters> platformParameters = new HashMap<>();
try {
for (Entry<Platform, Collection<Variant>> connector : cloudPlatformConnectors.getPlatformVariants().getPlatformToVariants().entrySet()) {
platformParameters.put(connector.getKey(), cloudPlatformConnectors.getDefault(connector.getKey()).parameters());
}
PlatformParametersResult platformParameterResult = new PlatformParametersResult(request, platformParameters);
request.getResult().onNext(platformParameterResult);
LOGGER.info("Query platform parameters finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new PlatformParametersResult(e.getMessage(), e, request));
}
}
use of com.sequenceiq.cloudbreak.cloud.event.platform.PlatformParametersRequest in project cloudbreak by hortonworks.
the class CloudParameterService method getPlatformParameters.
public Map<Platform, PlatformParameters> getPlatformParameters() {
LOGGER.debug("Get platform parameters for");
PlatformParametersRequest parametersRequest = new PlatformParametersRequest();
eventBus.notify(parametersRequest.selector(), eventFactory.createEvent(parametersRequest));
try {
PlatformParametersResult res = parametersRequest.await();
LOGGER.info("Platform parameter result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform parameters", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return res.getPlatformParameters();
} catch (InterruptedException e) {
LOGGER.error("Error while getting platform parameters", e);
throw new OperationException(e);
}
}
Aggregations