cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <>
Subject Re: Action proposal
Date Sat, 16 Sep 2000 23:48:57 GMT
On Sun, Sep 17, 2000 at 01:35:12AM +1000, Peter Donald wrote:
> At 02:48  16/9/00 +0200, you wrote:
> >Peter Donald wrote:
> >> 
> >> I finally got around to looking at action framework to see if it fitted all
> >> my needs. I tested it against the following applications I have developed
> >> in past.
> >> 
> >
> ><snip/>
> >
> >> Guess what C2 + proposed actions == 100% success :P
> >
> ><snip/>
> like that bit did you ? :P

Absolutetly :-))

> >> Now when a user tries to access a resource what happens ?
> >> First cocoon will build up a list or chain of implicit actions. (Implicit
> >> meaning those that are defined via the sitemap). Then it will parse
> >> cookies/post/get input to grab the explicit user submitted actions and
> >
> >Cocoon is not (or better will not) parse any cookies/post/get things.
> >This is delegated to the sitemap components because it is environment
> >specific.
> so how would you see a form working ?

A first Matcher selects the URI space of the app. Nested Matchers 
further divide the URI into app sections. Actions are processing 
the input (cookies/posts/gets) and put state information into the 
objectModel Map or maybe return a List of replacement values. 
Selectors and/or Matchers choose the right pipeline components 
base on the state information in the objectModel Map to produce 
the "next screen" and those Generators/Transformers use sources 
(src= attribute) that are specified in a List (that one mentioned 
above) an Action has returned to the sitemap engine.

> >> build an action chain out of them. However we don't want the user to be
> >> able to submit arbitary actions - we want control over this for security
> >> reasons - so this leads us to the next step: Action chains in sitemap
> >> 
> >> <map:action-chains default="none">
> >
> >No default. I think it goes at the level like <map:resources> and
> ><map:views>
> yup :}
> >To be consistent with the rest of the sitemap syntax I suggest using:
> >
> >  <map:action-chains>
> >    <map:action-chain name="data-entry">
> ><!--
> >      The type= attribute references a action defined in the 
> >      components actions section
> >-->
> >      <map:perform type="validate-form" />
> >      <map:perform type="save-form" />
> >    </map:action-chain>
> sounds good.
> >> The one last requirement is that remainin explicit actions in chain can be
> >> saved and deferred by some means programmatically.
> >
> >I suggest leave this for later and concentrate on actions and
> >action-chains.
> yep but it is important - almost every login action will do some rerouting :P

As I understand it the rerouting is made based on information i
available in parts like URI, cookies, post data etc. These 
information is available to the sitemap components and they can 
act on them like described above.

> >
> >> So in conclusion this is what C2 needs:
> >> 
> >> * building implict action chain (as per Giacomo's proposal)
> >> * building explicitly requested action chain (as per above or another
> method)
> >> * some way to push explicitly submitted actions onto stack and then pop and
> >> execute them later
> >
> >Ok, let me summarize to see if I grasped it:
> >
> >Explicit actions are those presented to the user in kinda control panels
> >or alike (do that, check this, etc.). From the sitemap point of view
> >they can be collected into action-chains. In the pipeline section of the
> >sitemap explicit Actions and especially action-chains do not have a way
> >to control sitemap evaluation flow by means of the List object an Action
> >may return and thus cannot have nested elements from the sitemap
> >namespace (Parameters should be allowed). Of course they can communicate
> >with other sitemap component ddduring pipeline evaluation time through
> >the objectModel Map. 
> hmm - right - I think. It may be useful for a explicit action to redirect
> to an error page or form page if the user badly formats an action - is this
> possible ?

Yes, it is. You use a <map:pipeline> element to put all your 
declarations into it. Each <map:pipeline> can have its own 
<map:handle-error> which is a spezial pipeline without a generator. 
If one of the components throws an Exception the <map:handle-error> 
part gets control. The special ErrorGenerator (maybe its called 
NotificationGenerator now, didn't remember) which produces a 
specific DTD of an Exception which your selected transformer in 
the <map:handle-error> can process into what ever you like.
> >Implicit actions are those which do processings like data validation and
> >signal the sitemap engine if nested elements are to be evaluated or not
> >by means of returning a List object or null. The List object is used to
> >substitute occurences of {n} in src attributes of nested sitemap
> >components (Generators, Transformers, Readers). The n in {n} is a number
> >representing the index into the last List returned by a component to the
> >sitemap engine. An expression like {../2} means the 2. element of the
> >List returned by the parent component of the last components returning a
> >List (and so on).
> I think so (not so familiar with C2 :P)

To be honest, you should make yourself more familiar with it
to understand what we are talking about or else we miss to
tell you details which are "well known" for us :P
> >The sitemap engine is only able to distinguish action-chains from
> >actions but not explicit actions from implicit action. The sitemap
> >engine will call ations in an action-chain in the order they are
> >defined. It's the responsability of the action itself to determine what
> >processing it should be doing. 
> right.
> >Any comments?
> Not really except how do use see explicit actions being triggered ? Do you
> have an action apply to sitemap that explicitly parses out data from
> cookies/put/get/post request ?

No, _you_ should make such an action available (or maybe there can 
be a general parametrizable Action defined that does what eveybody 
needs for). As I've said earlier, the sitemap engine 
doesn't do such thing because it is environment dependent. Look:

  <map:match pattern="myapp/**">
   <!-- this action will parse the cookies/post/get data
        and make the result of that examination available
        1. as state information in the objectModel Map
        2. by returning resource specifications in a List
   <map:act chain="parse-input-and-make-information-available-chain">
    <!-- this selector will choose among the information
         made available in the objectModel Map by the previous
    <map:select type="input-checker-selector">
     <map:when test="show-index">
      <!-- this generator is charged with the appropriate index
           resource specified in the List returned by the Action 
      <map:generate src="myapp/{1}/index"/>
     <map:when test="kill-task">
      <!-- this action kills a task that was spawned previously 
           by another action using data make available by the Action
      <map:act type="task-killer"/>
      <map:generate src="myapp/{1}/task-killing-status-page"/>
      <map:generate src="myapp/login"/>
   <map:transform src="myapp/general.xsl"/>
   <map:serialize type="html"/>
   <map:transform src="myapp/error-transformer.xsl"/>
   <map:transform src="myapp/general.xsl"/>
   <map:serialize type="html"/>

PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1  856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1  856 2201
Hintereichenstrasse 7                     Mobil: +41 (0)78 759 7703
CH-8166 Niederweningen          

View raw message