public interface FlowBuilder
init(FlowBuilderContext)
.
buildVariables()
to create any variables of the flow and add them to the flow definition.
buildInputMapper()
to create and set the input mapper for the flow.
buildStartActions()
to create and add any start actions to the flow.
buildStates()
to create the states of the flow and add them to the flow definition.
buildGlobalTransitions()
to create any transitions shared by all states of the flow and add them to
the flow definition.
buildEndActions()
to create and add any end actions to the flow.
buildOutputMapper()
to create and set the output mapper for the flow.
buildExceptionHandlers()
to create the exception handlers of the flow and add them to the flow
definition.
getFlow()
to return the fully-built Flow
definition.
dispose()
.
Implementations should encapsulate flow construction logic, either for a specific kind of flow, for example, an
OrderFlowBuilder
built in Java code, or a generic flow builder strategy, like the
XmlFlowBuilder
, for building flows from an XML-definition.
Flow builders are used by the FlowAssembler
, which acts as an assembler (director). Flow Builders may be
reused, however, exercise caution when doing this as these objects are not thread safe. Also, for each use be sure to
call init, followed by the build* methods, getFlow, and dispose completely in that order.
This is a good example of the classic GoF builder pattern.
Flow
,
FlowBuilderContext
,
FlowAssembler
Modifier and Type | Method and Description |
---|---|
void |
buildEndActions()
Builds any end actions to execute when the flow ends.
|
void |
buildExceptionHandlers()
Creates and adds all exception handlers to the flow built by this builder.
|
void |
buildGlobalTransitions()
Builds any transitions shared by all states of the flow.
|
void |
buildInputMapper()
Builds the input mapper responsible for mapping flow input on start.
|
void |
buildOutputMapper()
Builds the output mapper responsible for mapping flow output on end.
|
void |
buildStartActions()
Builds any start actions to execute when the flow starts.
|
void |
buildStates()
Builds the states of the flow.
|
void |
buildVariables()
Builds any variables initialized by the flow when it starts.
|
void |
dispose()
Shutdown the builder, releasing any resources it holds.
|
Flow |
getFlow()
Get the fully constructed and configured Flow object.
|
java.lang.String |
getFlowResourceString()
Returns a string describing the location of the flow resource; the logical location where the source code can be
found.
|
boolean |
hasFlowChanged()
As the underlying flow managed by this builder changed since the last build occurred?
|
void |
init(FlowBuilderContext context)
Initialize this builder.
|
void init(FlowBuilderContext context) throws FlowBuilderException
context
- the flow builder contextFlowBuilderException
- an exception occurred building the flowvoid buildVariables() throws FlowBuilderException
FlowBuilderException
- an exception occurred building the flowvoid buildInputMapper() throws FlowBuilderException
FlowBuilderException
- an exception occurred building the flowvoid buildStartActions() throws FlowBuilderException
FlowBuilderException
- an exception occurred building the flowvoid buildStates() throws FlowBuilderException
FlowBuilderException
- an exception occurred building the flowvoid buildGlobalTransitions() throws FlowBuilderException
FlowBuilderException
- an exception occurred building the flowvoid buildEndActions() throws FlowBuilderException
FlowBuilderException
- an exception occurred building the flowvoid buildOutputMapper() throws FlowBuilderException
FlowBuilderException
- an exception occurred building the flowvoid buildExceptionHandlers() throws FlowBuilderException
FlowBuilderException
- an exception occurred building this flowFlow getFlow() throws FlowBuilderException
FlowBuilderException
- an exception occurred building this flowvoid dispose() throws FlowBuilderException
init(FlowBuilderContext)
method.FlowBuilderException
- an exception occurred building this flowboolean hasFlowChanged()
java.lang.String getFlowResourceString()