Flux - The Smart Struts Config Generator

The Flux project
SourceForge.net Logo

Samples

A Home Banking Application

This an example of how UML activity diagrams can describe the workflow of a web application and what Flux generates from them. It has only been contrived for the purpose of demonstrating Flux features and, is of course, not suited as a model for a real life application.

The mini-application is divided into the root module and the three sub modules 'security', 'balance' and 'transfer'.

For each of these four modules a Rational Rose UML model file was created (workflow-root.mdl, workflow-security.mdl, workflow-balance.mdl and workflow-transfer.mdl).

After having drawn the diagrams they were exported from Rose as the XMI files xmi-root.xml, xmi-security.xml, xmi-balance.xml and xmi-transfer.xml.

The files struts-config.xml (root), struts-config-security.xml, struts-config-balance.xml, struts-config-transfer.xml were then each created by first making a re-named copy of struts-config-new_model.xml and then feeding it together with the corresponding XMI file into Flux.

The Root Module

Diagram

Generated struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- ========== Form Bean Definitions =================================== -->
<!-- ========== Global Forward Definitions ============================== -->
<!-- ========== Action Definitions ====================================== -->
  <action-mappings>
    <!--Generated by de.matthias_burbach.flux.StrutsConfigGenerator at Sat Aug 02 15:46:04 CEST 2003-->
    <!--Page Events-->
    <action path="/Page.Accounts" type="de.matthias_burbach.strux.DispatcherAction">
      <forward name="queryBalance" path="/Module.Balance.enter.do" />
      <forward name="transferMoney" path="/Module.Transfer.enter.do" />
    </action>
    <action path="/Page.GoodBye" type="de.matthias_burbach.strux.DispatcherAction" />
    <action path="/Page.WantMoreQuestion" type="de.matthias_burbach.strux.DispatcherAction">
      <forward name="no" path="/Module.Security.Logout.enter.do" />
      <forward name="yes" path="/Action.RetrieveAccounts.do" />
    </action>
    <action path="/Page.Welcome" type="de.matthias_burbach.strux.DispatcherAction">
      <forward name="start" path="/Module.Security.Login.enter.do" />
    </action>
    <!--Action Activities-->
    <action path="/Action.RetrieveAccounts" type="de.matthias_burbach.bank.workflow.root.RetrieveAccountsAction" name="rootForm">
      <forward name="hasSucceeded" path="/Page.Accounts.display.do" />
    </action>
    <!--Module Activities-->
    <action path="/Module.Balance.enter" type="de.matthias_burbach.strux.NestModuleAction">
      <forward name="doEnter" path="/balance/Action.QueryBalance.do" contextRelative="true" />
    </action>
    <action path="/Module.Balance.exit" type="de.matthias_burbach.strux.RelayAction">
      <forward name="hasFinished" path="/Page.WantMoreQuestion.display.do" />
    </action>
    <action path="/Module.Security.Login.enter" type="de.matthias_burbach.strux.NestModuleAction">
      <forward name="doEnter" path="/security/Action.CheckCredentials.do" contextRelative="true" />
    </action>
    <action path="/Module.Security.Login.exit" type="de.matthias_burbach.strux.RelayAction">
      <forward name="hasCancelled" path="/Page.GoodBye.display.do" />
      <forward name="hasSucceeded" path="/Action.RetrieveAccounts.do" />
    </action>
    <action path="/Module.Security.Logout.enter" type="de.matthias_burbach.strux.NestModuleAction">
      <forward name="doEnter" path="/security/Action.Logout.do" contextRelative="true" />
    </action>
    <action path="/Module.Security.Logout.exit" type="de.matthias_burbach.strux.RelayAction">
      <forward name="hasSucceeded" path="/Page.GoodBye.display.do" />
    </action>
    <action path="/Module.Transfer.enter" type="de.matthias_burbach.strux.NestModuleAction">
      <forward name="doEnter" path="/transfer/Page.TransferForm.display.do" contextRelative="true" />
    </action>
    <action path="/Module.Transfer.exit" type="de.matthias_burbach.strux.RelayAction">
      <forward name="hasFinished" path="/Page.WantMoreQuestion.display.do" />
    </action>
    <!--Page States-->
    <action path="/Page.Accounts.display" forward="/${locale}/Accounts.jsp" />
    <action path="/Page.GoodBye.display" forward="/${locale}/GoodBye.jsp" />
    <action path="/Page.WantMoreQuestion.display" forward="/${locale}/WantMoreQuestion.jsp" />
    <action path="/Page.Welcome.display" forward="/${locale}/Welcome.jsp" />
    <!--Final State-->
    <!--Non-modelled Action Mappings-->
  </action-mappings>
  <!-- ========== Controller Configuration ================================ -->
  <!-- ========== Message Resources Definitions =========================== -->
  <!-- ========== Plug Ins Configuration ================================== -->
</struts-config>

The Security Module

Diagram

