home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / script-action.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  7.9 KB  |  255 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "document-v10.dtd">
  18. <!--
  19.   <![CDATA[ CVS Version: $Id: script-action.xml,v 1.5 2004/05/08 08:57:55 crossley Exp $ 
  20.   ]]>  
  21. --><document>
  22.   <header>
  23.     <title>ScriptAction in Cocoon</title>
  24.     <version>0.9</version>
  25.     <type>Technical document</type>
  26.     <authors>
  27.       <person email="huber@apache.org" name="Bernhard Huber" />
  28.     </authors>
  29.     <abstract>This document describes the ScriptAction of Cocoon.</abstract>
  30.   </header>
  31.   <body>
  32.     <s1 title="ScriptAction">
  33.       <table>
  34.         <tr>
  35.           <td>NAME</td>
  36.           <td>script</td>
  37.         </tr>
  38.         <tr>
  39.           <td>WHAT</td>
  40.           <td>The <code>ScriptAction</code> component is used to executes any
  41.           script that can be run by the BSF.</td>
  42.         </tr>
  43.         <tr>
  44.           <td>TYPE</td>
  45.           <td>Action</td>
  46.         </tr>
  47.         <tr>
  48.           <td>BLOCK</td>
  49.           <td>bsf</td>
  50.         </tr>
  51.         <tr>
  52.           <td>CLASS</td>
  53.           <td>org.apache.cocoon.action.ScriptAction</td>
  54.         </tr>
  55.         <tr>
  56.           <td>SINCE</td>
  57.           <td>Cocoon 2.1</td>
  58.         </tr>
  59.         <tr>
  60.           <td>CACHEABLE</td>
  61.           <td>not applicable</td>
  62.         </tr>
  63.       </table>
  64.     </s1>
  65.     <s1 title="Description">
  66.       <p>A simple action that executes any script that can be run by the BSF
  67.       system. BSF supports script languages like javascript, python, etc.</p>
  68.     </s1>
  69.     <s1 title="Usage">
  70.       <p>This Action is used for quick prototyping of Action, realizing an
  71.       Action in a script language instead of java language.</p>
  72.       <s2 title="Sitemap pipeline examples">
  73.         <p>The following sample executes the <code>script action/my-action.js</code>
  74.         for each URI matching pattern <code>*.vm</code>. If the ScriptAction
  75.         succeeds, the pipeline continues, invoking the VelocityGenerator, and
  76.         serializing the XML stream.</p>
  77.         <source><map:match pattern="*.vm">
  78.   <map:action type="script" src="action/my-action.js">
  79.     <map:generate type="velocity" src="{1}.vm"/>
  80.     <map:serialize/>
  81.   </map:action>
  82. </map:match>
  83. </source>
  84.       </s2>
  85.       <s2 title="Sitemap component configuration example">
  86.         <p>The following sample configures an ScriptAction, naming it
  87.         <code>script</code>.</p>
  88.         <source><map:actions...
  89.   <map:action name="script"
  90.     src="org.apache.cocoon.acting.ScriptAction"> 
  91.     logger="sitemap.action.script"/>    
  92.     <!-- optional action configuration -->
  93.     ...
  94. </map:actions>
  95. </source>
  96.       </s2>
  97.       <s2 title="Configuration">
  98.         <p>ScriptAction has no configuration options.</p>
  99.       </s2>
  100.       <s2 title="Setup">
  101.         <p>ScriptAction determines the name of the script getting executed
  102.         from its <code>src</code> attribute.</p>
  103.         <p>The language of the script file is auto-detected by the BSF system
  104.         from the extension of the script.
  105.         </p>
  106.         <p>The next table lists the default mapping of BSF:</p>
  107.         <table>
  108.           <tr>
  109.             <th>Script language</th>
  110.             <th>Extension</th>
  111.           </tr>
  112.           <tr>
  113.             <td>javascript</td>
  114.             <td>js</td>
  115.           </tr>
  116.           <tr>
  117.             <td>jacl</td>
  118.             <td>jacl</td>
  119.           </tr>
  120.           <tr>
  121.             <td>netrexx</td>
  122.             <td>nrx</td>
  123.           </tr>
  124.           <tr>
  125.             <td>java</td>
  126.             <td>java</td>
  127.           </tr>
  128.           <tr>
  129.             <td>javaclass</td>
  130.             <td>class</td>
  131.           </tr>
  132.           <tr>
  133.             <td>bml</td>
  134.             <td>bml</td>
  135.           </tr>
  136.           <tr>
  137.             <td>vbscript</td>
  138.             <td>vbs</td>
  139.           </tr>
  140.           <tr>
  141.             <td>jscript</td>
  142.             <td>jss</td>
  143.           </tr>
  144.           <tr>
  145.             <td>perlscript</td>
  146.             <td>pls</td>
  147.           </tr>
  148.           <tr>
  149.             <td>perl</td>
  150.             <td>pl</td>
  151.           </tr>
  152.           <tr>
  153.             <td>jpython</td>
  154.             <td>py</td>
  155.           </tr>
  156.           <tr>
  157.             <td>lotusscript</td>
  158.             <td>lss</td>
  159.           </tr>
  160.           <tr>
  161.             <td>xslt</td>
  162.             <td>xslt</td>
  163.           </tr>
  164.           <tr>
  165.             <td>pnuts</td>
  166.             <td>pnut</td>
  167.           </tr>
  168.           <tr>
  169.             <td>beanbasic</td>
  170.             <td>bb</td>
  171.           </tr>
  172.         </table>
  173.         <p>ScriptAction registers following objects before invoking the
  174.         script:</p>
  175.         <table>
  176.           <tr>
  177.             <th>name</th>
  178.             <th>Object Typ</th>
  179.             <th>Comment</th>
  180.           </tr>
  181.           <tr>
  182.             <td>resolver</td>
  183.             <td>SourceResolver</td>
  184.             <td>Cocoon's source resolver</td>
  185.           </tr>
  186.           <tr>
  187.             <td>objectModel</td>
  188.             <td>Map</td>
  189.             <td>Cocoon's object model</td>
  190.           </tr>
  191.           <tr>
  192.             <td>parameters</td>
  193.             <td>Parameters</td>
  194.             <td>Cocoon's action parameter</td>
  195.           </tr>
  196.           <tr>
  197.             <td>actionMap</td>
  198.             <td>Map</td>
  199.             <td>Used for passing objects from the script back to the
  200.             ScriptAction, and to Cocoon's sitemap</td>
  201.           </tr>
  202.           <tr>
  203.             <td>logger</td>
  204.             <td>Logger</td>
  205.             <td>Cocoon's logger of this ScriptAction</td>
  206.           </tr>
  207.           <tr>
  208.             <td>request</td>
  209.             <td>Request</td>
  210.             <td>Request provided by the object model</td>
  211.           </tr>
  212.           <tr>
  213.             <td>scriptaction</td>
  214.             <td>Action</td>
  215.             <td>The instance of this ScriptAction</td>
  216.           </tr>
  217.           <tr>
  218.             <td>manager</td>
  219.             <td>Manager</td>
  220.             <td>Cocoon's manager of this ScriptAction</td>
  221.           </tr>
  222.         </table>
  223.         <p>These objects are accessible from within the script.</p>
  224.       </s2>
  225.       <s2 title="Effect on Object Model and Sitemap Parameters">
  226.         <p>ScriptAction checks the existence of the key <code>scriptaction-continue</code>
  227.         in the <code>actionMap</code>. If this key exists ScriptAction returns
  228.         <code>actionMap</code>, otherwise <code>null</code> is returned.</p>
  229.         <p>Objects available in the <code>actionMap</code> are available in
  230.         the sitemap.</p>
  231.       </s2>
  232.     </s1>
  233.     <s1 title="Bugs/Caveats">
  234.       <p>Using ScriptAction relies heavily on the setting of the key
  235.       <code>scriptaction-continue</code> in the <code>mapAction</code>.</p>
  236.       <p>Be aware to provide script language implementation, beside BSF implementation.
  237.       </p>
  238.     </s1>
  239.     <s1 title="History">
  240.       <p>07-24-03: initial creation</p>
  241.       <p>04-02-04: Updated to Jakarta BSF</p>
  242.     </s1>
  243.     <s1 title="Copyright">
  244.       <p>Copyright (C) 1999-2004 The Apache Software Foundation. All rights
  245.       reserved.</p>
  246.     </s1>
  247.     <s1 title="See also">
  248.       <p><!-- Links to related components pages. -->A general documentation
  249.       about actions is available at <link href="../concepts/actions.html">Actions</link>.</p>
  250.       <p>Further Documentation visit <link
  251.       href="http://jakarta.apache.org/bsf/index.html">Jakarta BSF Project</link>.</p>
  252.     </s1>
  253.   </body>
  254. </document>
  255.