use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class EnvStopActions method stopDatalake.
@Bean(name = "STOP_DATALAKE_STATE")
public Action<?, ?> stopDatalake() {
return new AbstractEnvStopAction<>(EnvStopEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStopEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.STOP_DATALAKE_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_STOP_DATALAKE_STARTED;
EnvStopState envStopState = EnvStopState.STOP_DATALAKE_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, envStopState);
sendEvent(context, EnvStopHandlerSelectors.STOP_DATALAKE_HANDLER_EVENT.selector(), envDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class EnvStartActions method finishedAction.
@Bean(name = "ENV_START_FINISHED_STATE")
public Action<?, ?> finishedAction() {
return new AbstractEnvStartAction<>(ResourceCrnPayload.class) {
@Override
protected void doExecute(CommonContext context, ResourceCrnPayload payload, Map<Object, Object> variables) {
EnvironmentDto environmentDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, EnvironmentStatus.AVAILABLE, ResourceEvent.ENVIRONMENT_STARTED, EnvStartState.ENV_START_FINISHED_STATE);
metricService.incrementMetricCounter(MetricType.ENV_START_FINISHED, environmentDto);
LOGGER.info("Flow entered into ENV_START_FINISHED_STATE");
sendEvent(context, FINALIZE_ENV_START_EVENT.event(), payload);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class EnvStartActions method startFreeipa.
@Bean(name = "START_FREEIPA_STATE")
public Action<?, ?> startFreeipa() {
return new AbstractEnvStartAction<>(EnvStartEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStartEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.START_FREEIPA_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_START_FREEIPA_STARTED;
EnvStartState envStartState = EnvStartState.START_FREEIPA_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, envStartState);
EnvironmentStartDto environmentStartDto = EnvironmentStartDto.builder().withDataHubStart(payload.getDataHubStartAction()).withEnvironmentDto(envDto).withId(envDto.getId()).build();
sendEvent(context, EnvStartHandlerSelectors.START_FREEIPA_HANDLER_EVENT.selector(), environmentStartDto);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class LoadBalancerUpdateActions method finishedAction.
@Bean(name = "LOAD_BALANCER_UPDATE_FINISHED_STATE")
public Action<?, ?> finishedAction() {
return new AbstractLoadBalancerUpdateAction<>(ResourceCrnPayload.class) {
@Override
protected void doExecute(CommonContext context, ResourceCrnPayload payload, Map<Object, Object> variables) {
EnvironmentDto environmentDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, EnvironmentStatus.AVAILABLE, ResourceEvent.ENVIRONMENT_LOAD_BALANCER_UPDATE_FINISHED, LoadBalancerUpdateState.LOAD_BALANCER_UPDATE_FINISHED_STATE);
metricService.incrementMetricCounter(MetricType.ENV_LOAD_BALANCER_UPDATE_FINISHED, environmentDto);
LOGGER.info("Flow entered into LOAD_BALANCER_UPDATE_FINISHED_STATE");
sendEvent(context, FINALIZE_LOAD_BALANCER_UPDATE_EVENT.event(), payload);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class UpgradeCcmActions method upgradeCcmInFreeIpaAction.
@Bean(name = "UPGRADE_CCM_FREEIPA_STATE")
public Action<?, ?> upgradeCcmInFreeIpaAction() {
return new AbstractUpgradeCcmAction<>(UpgradeCcmEvent.class) {
@Override
protected void doExecute(CommonContext context, UpgradeCcmEvent payload, Map<Object, Object> variables) {
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, EnvironmentStatus.UPGRADE_CCM_ON_FREEIPA_IN_PROGRESS, ResourceEvent.ENVIRONMENT_UPGRADE_CCM_ON_FREEIPA_STARTED, UpgradeCcmState.UPGRADE_CCM_FREEIPA_STATE);
sendEvent(context, UPGRADE_CCM_FREEIPA_HANDLER.selector(), envDto);
}
};
}
Aggregations