XML Workflow File

The goal of the Service to Worker pattern is to maintain separation between actions, views, and controllers, analgous workflow. A workflow is a sequence of tasks that must be performed in a specific order. While it would be easy enough to build this workflow based on the Front Controller pattern, we would like the result to be extensible. We want to be able to add pages and actions without changing the front controller Ideally we would like to specify our workflow in XML so we could change the order of pages without even modifying the dispatcher. The dispatcher then a simple state machine. When a request is submitted, the dispatcher determines the current state of the session and runs the corresponding action. If the action succeeds, there is a transition to the next state. Once the state is determined, control is forwarded to the associate view.

This example is based loosely on a proposed workflow language for struts framework, part of the Apache project. Additional information is availible from http://struts.apache.org/

XML File

< ?xml version="1.0" encoding="UTF-8"? >
< Workflow>
< state name='login" action="LogInAction" viewURI="login.jsp" / >
< state name='language" action="LanguageAction" viewURI="language.htm" / >
< state name='display" action="RestartAction" viewURI="display.jsp" / >
< /Workflow>