01: /*
02: * Copyright 2004-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.springframework.webflow.executor;
17:
18: import org.springframework.webflow.context.ExternalContext;
19: import org.springframework.webflow.core.FlowException;
20:
21: /**
22: * The central facade and entry-point service interface into the Spring Web Flow
23: * system for <i>driving the executions of flow definitions</i>. This interface
24: * defines a coarse-grained system boundary suitable for invocation by most
25: * clients.
26: * <p>
27: * Implementations of this interface abstract away much of the internal
28: * complexity of the web flow execution subsystem, which consists of launching
29: * and resuming managed flow executions from repositories.
30: *
31: * @author Keith Donald
32: */
33: public interface FlowExecutor {
34:
35: /**
36: * Launch a new execution of identified flow definition in the context of
37: * the current external client request.
38: * @param flowDefinitionId the unique id of the flow definition to launch
39: * @param context the external context representing the state of a request
40: * into Spring Web Flow from an external system
41: * @return the starting response instruction
42: * @throws FlowException if an exception occured launching the new flow
43: * execution
44: */
45: public ResponseInstruction launch(String flowDefinitionId,
46: ExternalContext context) throws FlowException;
47:
48: /**
49: * Resume an existing, paused flow execution by signaling an event against
50: * its current state.
51: * @param flowExecutionKey the identifying key of a paused flow execution
52: * that is waiting to resume on the occurrence of a user event
53: * @param eventId the user event that occured
54: * @param context the external context representing the state of a request
55: * into Spring Web Flow from an external system
56: * @return the next response instruction
57: * @throws FlowException if an exception occured resuming the existing flow
58: * execution
59: */
60: public ResponseInstruction resume(String flowExecutionKey,
61: String eventId, ExternalContext context)
62: throws FlowException;
63:
64: /**
65: * Reissue the last response instruction issued by the flow execution. This is
66: * a logical refresh operation that allows the "current response" to be
67: * re-issued. This operation is idempotent and does not affect the state of the flow
68: * execution.
69: * @param flowExecutionKey the identifying key of a paused flow execution
70: * that is waiting to resume on the ocurrence of a user event
71: * @param context the external context representing the state of a request
72: * into Spring Web Flow from an external system
73: * @return the current response instruction
74: * @throws FlowException if an exception occured retrieving the current
75: * response instruction
76: */
77: public ResponseInstruction refresh(String flowExecutionKey,
78: ExternalContext context) throws FlowException;
79: }
|