cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject [C2] Actions Purpose and Use
Date Fri, 09 Feb 2001 20:38:12 GMT
I am at a point where I need to create some actions for
a working prototype, unfortunately the documentation on
Actions is virtually non-existent.

If the folks who are familiar with it can help me sort
through the details, I can create some documentation for
using Actions in Cocoon.

JavaDoc Discrepancies
---------------------

There are discrepancies in the the JavaDocs, so I need
to sort them out.

Action.act returns a Map, However the JavaDocs state:

"Returns:
  "List  The returned List object with sitemap substitution
   values which can be used in subsequent elements attributes
   like src= using an xpath expression: src='mydir/{1}/foo'
   If the return value is null the processing inside the
   element will be skipped."

An example in the JavaDocs Comment (needs to be moved)
in LangSelect states you can do the following:

<map:actions>
  <map:action name="lang_select"
   src="org.apache.cocoon.acting.LangSelect"/>
</map:actions>

<map:match pattern="file">
  <map:act type="lang_select">
    <map:generate src="file_{1}.xml"/>
  </map:act>
  <map:serialize/>
</map:match>

In the LangSelect class, we return a Map with one
value: Map.put("lang", {result});

Issue: Maps do not preserve order, so if you have more
       than one parameter then you cannot be assured
       that the proper one is first.

Assumption: The JavaDocs are wrong, and the action works
            like this:

<map:actions>
  <map:action name="lang_select"
   src="org.apache.cocoon.acting.LangSelect"/>
</map:actions>

<map:match pattern="file">
  <map:act type="lang_select">
    <map:generate src="file_{lang}.xml"/>
  </map:act>
  <map:serialize/>
</map:match>

(Please note that instead of src="file_{1}" it is
 src="file_{lang}").

Also, The xxxEmployeeAction objects do not return
Maps, so anything internal gets skipped.

Configurations
--------------

I know that Actions can be configured like:

<map:actions>
  <map:action name="foo" src="com.infoplanning.customer.MyAction">
    <my-conf name="Foo"/>
    <use-connection name="akbar"/>
  </map:action>
</map:action>

However, sometimes I want to specify runtime configurations,
effectively using the same object for multiple cases.  I noticed
that the Action gets passed a Parameters object.  Does that mean
if I wanted runtime configurations I would be able to do this?:

<map:match>
  <map:act type="foo">
    <parameter name="override" value="myval"/>

    <map:generate src="file_{bar}.xml"/>
  </map:act>
</map:match>

Last configuration question: Assuming the above is true, would
I be able to do the following?:

<map:match>
  <map:act type="foo">
    <map:act type="{baz}">
      <parameter name="override" value="demo"/>

      <map:generate src="file_{bar}.xml"/>
    </map:act>
  </map:act>
</map:match>

Lastly, Action Sets
-------------------
In the demonstration webapp that comes with Cocoon, we use an
Action Set.

How do these work?  How does the Action Set know whether to
Add, Update, or Delete employees?

Mime
View raw message