Views

MyMobileWeb SWF Integration

From Morfeo Wiki

Jump to: navigation, search

Contents

First approach to the SWF-MyMW integration

In this section the starting touches of the integration are given by focusing on two aspects: how a MyMobileWeb application flow could be defined by using Spring Web Flow (SWF), and how the integration could be made. In this first approach only one flow definition per application and any subflow is considered.

How to define the application flow by using SWF [user point of view]

Change the flow Engine

Change the TidMobileFlowEngine to org.morfeo.mymw.server.flow.swf.SWFFlowEngine in the MyMobileWeb.Global.xml file.

Define the flow

Users should define a xml-file having into account the follow issues:

Spring Web Flow has five built-in concrete state types. These states execute common controller behaviors including:

  • allowing the user to participate in a flow (ViewState)
  • executing business application code (ActionState)
  • making a flow routing decision (DecisionState)
  • spawning another flow as a subflow (SubflowState)
  • terminating a flow (EndState)

And of course, SWF allows us to:

  • navigate among states (Transitions)

SWF specifies a concrete syntax in order to define a flow in a declarative way (XML-based Flow definition). This syntax allows the user to design their own flow by using the five states above and the appropriate transitions among them. Nevertheless, some attributes given by SWF and used to define a concrete state are related to how the flow manager architecture works. For instance, the attribute view of a view-state should indicate the page to be shown (an html, jsp, ...), but we have to go further in MyMobileWeb (we can't invoke jsp's while developing and we have to call OP's and navigate through presentations).

In this point, those all considerations dealing with MyMW way to define the attributes of each state will be presented:

ViewState

	<view-state id="..." view="...">
	</view-state>
    
  • id: it must be unique
  • view: this attribute will point out the presentation which must be rendered when the actual view-state is reached. The proper way to describe this attribute is as follows:
	view=”<OpName>_<PresentationName>”
    

The reasons why we have to indicate both the name of the OP and the name of the presentation are:

  • Specifying only the presentation name wouldn't be enough since you can define two presentations with the same name in different OPs
  • There is no other way to indicate in the XML that one presentation belongs to its corresponding OP (adding new attributes would mean changing the SWF actual syntax).

ActionState

SWF offers different ways to perform Actions:

Action type Methods to implement
Simple (extends AbstractAction)
	protected Event doPreExecute(RequestContext context) throws Exception {
		return null;
	}

	protected abstract Event doExecute(RequestContext context) throws Exception;

	protected void doPostExecute(RequestContext context) throws Exception {
	}
	
MultiAction (extends MultiAction)
		public Event ${method}(RequestContext context) throws Exception;
	
Bean action any special signature is required
EvaluateAction [not yet considered] ----------
SetAction [not yet considered] ----------

and it is possible to execute Actions from an ActionState, but also from other points of the flows:

Point Description XML Configuration Element
on flow start Each time a new flow session starts. A flow's <start-actions/>
on state entry Each time a state enters. A state's <entry-actions/>
on transition Each time a state transition is matched but before it is executed. A transition <action/>
on state exit Each time a transitionable state exits. A transitionable state's <exit-actions/>
before view rendering Each time a renderable view selection is made. A view state's <render-actions/>
on flow end Each time a flow session terminates. A flow's <end-actions/>


So, in MyMobileWeb an action-state could be implemented in two different ways.

If you don't need to get anything from the context
	<action-state id="action">
		<bean-action bean="TryOA" method="myMethod" >
		        <method-arguments>
			       <argument expression="..."/>
			</method-arguments>
		</bean-action>
		<transition on="success" to="page3"/>
	</action-state>
	
  • id: it must be unique
  • bean: The name of an existing OA.
  • method: The name of the method to be invoked in the corresponding OA. If users want to force a flow transition this method should return an event type object and the “on” attribute of the transition will take the name of those event.

In this case:

  • It's not necessary to extend the TryOA class from Action:
With this approach there are no requirements on the signature of the methods that carry out action execution, nor is there any requirement to extend from a Web Flow specific base class. Basically, you are not required to write a custom Action implementation at all--you simply instruct Spring Web Flow to call your business methods directly. The need for custom "glue code" to bind your web-tier to your middle-tier is eliminated. Spring Web Flow achieves this by automatically adapting the method on your existing application object to the Action interface and caring for exposing any return value in the correct scope.
  • You can specify declaratively the parameters which needs myMethod
  • myMethod can return an Event Object, but also one of the next Objects types and the appropriate conversion is done by SWF.


Return type Event identifier
boolean yes or no
java.lang.Enum this.name()
org.springframework.core.enum.LabeledEnum this.getLabel()
org.springframework.webflow.execution.Event this.getId()
java.lang.String the string
any other type success

That represents a significant change in the way OAs have to be designed. On one hand an OA can have several methods to be invoked, on the other we can specify the parameters in a declarative way, which means clarity and simplicity.

If you need to go through the context

ActionOA must extend from SWF org.springframework.webflow.execution.Action class. There are two ways for doing this:

  • ActionOA can extend from org.springframework.webflow.action.AbstractAction
    • It's not possible to indicate the name of the calling method, the doExecute method will always be invoked
    • It's necessary to override the method:
       protected abstract Event doExecute(RequestContext context) throws Exception; 
    • Optionally it's possible to override the methods:
       protected Event doPreExecute(RequestContext context) throws  Exception;
      protected void doPostExecute(RequestContext context) throws Exception; 
    • XML-flow definition example:
 
<action-state id="action">
	< action bean="ActionOA" >
	</ action>
	<transition on="success" to="page3"/>
</action-state>
  • ActionOA can extend from org.springframework.webflow.action.MultiAction
    • That option allows you to have two or more action execution methods into a single class.
    • In this case ActionOA execution methods must adhere to the following signature:
       public Event ${method}(RequestContext context) throws Exception; 
    • XML-flow definition example:
 
<action-state id="action">
	< action bean="ActionOA" method=”myMethod”>
	</ action>
	<transition on="success" to="page3"/>
</action-state>

Both options allows you to implement methods which receive the SWF RequestContext. We can get MyMobileWeb context from that RequestContext by calling the getExternalContext() method, as we do in the next ActionOA example:

Interface RequestContext:

public interface RequestContext {

	public FlowDefinition getActiveFlow() throws IllegalStateException;
  
	public StateDefinition getCurrentState() throws IllegalStateException;

	public MutableAttributeMap getRequestScope();
 
	public MutableAttributeMap getFlashScope();

	public MutableAttributeMap getFlowScope();

	public MutableAttributeMap getConversationScope();

	public ParameterMap getRequestParameters();

	public ExternalContext getExternalContext();

	public FlowExecutionContext getFlowExecutionContext();

	public Event getLastEvent();

	public TransitionDefinition getLastTransition();

	public AttributeMap getAttributes();

	public void setAttributes(AttributeMap attributes);

	public AttributeMap getModel();
}

ActionOA example

public class ActionOA extends AbstractAction {

	protected Event doExecute(RequestContext context) throws Exception {
	MYMWExternalContext mymwExternalContext= (MYMWExternalContext)context.getExternalContext();
	RequestData req=mymwExternalContext.getReq();
	String applicationAttribute=(String) req.getContext().getElementInScope("exampleAttribute", 
								ContextScopes.APPLICATION_SCOPE);
	System.out.println("The value of the exampleAttribute in the application context is "+applicationAttribute);
 	return new Event(this,"success");
	}
}

It would be possible to implement new classes extending from AbstractAction receiving directly the MyMobileWeb context or even both MyMobileWeb and SWF ones, so as MyMobileWeb users could extend from them to implement OAs. That discrepancy between the use of MyMW context or SWF one will be considered in the MyMobileWeb_SWF_Integration#Open points section.

DecisionState

<decision-state id="decision">
     <if test="${applicationScope.booleanAttribute}" then="page3" else="page1"/>
</decision-state>
  • id: it must be unique
  • test: A MYMW boolean expression.
  • then: Any state of the flow.

SubflowState

<subflow-state id="subflow" flow="flow2">
	<transition on="finish" to="page2"/>
</subflow-state>

EndState

Nothing special in this state.

Transitions

    <transition on="..." to="..."></transition>
    
  • on: The proper way to describe this attribute is as follows:
	on=”<MymwControl>_<MymwEvent>”
    

The on attribute of a transition inside a view-state requires an eventID, and this eventID must to be unique in the actual presentation. The easy way to get this id from MyMW is by mapping MymwControl (_C parameter in the request) plus MymwEvent (_E parameter in the request) to SWF eventID.

  • to: the id of any state in the flow
Transition executing exception handlers

The <transition/> element contains an exclusive on-exception attribute used to specify an exception-based criteria for transition execution. This allows you to transition the flow to another state on the occurrence of an exception. Transition executing exception handlers may be attached at the state and flow levels. For example you can write something like the code below if you want to transition from an event which has not previously been managed:

	<view-state id="..." view="...">
		<transition on="..." to="..."></transition>
		<transition on="..." to="..."></transition>
		<transition on-exception="org.springframework.webflow.engine.NoMatchingTransitionException" 
					to="..."/>
	</view-state>
	

Example 1

A very simple example is presented in order to see how to define a basic flow.

Let's imagine we want to define the next flow:

Image:Mmw_swf_flow1.JPG
Figure 1.-Basic flow

The XML-file should be something like this:

<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/webflow
			    http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">

	<start-state idref="page1" />
	
	<view-state id="page1" view="InitOp_page1">
	</view-state>
	
	<view-state id="page2" view="InitOp_page2">
		<transition on="lpage3_onclick" to="page3"></transition>
		<transition on="laction_onclick" to="action"></transition>
	</view-state>
	
	<action-state id="action">
		<bean-action bean="TryOA" method="myMethod">
		</bean-action>
                <transition on="success" to="page2"/>
	</action-state>
	
	<view-state id="page3" view="SecondOp_page3">
		<transition on="lpage4_onclick" to="page4"></transition>
	</view-state>

	<end-state id="page4" view="SecondOp_endState"/>
	
	<global-transitions>
                <transition on="lpage1_onclick" to="page1"></transition>
                <transition on="lpage2_onclick" to="page2"></transition>
        </global-transitions>
</flow>

Presentations should be like this:

Page1.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="mypresentation.css" type="text/css"?>
<mymw:document xmlns:mymw="http://morfeo-project.org/mymobileweb" id="page1">
  <mymw:head>
    <mymw:title>Page1</mymw:title>
  </mymw:head>
  <mymw:body>
    <mymw:p id="p1" class="vertical nowrap expand">
      <mymw:link id="lpage2">Go to page2</mymw:link>
    </mymw:p>
  </mymw:body>
</mymw:document>

Page2.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="mypresentation.css" type="text/css"?>
<mymw:document xmlns:mymw="http://morfeo-project.org/mymobileweb" id="page2">
  <mymw:head>
    <mymw:title>Page2</mymw:title>
  </mymw:head>
  <mymw:body>
    <mymw:p id="p1" class="vertical nowrap expand">
      <mymw:link id="lpage3">Go to page3</mymw:link>
      <mymw:link id="laction">Execute action</mymw:link>
    </mymw:p>
  </mymw:body>
</mymw:document>

Page3.xml

<?xml-stylesheet href="mypresentation.css" type="text/css"?>
<mymw:document xmlns:mymw="http://morfeo-project.org/mymobileweb" id="page3">
  <mymw:head>
    <mymw:title>Page3 (Second Op)</mymw:title>
  </mymw:head>
  <mymw:body>
    <mymw:p id="p1" class="vertical nowrap expand">
      <mymw:link id="lpage1">Go to page1</mymw:link>
      <mymw:link id="lpage2">Go to page2</mymw:link>
      <mymw:link id="lpage4">Go to page4</mymw:link>
    </mymw:p>
  </mymw:body>
</mymw:document>

endState.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="mypresentation.css" type="text/css"?>
<mymw:document xmlns:mymw="http://morfeo-project.org/mymobileweb" id="endState">
  <mymw:head>
    <mymw:title>End State</mymw:title>
  </mymw:head>
  <mymw:body></mymw:body>
</mymw:document>

And, finally, a very simple method for the ActionState could be:

public class TryOA  {

	public Event myMethod()
	{
               //put here your code    		
               return new Event(this,"success");
	}	

}

Example 2

[Available in https://svn.forge.morfeo-project.org/svn/mymobileweb/trunk/MyMobileWebProofsConcept/testSWF]

Let's see another simple example of how we could define a MyMW application by using SWF.

Let's imagine the web page described below:

  • Register: That's the entry page. It shows a simple form in which users have to fill:
    • Name
    • Surname
    • Age
    • Country (by select one of this: Spain, Argentina, USA, England or France)
  • Once the user have been registered a menu is shown with only two options:
    • Show personal details: this page shows the user information
    • Visit page: if users choose this option:
      • first we have to test he is 18 or older
        • if he's not he is redirected to the forbidden page and on back he will go to de register page again
        • if he is at least 18 his country is evaluated and depending on it, the user is redirected to one of:
          • English page: on back returns to the menu
          • Spanish page: on back returns to the menu
          • French page: on back returns to the menu

That simple example will allow us to see how we could define the flow of a basic application by using data from MyMW scopes in the XML-flow definition.

The flow definition would be:

<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/webflow
			    http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
	
	<start-actions>
		<action bean="MyOA" method="loadCountries" />
		<action bean="MyOA" method="loadDefaultValues" />
	</start-actions>
	
	<start-state idref="register" />
		
	<view-state id="register" view="Register_form1">
		<transition on="submit_onsubmit" to="menu"></transition>
	</view-state>
	
	<view-state id="menu" view="Menu_menu">
		<transition on="lop1_onclick" to="showUser"></transition>
		<transition on="lop2_onclick" to="testAge"></transition>
		<transition on="lback_onclick" to="register"></transition>
	</view-state>
	
	<view-state id="showUser" view="ShowUser_show">
	</view-state>

	<action-state id="testAge">
        	<bean-action bean="MyValidations" method="isAdult">
            		<method-arguments>
                		<argument expression="${sessionScope.age}"/>
             		</method-arguments>
         	</bean-action>
         	<transition on="yes" to="getLanguage"/>
         	<transition on="no" to="forbidden"/>
    	</action-state>
    
	<action-state id="getLanguage">
        	<bean-action bean="MyValidations" method="getLanguage">
            		<method-arguments>
                		<argument expression="${sessionScope.country}"/>
             		</method-arguments>
         	</bean-action>
         	<transition on="spanish" to="spanishInfo"/>
         	<transition on="english" to="englishInfo"/>
         	<transition on="french" to="frenchInfo"/>
         	<transition on="noLanguage" to="register"/>
    	</action-state>
	
	<view-state id="spanishInfo" view="Info_spanish">
	</view-state>
	
	<view-state id="englishInfo" view="Info_english">
	</view-state>
	
	<view-state id="frenchInfo" view="Info_french">
	</view-state>
	
	<view-state id="forbidden" view="Info_forbidden">
		<transition on="lback_onclick" to="register"></transition>
	</view-state>

	<global-transitions>
		<transition on="lback_onclick" to="menu"></transition>
    	</global-transitions>
</flow>

Note that all the method invocations are specify declaratively and we are delegating on MyMW to evaluate expressions as: expression="${sessionScope.country}" (this issue is considered in the open points).

The xml-definition of the presentations is shown below:

Register_form1

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="mypresentation.css" type="text/css"?>
<mymw:document xmlns:mymw="http://morfeo-project.org/mymobileweb" id="form1">
  <mymw:head>
    <mymw:title>Register</mymw:title>
  </mymw:head>
  <mymw:body>
    <mymw:p id="p1" class="nowrap expand grid2">
      <mymw:label id="labname">Name:</mymw:label>
      <mymw:entryfield labelid="labname" id="name" bind="${sessionScope.name}"></mymw:entryfield>
      <mymw:label id="labsurname">Surname:</mymw:label>
      <mymw:entryfield labelid="labsurname" id="surname" bind="${sessionScope.surname}"></mymw:entryfield>
      <mymw:label id="labsurname">Age:</mymw:label>
      <mymw:entryfield labelid="labage" id="age" bind="${sessionScope.age}" bindingtype="java.lang.Integer" validationtype="java.lang.Integer"></mymw:entryfield>
      <mymw:label id="labcountry">Country:</mymw:label>
      <mymw:select id="s1" bind="${sessionScope.country}" optionsbind="${sessionScope.countries}" keymember="key" textmember="text"></mymw:select>
    </mymw:p>
    <mymw:p id="p2" class="center">
      <mymw:submit id="submit" value="Send" principal="true"></mymw:submit>
    </mymw:p>
  </mymw:body>
</mymw:document>

Menu_menu

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="mypresentation.css" type="text/css"?>
<mymw:document xmlns:mymw="http://morfeo-project.org/mymobileweb" id="menu">
  <mymw:head>
    <mymw:title>menu</mymw:title>
  </mymw:head>
  <mymw:body>
    <mymw:p id="p1" class="nowrap expand vertical">
      <mymw:link id="lop1">Show personal details</mymw:link>
      <mymw:link id="lop2">Visit the page</mymw:link>
    </mymw:p>
    <mymw:p id="p2" class="center">
      <mymw:link id="lback">Back</mymw:link>
    </mymw:p>
  </mymw:body>
</mymw:document>

Info_english

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="mypresentation.css" type="text/css"?>
<mymw:document xmlns:mymw="http://morfeo-project.org/mymobileweb" id="english">
  <mymw:head>
    <mymw:title>English Info</mymw:title>
  </mymw:head>
  <mymw:body>
    <mymw:p id="p1">
      <mymw:label id="l1">Welcome ${name}!!</mymw:label>
    </mymw:p>
    <mymw:p id="p2" class="center">
      <mymw:link id="lback">Volver</mymw:link>
    </mymw:p>
  </mymw:body>
</mymw:document>

Info_forbidden

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="mypresentation.css" type="text/css"?>
<mymw:document xmlns:mymw="http://morfeo-project.org/mymobileweb" id="forbidden">
  <mymw:head>
    <mymw:title>Forbidden</mymw:title>
  </mymw:head>
  <mymw:body>
    <mymw:p id="p1">
      <mymw:label id="l1">Sorry, you are under 18.
  	  You cannot see this page.</mymw:label>
    </mymw:p>
    <mymw:p id="p2" class="center">
      <mymw:link id="lback">Volver</mymw:link>
    </mymw:p>
  </mymw:body>
</mymw:document>

And the OAs have been defined as follows:

MyOA

public class MyOA extends MYMWMultiAction {

	
	public Event loadCountries(Context context)
	{	 
			
		List aux = new ArrayList();		
		String[] countries = new String[]{"Spain","Argentina","USA", "England","France"};
		for(int j = 0; j < countries.length; j++) {
			HashMap map = new HashMap();
			map.put("key",countries[j]);
			map.put("text",countries[j]);
			aux.add(map);
		}
		context.setSessionElement("countries",(List)aux);

		return new Event(this,"success");
	}
	
	public Event loadDefaultValues(Context context)
	{	 
		String name="Your name";
		String surname="Your surname";
		String country="USA";
		int age=18;	
		context.setSessionElement("name",name);
		context.setSessionElement("surname",surname);
		context.setSessionElement("country",country);
		context.setSessionElement("age",age);
		
		return new Event(this,"success");
	}

}

MyOA extends from MYMWMultiAction instead of extending from SWF MultiAction in order to get directly the MYMW context in the implemented methods, but it could be possible to extend from MultiAction and get MyMW context from the SWF RequestContext.

MyValidations

public class MyValidations {


public String isAdult(Integer age)  {

	if(age.intValue()>=18) return "yes";
	return "no";
 }
	


public String getLanguage(String country)  {
	if(country.equals("Spain")||country.equals("Argentina"))
		return "spanish";
	if(country.equals("USA")||country.equals("England"))
		return "english";
	if(country.equals("France"))
		return "french";
	else return "noLanguage";
 }

}

How the first approach of the integration was made [technical aspects]

In this section, the basic points of the integration are mentioned.

The next class diagram shows the integration state:

Image:Mmw_swf_classDiagram1.JPG
Figure 2.-Class diagram

The new flow engine

As it was said, the first point in the integration is the change between the custom flow engine used by MyMW (TidMobileFlowEngine) and a new one called SWFFlowEngine .

Preparing the Flow Engine

When started the init() method of DriverHTTP class will invoke the setupFlowEngine() in AbstractAdapter. In this function the system loads the new SWFFlowEngine and calls its default constructor, so that's the point where all initializations needed are done:

  • Register all the OAs as java beans, so as they can be invoked from different parts of the flow by means of the pertinent <bean-action/>
  • Build the flow by parsing the flow definition xml file using the XmlFlowBuilder provided by SWF.
  • Prepare the flow executor by creating a new FlowExecutorImpl
  • Set up the argument handler by creating a new MYMWArgumentHandler, which extends FlowExecutorArgumentsHandler and implements three basic operations:
    • extractFlowId: only one simultaneous flow is considered and the corresponding flowId is stored in the session scope of the context.
    • extractFlowExecutionKey: only one simultaneous flow is considered and the corresponding flowId is stored in the context.
    • extractEventId: the new eventId is got from the request by using the _C and the _E parameters.

Managing requests

Each time a request is made the performApplicationFlow() method in SWFEngine is invoked. At this point a new MYMWExternalContext is built from the RequestData and the IactionExecutor parameters. A new FlowRequestHandler is built from the flowExecutor and the argumentHandler and the method handleRequest of this FlowRequestHandler will be the function in charge of creating a ResponseInstruction. Finally, the toMyMobileWeb() method will transform the ResponseInstruction contents into MyMobileWeb suitable calls.

Open points

How to manage MYMW context and SWF ones

SWF incorporates its own context, so a SWF user is supposed to use data from that context in the XML-based flow definition. However, it could be very useful to MyMW users to can define the flow by referencing MyMW context (as we did in the examples). The possible combination of data from both contexts could result a bit confused for users; on one hand SWF users are used to store data in the scopes offered by SWF and SWF is designed to use them, on the other we need to keep the actual state of MyMW context. A part from that some of the scopes offered by SWF crashes with MyMW ones.

Let's remember the different levels which compound MyMobileWeb context:

  • Application
  • Session
  • OP
  • Presentation
  • Request

Note that application, request and session scopes can all be acceded from J2EE pertinent structures.

And let's also introduce SWF context scopes:

  • Conversation scope: a managed scope that lives for the duration of an user dialog
  • Flow scope: a managed scope that lives for the duration of a flow executing within a conversation
  • Flash scope: a managed scope that lives for the duration of a view participating in a flow
  • Request scope

As we can see some scopes are very similar, as the presentation Scope of MyMW and the Flash scope of SWF.

Once all the scopes of both contexts have been introduced it is necessary to decide the way they can be used in the XML-flow definition. Let's analyse one of the action-states examples from SWF web. This example constructs an ActionState definition from XML that executes a single method on a Plain Old Java Object (POJO) and then responds to the result:

   
 <?xml version="1.0" encoding="UTF-8"?>
    		<flow xmlns="http://www.springframework.org/schema/webflow"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
              http://www.springframework.org/schema/webflow
              http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">

        <start-state idref="executeSearch"/>

        <action-state id="executeSearch">
            <bean-action bean="searchService" method="executeSearch">
                <method-arguments>
                    <argument expression="${flowScope.criteria}"/>
                </method-arguments>
                <method-result name="results" scope="flash"/>
            </bean-action>
            <transition on="success" to="displayResults"/>
        </action-state>

        ...

   </flow>

This state definition reads "when the executeSearch state is entered, call the executeSearch method on the searchService passing it the object indexed by name criteria in flowScope. On successful execution, expose the method return value in the flash scope under the name results and transition to the displayResults state."

This example show us how to define an action-state by using the SWF scopes. That means that the evaluation of the expressions which appears in the XML-flow definition will be resolved by SWF (using OGNL). However, as we have said before, it could be interesting to delegate the evaluation in the MyMobileWeb Expression Evaluator so we can use MyMobileWeb scopes as we used to do.

That opens several possibilities:

To combine MYMW context and SWF ones

  • That option would require the use of a new attribute in the existing tags to indicate the evaluator to use (MyMobileWeb or SWF)
     <argument expression="${flowScope.criteria}" eval="mymw"/> 

Advantages:

  • It would partially preserve the actual MYMW philosophy.
  • SWF users can define the flow in a similar way as they were used to do it.

Disadvantages:

  • It would mean to change the SWF-XML syntax by adding a new attribute
  • It could be unclear when to use SWF context or MYMW ones (some scopes are very similar: flash scope, request scope,...)

To use only MYMW context

Advantages:

  • It would mean to keep the actual MYMW philosophy.

Disadvantages:

  • It would mean to loose part of the SWF power

To use SWF context in the XML-flow definition and MyMW context as we used to do it

Advantages:

  • It would mean to preserve both SWF and MYMW ways to work

Disadvantages:

  • It could mean to do unnecessary data transfers between contexts in the OAs

Integration Report

A first spanish version of the integration report is available in https://svn.forge.morfeo-project.org/svn/mymobileweb/trunk/MyMobileWebProofsConcept/SWF_MYMW.pdf