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.execution;
17:
18: import org.springframework.webflow.core.collection.AttributeMap;
19: import org.springframework.webflow.core.collection.MutableAttributeMap;
20: import org.springframework.webflow.definition.FlowDefinition;
21:
22: /**
23: * Provides contextual information about a flow execution. A flow execution is
24: * an runnable instance of a {@link FlowDefinition}. In other words, it is the
25: * central Spring Web Flow construct for carrying out a conversation with a
26: * client. This immutable interface provides access to runtime information
27: * about the conversation, such as it's {@link #isActive() status} and
28: * {@link #getActiveSession() current state}.
29: * <p>
30: * An object implementing this interface is also traversable from a execution
31: * request context (see
32: * {@link org.springframework.webflow.execution.RequestContext#getFlowExecutionContext()}).
33: * <p>
34: * This interface provides information that may span more than one request in a
35: * thread safe manner. The {@link RequestContext} interface defines a <i>request
36: * specific</i> control interface for manipulating exactly one flow execution
37: * locally from exactly one request.
38: *
39: * @see FlowDefinition
40: * @see FlowSession
41: * @see RequestContext
42: *
43: * @author Keith Donald
44: * @author Erwin Vervaet
45: */
46: public interface FlowExecutionContext {
47:
48: /**
49: * Returns the root flow definition associated with this executing flow.
50: * <p>
51: * A call to this method always returns the same flow definition -- the
52: * top-level "root" -- no matter what flow may actually be active (for
53: * example, if subflows have been spawned).
54: * @return the root flow definition
55: */
56: public FlowDefinition getDefinition();
57:
58: /**
59: * Is the flow execution active?
60: * <p>
61: * All methods on an active flow execution context can be called
62: * successfully. If the flow execution is not active, a caller cannot access
63: * some methods such as {@link #getActiveSession()}.
64: * @return true if active, false if the flow execution has terminated
65: */
66: public boolean isActive();
67:
68: /**
69: * Returns the active flow session of this flow execution. The active flow
70: * session is the currently executing session -- it may be the "root flow"
71: * session, or it may be a subflow session if this flow execution has
72: * spawned a subflow.
73: * @return the active flow session
74: * @throws IllegalStateException if this flow execution has not been started
75: * at all or if this execution has ended and is no longer actively executing
76: */
77: public FlowSession getActiveSession() throws IllegalStateException;
78:
79: /**
80: * Returns a mutable map for data held in "conversation scope". Conversation
81: * scope is a data structure that exists for the life of this flow execution
82: * and is accessible to all flow sessions.
83: * @return conversation scope
84: */
85: public MutableAttributeMap getConversationScope();
86:
87: /**
88: * Returns runtime execution attributes that may influence the behavior of
89: * flow artifacts, such as states and actions.
90: * @return execution attributes
91: */
92: public AttributeMap getAttributes();
93: }
|