All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fivefaces.cloud.workflow.awsonprem.impl.TaskStateInvokerImpl Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fivefaces.cloud.workflow.awsonprem.impl;

import com.amazonaws.services.stepfunctions.builder.states.TaskState;
import com.fivefaces.cloud.workflow.awsonprem.AnotherMachineStateInvoker;
import com.fivefaces.cloud.workflow.awsonprem.ApiGatewayStateInvoker;
import com.fivefaces.cloud.workflow.awsonprem.StateMachineConstants;
import com.fivefaces.cloud.workflow.awsonprem.TaskStateInvoker;
import com.fivefaces.cloud.workflow.awsonprem.model.Execution;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class TaskStateInvokerImpl implements TaskStateInvoker {

    private final ApiGatewayStateInvoker apiGatewayStateInvoker;
    private final AnotherMachineStateInvoker anotherMachineStateInvoker;

    @Override
    public Object execute(TaskState state, Execution execution) {
        if (state.getResource().equals(StateMachineConstants.ApiGatewayInvoke)) {
            return apiGatewayStateInvoker.execute(state, execution);
        } else if (StateMachineConstants.StartExecution.contains(state.getResource())) {
            return anotherMachineStateInvoker.execute(state, execution);
        } else {
            throw new IllegalStateException("Could not understand resource " + state.getResource());
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy