// Path: spring-mvc-asynch/src/main/java/se/callista/springmvc/asynch/common/statemachine/State.java
// public class State {
// 
//     private static final AtomicLong lastProcessId = new AtomicLong(0);
// 
//     private StateProcessingStepIterator processingSteps;
//     private long processId;
//     private LogHelper log;
//     private StateMachineCallback completionCallback;
//     private String result = "";
// 
//     public State(Iterator<Processor> processingSteps, LogHelper log, StateMachineCallback completionCallback) {
//         this.processingSteps = new StateProcessingStepIterator(processingSteps);
//         this.log = log;
//         this.completionCallback = completionCallback;
//         this.processId = lastProcessId.incrementAndGet();
//     }
// 
//     public LogHelper getLog() {
//         return log;
//     }
//     public long getProcessId() {
//         return processId;
//     }
// 
//     public Iterator<Processor> getProcessingSteps() {
//         return processingSteps;
//     }
//     public int getProcessingStepNo() { return processingSteps.getProcessingStepNo(); }
// 
//     public StateMachineCallback getCompletionCallback() {
//         return completionCallback;
//     }
// 
//     public String appendResult(String newResult) {
//         return result += newResult;
//     }
//     public String getResult() {
//         return result;
//     }
// }
// 
// Path: spring-mvc-asynch/src/main/java/se/callista/springmvc/asynch/common/statemachine/StateMachineCallback.java
// public interface StateMachineCallback {
//     void onCompleted(State state);
//     void onFailure(State state, Throwable t);
// }


import org.springframework.web.context.request.async.DeferredResult;
import se.callista.springmvc.asynch.common.statemachine.State;
import se.callista.springmvc.asynch.common.statemachine.StateMachineCallback;
package se.callista.springmvc.asynch.common.deferredresult;


/**
 * Created by magnus on 08/06/14.
 */
public class DeferredResultStateMachineCallback implements StateMachineCallback {

    private DeferredResult deferredResult;

    public DeferredResultStateMachineCallback(DeferredResult deferredResult) {
        this.deferredResult = deferredResult;
    }

    @Override
// Path: spring-mvc-asynch/src/main/java/se/callista/springmvc/asynch/common/statemachine/State.java
// public class State {
// 
//     private static final AtomicLong lastProcessId = new AtomicLong(0);
// 
//     private StateProcessingStepIterator processingSteps;
//     private long processId;
//     private LogHelper log;
//     private StateMachineCallback completionCallback;
//     private String result = "";
// 
//     public State(Iterator<Processor> processingSteps, LogHelper log, StateMachineCallback completionCallback) {
//         this.processingSteps = new StateProcessingStepIterator(processingSteps);
//         this.log = log;
//         this.completionCallback = completionCallback;
//         this.processId = lastProcessId.incrementAndGet();
//     }
// 
//     public LogHelper getLog() {
//         return log;
//     }
//     public long getProcessId() {
//         return processId;
//     }
// 
//     public Iterator<Processor> getProcessingSteps() {
//         return processingSteps;
//     }
//     public int getProcessingStepNo() { return processingSteps.getProcessingStepNo(); }
// 
//     public StateMachineCallback getCompletionCallback() {
//         return completionCallback;
//     }
// 
//     public String appendResult(String newResult) {
//         return result += newResult;
//     }
//     public String getResult() {
//         return result;
//     }
// }
// 
// Path: spring-mvc-asynch/src/main/java/se/callista/springmvc/asynch/common/statemachine/StateMachineCallback.java
// public interface StateMachineCallback {
//     void onCompleted(State state);
//     void onFailure(State state, Throwable t);
// }


// Path: spring-mvc-asynch/src/main/java/se/callista/springmvc/asynch/common/deferredresult/DeferredResultStateMachineCallback.java
import org.springframework.web.context.request.async.DeferredResult;
import se.callista.springmvc.asynch.common.statemachine.State;
import se.callista.springmvc.asynch.common.statemachine.StateMachineCallback;

package se.callista.springmvc.asynch.common.deferredresult;


/**
 * Created by magnus on 08/06/14.
 */
public class DeferredResultStateMachineCallback implements StateMachineCallback {

    private DeferredResult deferredResult;

    public DeferredResultStateMachineCallback(DeferredResult deferredResult) {
        this.deferredResult = deferredResult;
    }

    @Override
    public void onCompleted(State state) {