use of com.sequenceiq.cloudbreak.event.ResourceEvent in project cloudbreak by hortonworks.
the class EnvStartActions method synchronizeUsers.
@Bean(name = "SYNCHRONIZE_USERS_STATE")
public Action<?, ?> synchronizeUsers() {
return new AbstractEnvStartAction<>(EnvStartEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStartEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.START_SYNCHRONIZE_USERS_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_START_SYNCHRONIZE_USERS_STARTED;
EnvStartState envStartState = EnvStartState.SYNCHRONIZE_USERS_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.SYNCHRONIZE_USERS_HANDLER_EVENT.selector(), environmentStartDto);
}
};
}
use of com.sequenceiq.cloudbreak.event.ResourceEvent in project cloudbreak by hortonworks.
the class EnvStartActions method startDatalake.
@Bean(name = "START_DATALAKE_STATE")
public Action<?, ?> startDatalake() {
return new AbstractEnvStartAction<>(EnvStartEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStartEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.START_DATALAKE_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_START_DATALAKE_STARTED;
EnvStartState envStartState = EnvStartState.START_DATALAKE_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_DATALAKE_HANDLER_EVENT.selector(), environmentStartDto);
}
};
}
use of com.sequenceiq.cloudbreak.event.ResourceEvent in project cloudbreak by hortonworks.
the class EnvStartActions method startDatahub.
@Bean(name = "START_DATAHUB_STATE")
public Action<?, ?> startDatahub() {
return new AbstractEnvStartAction<>(EnvStartEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStartEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.START_DATAHUB_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_START_DATAHUB_STARTED;
EnvStartState envStartState = EnvStartState.START_DATAHUB_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_DATAHUB_HANDLER_EVENT.selector(), environmentStartDto);
}
};
}
use of com.sequenceiq.cloudbreak.event.ResourceEvent in project cloudbreak by hortonworks.
the class EnvStopActions method stopFreeipa.
@Bean(name = "STOP_FREEIPA_STATE")
public Action<?, ?> stopFreeipa() {
return new AbstractEnvStopAction<>(EnvStopEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStopEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.STOP_FREEIPA_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_STOP_FREEIPA_STARTED;
EnvStopState envStopState = EnvStopState.STOP_FREEIPA_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, envStopState);
sendEvent(context, EnvStopHandlerSelectors.STOP_FREEIPA_HANDLER_EVENT.selector(), envDto);
}
};
}
use of com.sequenceiq.cloudbreak.event.ResourceEvent in project cloudbreak by hortonworks.
the class EnvStopActions method stopDatahub.
@Bean(name = "STOP_DATAHUB_STATE")
public Action<?, ?> stopDatahub() {
return new AbstractEnvStopAction<>(EnvStopEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStopEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.STOP_DATAHUB_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_STOP_DATAHUB_STARTED;
EnvStopState envStopState = EnvStopState.STOP_DATAHUB_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, envStopState);
sendEvent(context, EnvStopHandlerSelectors.STOP_DATAHUB_HANDLER_EVENT.selector(), envDto);
}
};
}
Aggregations