Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 75225 invoked by uid 500); 9 Apr 2002 09:28:53 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 75147 invoked from network); 9 Apr 2002 09:28:52 -0000 Message-ID: From: Konstantin Piroumian To: "'Ulrich Mayring'" Cc: "'cocoon-dev@xml.apache.org'" Subject: [FLOWMAP] Flow script Date: Tue, 9 Apr 2002 13:29:40 +0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C1DFA9.13543F80" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_000_01C1DFA9.13543F80 Content-Type: text/plain; charset="koi8-r" Hi, Uli! Glad to see you back to Cocoon. So, here goes our approach to flow control. 1. The approach is quite simple: we have a component (Screen Flow Controller) that is called through a set of actions from the sitemap. Possible actions are the following (this is not the complete list): - start a flow - process input for the current state - cancel flow and some others that are related to the possibility to run multiple flows for a single user (get list of flows, set active flow, etc.). 2. Interaction with ScreenFlowController is performed through a simple interface method: handleEvent(Event event): State; Event object contains the event name (type: START, INPUT, CANCEL, etc.) and according data, that is gathered from the request (we perform mapping from request parameters to value objects - JavaBeans). State object contains current form id (we map it to real file name), response data (value objects that contain the model data for the current form) and some other information related to the state (in-process, finished, etc.). We place value objects into request attributes then use them to display the form with Struts' taglib (it's possible with Cocoon as well). 3. Typical usage scenario is the following: - on Start Flow request a flow controller is created then placed into the user session - start event is sent (called handleEvent(event)) to controller with script ID (assigned externally: from user request or sitemap/struts-config) - when event handling returned the new state then control is forwarded to the according handler (e.g.: ) When user submit some data then InputAction is called and performed the following: - current state is refreshed - an event is created - input parameters are mapped to value objects - event is sent to controller - new state is returned - control is forwarded to the according handler 4. So, as you see it's quite simple in usage. The most complex part is input data mapping to JavaBeans, but it's now can be easily solved using Ivelin's approach with Castor (or any other mapping tool). Another advantage of XML usage in this case is that it will be quite easy to implement a visual tool for flow editing, especially when direct EJB calls will be supported (this will allow to reduce the number of custom actions used in the flow script). 5. In the attached customer_reg_new.xml file you'll find my working draft of Customer Registration flow script. The real script is a little more complex and differ in some tag names, but I hope you'll get the idea. I've also attached a sample sitemap to show how it look like in Cocoon. 6. As a side note, I'd add that we had two implementations of ScreenFlowController: a local class that is placed in session and called like any other Cocoon components and the other is an EJB (a session bean) that acts on the EJB container side. It is also planned to implement flow script includes and forwards. I am open for critics and comments. -- Konstantin _________________________________________ Konstantin Piroumian Lead Developer ICQ#: 2297575 * Work Tel#: +7 095 795 0520 * 1288 * More ways to contact me i See more about me _________________________________________ ------_=_NextPart_000_01C1DFA9.13543F80 Content-Type: application/octet-stream; name="customer_reg_new.xml" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="customer_reg_new.xml" =0A= =0A= =0A= ------_=_NextPart_000_01C1DFA9.13543F80 Content-Type: application/octet-stream; name="sitemap.xmap" Content-Disposition: attachment; filename="sitemap.xmap" ------_=_NextPart_000_01C1DFA9.13543F80 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org ------_=_NextPart_000_01C1DFA9.13543F80--