Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-217

Improve the design of how FlowExecutionFactory and FlowExecutionStateRestorer relate




      Currently the FlowExecutionFactory and FlowExecutionStateRestorer are relatively unrelated concepts.

      The FlowExecutionFactory is part of the execution subsystem. It encapsulates creation of a FlowExecution. The default engine implementation provides the FlowExecutionImplFactory, which for instance uses a FlowExecutionListenerLoader to load and attach listeners to the created FlowExecution.

      The FlowExecutionStateRestorer is part of the execution repository subsystem. It's essentialy an optional concept. In practice it's used by all FlowExecutionRepository implementations since they all serialize out the FlowExecution so they need to restore it after loading it back in. One of the things that needs to be restored is the listeners attached to the FlowExecution. This is exactly what the FlowExecutionImplStateRestorer (from the default engine implementation) does.
      Note that in theory you could write a FlowExecutionRepository that never serialized out the FlowExecution. In that case there would ofcourse be no need to restore things and so no FlowExecutionStateRestorer is necessary (or a NoOpFlowExecutionStateRestorer).

      So we've currently got this situation where FlowExecutionFactory and FlowExecutionStateRestorer are conceptually unrelated. In practice however, they are related: the state restorer needs to restore the FlowExecution back into the state it had as configured by the factory, e.g. attaching the same listeners. So in practice we end up with having to configure the factory and state restorer independently but equivalently - not ideal. The FlowExecutorFactoryBean (from the config subsystem) servers as a configuration convenience that basically solves this problem in practice: it sets up a FlowExecutor with a FlowExecutionFactory and FlowExecutionStateRestorer that are equivalently configured.

      Still, we should look into improving this situation without having to use FlowExecutorFactoryBean.




            Unassigned Unassigned
            klr8 Erwin Vervaet
            0 Vote for this issue
            1 Start watching this issue