You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de> on 2002/07/02 11:18:34 UTC

[ANNOUNCE] actions and modules for flow

I've just added support for Actions, InputModules, and OutputModules
to the JavaScript implementation of the flow component.

ACTIONS
=======

With this it is possible to call any action that is configured in the
sitemap (or any ancestor sitemap) with the following syntax:

		var x = act(type, src, parameters);

With "type" being the short-hand for the action (c.f. @type in
<map:act/>), "src" being the location of the action (c.f. @src in
<map:act/>), and "parameters" being an associative JavaScript array
containing the parameters that are passed to the action.

         *  All three parameters must be present.  *

The result of the action call is a java.util.Map wrapped to a
JavaScript associative array. If the action returned "null", this
array will be "null" as well. The array has a pseudo property "length"
and all values can be accessed by index in the same order as an
Iterator over the keySet() would do.

 Example:

  var x = act("request", "", {"parameters":"true", "default.dest":"invalid.html"});

 Caveat:

Some actions make use of the Redirector object passed to the action. I
have currently no idea how this could be incorporated into the flow in
a sane way. *Thus it is currently ignored.* Repeat: redirections done
by an action through the Redirector object are ignored.


MODULES
=======

InputModules can just be called with the inputValue function:

       var z = inputValue(type, parameter);

E.g. :

       var z = inputValue("request", "dest");

This is mapped to a call to getAttribute() of the InputModule known to
the ComponentManager as "request". Note that obtaining an array of
values or an enumeration of all available parameters is at this point
not supported.

The returned value is *not* wrapped for JavaScript but is of the very
type returned by the input module. Hence it exposes all the usual
methods.


OutputModules are supported completely. Three functions exist that
allow setting of attributes, rolling back, and committing attributes:

	  outputSet(type, attribute, value);

	  outputRollback(type);

	  outputCommit(type);

E.g. :

  outputSet("attribute", "dest", x.dest);
  outputSet("attribute", "a", x.a);
  outputSet("attribute", "x", x);
  outputCommit("attribute");


Have fun :-)

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


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


Re: [ANNOUNCE] actions and modules for flow

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 02.Jul.2002 -- 09:33 AM, Diana Shannon wrote:
> 
> On Tuesday, July 2, 2002, at 06:45  AM, Stefano Mazzocchi wrote:
> 
> >Chris, I have another strong feeling: without at least a sample and a
> >few lines of documentation about all this and what it is supposed to
> >achieve, nobody will ever use it, nor even give you feedback. So I'd
> >strongly suggest you to invest a few hours and provide them.
> 
> I have *no* doubt Chris will provide excellent docs, given his ongoing 
> track record. Within hours of the recent input module source commits of 
> Sylvain, Chris had updated modules.xml accordingly. Chris' docs related 
> to databases were noted by users as being great. From what I have seen, 
> in my short time observing the cvs, he keeps his docs up-to-date and 
> provides a great example for others.
> 
<blush/>

I'm currently creating an application using flow (my first,
actually). Once that is done I'll be happy to share it and document
it. I hope to finish it by the end of the week if everything works and
I did understand how to use flow correctly :-)

Apart from that, I believe the announcement contains enough for
someone who's familiar with Ovidiu's flow implementation to use
actions and modules from it and it will be the base for an upcoming
xdoc. Promised.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08



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


Re: [ANNOUNCE] actions and modules for flow

Posted by Diana Shannon <sh...@apache.org>.
On Tuesday, July 2, 2002, at 06:45  AM, Stefano Mazzocchi wrote:

> Chris, I have another strong feeling: without at least a sample and a
> few lines of documentation about all this and what it is supposed to
> achieve, nobody will ever use it, nor even give you feedback. So I'd
> strongly suggest you to invest a few hours and provide them.

I have *no* doubt Chris will provide excellent docs, given his ongoing 
track record. Within hours of the recent input module source commits of 
Sylvain, Chris had updated modules.xml accordingly. Chris' docs related 
to databases were noted by users as being great. From what I have seen, 
in my short time observing the cvs, he keeps his docs up-to-date and 
provides a great example for others.

Diana


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


Re: [ANNOUNCE] actions and modules for flow

Posted by Stefano Mazzocchi <st...@apache.org>.
Why do I have the feeling this is going to kick ourselves in the butt
big time?

Unfortunately, it's just a feeling, not really an alarm ringing... but
think I'll have to play with this.

Christian Haul wrote:
> 
> I've just added support for Actions, InputModules, and OutputModules
> to the JavaScript implementation of the flow component.
> 
> ACTIONS
> =======
> 
> With this it is possible to call any action that is configured in the
> sitemap (or any ancestor sitemap) with the following syntax:
> 
>                 var x = act(type, src, parameters);
> 
> With "type" being the short-hand for the action (c.f. @type in
> <map:act/>), "src" being the location of the action (c.f. @src in
> <map:act/>), and "parameters" being an associative JavaScript array
> containing the parameters that are passed to the action.
> 
>          *  All three parameters must be present.  *
> 
> The result of the action call is a java.util.Map wrapped to a
> JavaScript associative array. If the action returned "null", this
> array will be "null" as well. The array has a pseudo property "length"
> and all values can be accessed by index in the same order as an
> Iterator over the keySet() would do.
> 
>  Example:
> 
>   var x = act("request", "", {"parameters":"true", "default.dest":"invalid.html"});
> 
>  Caveat:
> 
> Some actions make use of the Redirector object passed to the action. I
> have currently no idea how this could be incorporated into the flow in
> a sane way. *Thus it is currently ignored.* Repeat: redirections done
> by an action through the Redirector object are ignored.

Yes. I've always thought that having a redirector in the actions was a
pretty nasty hack. Now that the flow has much better infrastructure for
redirection, it's good to ignore it.
 
> MODULES
> =======
> 
> InputModules can just be called with the inputValue function:
> 
>        var z = inputValue(type, parameter);
> 
> E.g. :
> 
>        var z = inputValue("request", "dest");
> 
> This is mapped to a call to getAttribute() of the InputModule known to
> the ComponentManager as "request". Note that obtaining an array of
> values or an enumeration of all available parameters is at this point
> not supported.
> 
> The returned value is *not* wrapped for JavaScript but is of the very
> type returned by the input module. Hence it exposes all the usual
> methods.
> 
> OutputModules are supported completely. Three functions exist that
> allow setting of attributes, rolling back, and committing attributes:
> 
>           outputSet(type, attribute, value);
> 
>           outputRollback(type);
> 
>           outputCommit(type);
> 
> E.g. :
> 
>   outputSet("attribute", "dest", x.dest);
>   outputSet("attribute", "a", x.a);
>   outputSet("attribute", "x", x);
>   outputCommit("attribute");
> 
> Have fun :-)

Chris, I have another strong feeling: without at least a sample and a
few lines of documentation about all this and what it is supposed to
achieve, nobody will ever use it, nor even give you feedback. So I'd
strongly suggest you to invest a few hours and provide them.

Anyway, thanks much for your effort on this :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------


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