cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Taffelt" <frank.taff...@interface-business.de>
Subject Re: [RT] Flowmaps revisited
Date Wed, 10 Oct 2001 15:19:18 GMT
Hi,

great!!  I'm also very interested in this topic.

3 weeks ago, i also started to implement a statemachine as a controller in a
MVC scenario embedded in cocoon2 as the publishing layer.

it would be fine, to share all the ideas in this topic to make cocoon2 ready
for applications.
it's really funny, to see that others has the same things in mind !!

i will left the pro's and contra's because you explained them very well.

ok, here is my solution:

the flow is defined in a separate place:

<states init="forminit">

  <state name="forminit" view="forminit_view">
    <transition to="formaction">
      <event>add</event>
      <action name="add" fail="error"/>
    </transition>
    <transition to="formaction">
      <event>remove</event>
      <action name="remove" fail="error"/>
    </transition>
    <transition to="formsubmit">
      <event>submit</event>
      <action name="submit" fail="error"/>
    </transition>
  </state>

  <state name="formaction" view="formaction_view">
    <transition to="formaction">
      <event>add</event>
      <action name="add" fail="error"/>
    </transition>
    <transition to="formaction">
      <event>remove</event>
      <action name="remove" fail="error"/>
    </transition>
    <transition to="formsubmit">
      <event>submit</event>
      <action name="submit" fail="error"/>
    </transition>
  </state>

  <state name="navigation" view="nav_menu">
     <transition to="forminit">
      <event>nav</event>
      <condition type="request" name="choice" value="edit"/>
      <action name="initdata" fail="error"/>
    </transition>
  </state>

  <state name="formsubmit" view="formsubmit_view">
   </state>

  <state name="formcancel" view="formcancel_view"/>
  <state name="error" view="formerror_view"/>

</states>

the entry in the sitemap:

  <map:match pattern="fxforms-state/*.fxf">
   <map:act type="statemachine" src="&fxforms;/fxforms.xml">
     <map:parameter name="prefix" value="&fxforms;/actions/"/>
     <map:parameter name="eventgenerator"
value="de.ifbus.cocoon2.fxforms.FXFormsEventGenerator"/>
     <!-- the view parameter seems to be a bug !! -->
     <map:redirect-to resource="{../view}" target="{../1}"/>
   </map:act>
  </map:match>

the "eventgenerator"-parameter is responsible for generating application
depending events and delegates them to the statemachine for evaluating.

after evaluating the next state and applicationlogic (during the
transition), let cocoon publish the data
(redirecting to a sitemap defined resource) :


<map:resource name="forminit_view">
 <map:aggregate element="fxforms">
   <map:part src="cocoon:/fxforms/model/{target}.xml"/>
   <map:part src="cocoon:/fxforms/data/{target}.xml"/>
 </map:aggregate>
 <map:transform src="&fxforms;/stylesheets/fxforms_html.xsl"/>
 <map:transform src="&fxforms;/stylesheets/validation_layer.xsl"/>
 <map:serialize type="html"/>
</map:resource>

<map:resource name="formsubmit_view">
   <map:generate type="serverpages" src="&fxforms;/view/showdata.xsp"/>
   <map:serialize type="xml"/>
</map:resource>


showdata is a small xsp-page generating xml from the Application:

<!-- example -->
<data>
  <xsp:logic>
    DOMStreamer ds = new DOMStreamer (new
EmbeddedXMLPipe(this.xmlConsumer));
    <!-- the data is stored in the session, i think there are better ways
for doing that -->
    Document doc =
(Document )request.getSession(true).getAttribute("FXFORMS_DATA_XPATH");
    ds.stream (doc);
  </xsp:logic>
</data>

A possible problem can occur if a page is opening an extra window (with
javascript) in the application flow. The application is in 2 parallel states
at the same time. A possible solution can be a FSM with substates ??

I hope to give this discussion some new sights and would like to get some
feedback in this topic.

Frank





























---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message