Search in sources :

Example 11 with EnvironmentStatus

use of com.sequenceiq.environment.environment.EnvironmentStatus 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);
        }
    };
}
Also used : EnvironmentStatus(com.sequenceiq.environment.environment.EnvironmentStatus) EnvStartEvent(com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CommonContext(com.sequenceiq.flow.core.CommonContext) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) Map(java.util.Map) EnvironmentStartDto(com.sequenceiq.environment.environment.dto.EnvironmentStartDto) Bean(org.springframework.context.annotation.Bean)

Example 12 with EnvironmentStatus

use of com.sequenceiq.environment.environment.EnvironmentStatus 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);
        }
    };
}
Also used : EnvironmentStatus(com.sequenceiq.environment.environment.EnvironmentStatus) EnvStartEvent(com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CommonContext(com.sequenceiq.flow.core.CommonContext) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) Map(java.util.Map) EnvironmentStartDto(com.sequenceiq.environment.environment.dto.EnvironmentStartDto) Bean(org.springframework.context.annotation.Bean)

Example 13 with EnvironmentStatus

use of com.sequenceiq.environment.environment.EnvironmentStatus 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);
        }
    };
}
Also used : EnvironmentStatus(com.sequenceiq.environment.environment.EnvironmentStatus) EnvStartEvent(com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CommonContext(com.sequenceiq.flow.core.CommonContext) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) Map(java.util.Map) EnvironmentStartDto(com.sequenceiq.environment.environment.dto.EnvironmentStartDto) Bean(org.springframework.context.annotation.Bean)

Example 14 with EnvironmentStatus

use of com.sequenceiq.environment.environment.EnvironmentStatus 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);
        }
    };
}
Also used : EnvironmentStatus(com.sequenceiq.environment.environment.EnvironmentStatus) EnvStopEvent(com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CommonContext(com.sequenceiq.flow.core.CommonContext) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 15 with EnvironmentStatus

use of com.sequenceiq.environment.environment.EnvironmentStatus 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);
        }
    };
}
Also used : EnvironmentStatus(com.sequenceiq.environment.environment.EnvironmentStatus) EnvStopEvent(com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CommonContext(com.sequenceiq.flow.core.CommonContext) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Aggregations

EnvironmentStatus (com.sequenceiq.environment.environment.EnvironmentStatus)16 CommonContext (com.sequenceiq.flow.core.CommonContext)12 Map (java.util.Map)12 Bean (org.springframework.context.annotation.Bean)12 ResourceEvent (com.sequenceiq.cloudbreak.event.ResourceEvent)11 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)10 EnvironmentStartDto (com.sequenceiq.environment.environment.dto.EnvironmentStartDto)4 EnvStartEvent (com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent)4 Environment (com.sequenceiq.environment.environment.domain.Environment)3 EnvStopEvent (com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 EnvironmentDeletionDto (com.sequenceiq.environment.environment.dto.EnvironmentDeletionDto)2 EnvironmentLoadBalancerDto (com.sequenceiq.environment.environment.dto.EnvironmentLoadBalancerDto)2 EnvDeleteEvent (com.sequenceiq.environment.environment.flow.deletion.event.EnvDeleteEvent)2 LoadBalancerUpdateEvent (com.sequenceiq.environment.environment.flow.loadbalancer.event.LoadBalancerUpdateEvent)2 Test (org.junit.jupiter.api.Test)2 UpgradeCcmFailedEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmFailedEvent)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1