Generated struts-config-security.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
  <!-- ========== Form Bean Definitions =================================== -->
  <!-- ========== Global Forward Definitions ============================== -->
  <!-- ========== Action Definitions ====================================== -->
  <action-mappings>
    <!--Generated by de.matthias_burbach.flux.StrutsConfigGenerator at Sat Aug 02 15:50:01 CEST 2003-->
    <!--Page Events-->
    <action path="/Page.LoginForm" type="de.matthias_burbach.strux.DispatcherAction">
      <forward name="cancel" path="/Action.Logout.do" />
      <forward name="login" path="/Action.Login.do" />
    </action>
    <!--Action Activities-->
    <action path="/Action.Login" type="de.matthias_burbach.bank.workflow.security.LoginAction" name="securityForm">
      <forward name="NOT_isLoggedIn" path="/Page.LoginForm.display.do" />
      <forward name="isLoggedIn" path="/FinalState.do?result=isLoggedIn" />
    </action>
    <action path="/Action.Logout" type="de.matthias_burbach.bank.workflow.security.LogoutAction" name="securityForm">
      <forward name="NOT_isLoggedIn" path="/FinalState.do?result=NOT_isLoggedIn" />
    </action>
    <!--Module Activities-->
    <!--Page States-->
    <action path="/Page.LoginForm.display" forward="/${locale}/LoginForm.jsp" />
    <!--Final State-->
    <action path="/FinalState" type="de.matthias_burbach.strux.UnNestModuleAction" />
    <!--Non-modelled Action Mappings-->
    </action-mappings>
    <!-- ========== Controller Configuration ================================ -->
    <!-- ========== Message Resources Definitions =========================== -->
    <!-- ========== Plug Ins Configuration ================================== -->
</struts-config>

The Balance Module

Diagram

Generated struts-config-balance.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
  <!-- ========== Form Bean Definitions =================================== -->
  <!-- ========== Global Forward Definitions ============================== -->
  <!-- ========== Action Definitions ====================================== -->
  <action-mappings>
    <!--Generated by de.matthias_burbach.flux.StrutsConfigGenerator at Sat Aug 02 17:45:43 CEST 2003-->
    <!--Page Events-->
    <action path="/Page.Balance" type="de.matthias_burbach.strux.DispatcherAction">
      <forward name="close" path="/Action.Close.do" />
    </action>
    <!--Action Activities-->
    <action path="/Action.Close" type="de.matthias_burbach.bank.workflow.balance.CloseAction" name="balanceForm">
      <forward name="hasFinished" path="/FinalState.do?result=hasFinished" />
    </action>
    <action path="/Action.QueryBalance" type="de.matthias_burbach.bank.workflow.balance.QueryBalanceAction" name="balanceForm">
      <forward name="hasSucceeded" path="/Page.Balance.display.do" />
    </action>
    <!--Module Activities-->
    <!--Page States-->
    <action path="/Page.Balance.display" forward="/${locale}/Balance.jsp" />
    <!--Final State-->
    <action path="/FinalState" type="de.matthias_burbach.strux.UnNestModuleAction" />
    <!--Non-modelled Action Mappings-->
  </action-mappings>
  <!-- ========== Controller Configuration ================================ -->
  <!-- ========== Message Resources Definitions =========================== -->
  <!-- ========== Plug Ins Configuration ================================== -->
</struts-config>

The Transfer Module

Diagram

Generated struts-config-transfer.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
  <!-- ========== Form Bean Definitions =================================== -->
  <!-- ========== Global Forward Definitions ============================== -->
  <!-- ========== Action Definitions ====================================== -->
  <action-mappings>
    <!--Generated by de.matthias_burbach.flux.StrutsConfigGenerator at Sat Aug 02 16:17:31 CEST 2003-->
    <!--Page Events-->
    <action path="/Page.Confirmation" type="de.matthias_burbach.strux.DispatcherAction">
      <forward name="close" path="/Action.Close.do" />
    </action>
    <action path="/Page.TransferForm" type="de.matthias_burbach.strux.DispatcherAction">
      <forward name="cancel" path="/Action.Close.do" />
      <forward name="transfer" path="/Action.Validate.do" />
    </action>
    <!--Action Activities-->
    <action path="/Action.CheckLimit" type="de.matthias_burbach.bank.workflow.transfer.CheckLimitAction" name="transferForm">
      <forward name="NOT_isLimitBreach" path="/Action.Transfer.do" />
      <forward name="isLimitBreach" path="/Page.TransferForm.display.do" />
    </action>
    <action path="/Action.Close" type="de.matthias_burbach.bank.workflow.transfer.CloseAction" name="transferForm">
      <forward name="hasFinished" path="/FinalState.do?result=hasFinished" />
    </action>
    <action path="/Action.Transfer" type="de.matthias_burbach.bank.workflow.transfer.TransferAction" name="transferForm">
      <forward name="hasSucceeded" path="/Page.Confirmation.display.do" />
    </action>
    <action path="/Action.Validate" type="de.matthias_burbach.bank.workflow.transfer.ValidateAction" name="transferForm">
      <forward name="NOT_hasValidInput" path="/Page.TransferForm.display.do" />
      <forward name="hasSucceeded" path="/Action.CheckLimit.do" />
    </action>
    <!--Module Activities-->
    <!--Page States-->
    <action path="/Page.Confirmation.display" forward="/${locale}/Confirmation.jsp" />
    <action path="/Page.TransferForm.display" forward="/${locale}/TransferForm.jsp" />
    <!--Final State-->
    <action path="/FinalState" type="de.matthias_burbach.strux.UnNestModuleAction" />
    <!--Non-modelled Action Mappings-->
  </action-mappings>
  <!-- ========== Controller Configuration ================================ -->
  <!-- ========== Message Resources Definitions =========================== -->
  <!-- ========== Plug Ins Configuration ================================== -->
</struts-config>