org.apache.cocoon.acting
Class InputModuleAction

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.acting.AbstractAction
          extended byorg.apache.cocoon.acting.AbstractConfigurableAction
              extended byorg.apache.cocoon.acting.ConfigurableServiceableAction
                  extended byorg.apache.cocoon.acting.InputModuleAction
All Implemented Interfaces:
org.apache.cocoon.acting.Action, Configurable, Serviceable, ThreadSafe

public class InputModuleAction
extends org.apache.cocoon.acting.ConfigurableServiceableAction
implements ThreadSafe

Simple helper action to allow passing sitemap variables to InputModules.

Sitemap evaluation of input modules using the curly bracket syntax e.g. {defaults:skin} suffers from the fact that it is not possible to use a sitemap variable as part of the invocation like {defaults:{1})}. This action takes three parameters, the name of the input module, the attribute name, and whether to call getAttribute() or getAttributeValues(). Thus the above becomes

   <map:act type="inputmodule">
     <map:parameter name="module" value="defaults"/>
     <map:parameter name="attribute" value="{1}"/>
     <map:parameter name="single-value" value="false"/>
 
     <!-- do something with the result: "{1}" -->
 
   </map:act>
 
The action invokes the getAttributeValues() method and returns all results numbered from "0". If no result exists, "null" is returned and the nested block is skipped. The name of the input module to use may be preconfigured when declaring the action in your sitemap:
     <map:action name="inputmodule" 
                    src="org.apache.cocoon.acting.InputModuleAction" 
                    logger="sitemap.action.inputmodule">
        <module>defaults</module>
        <single-value>false</single-value>
     </map:action>
 

Version:
$Id: InputModuleAction.html 1304280 2012-03-23 11:18:01Z ilgrosso $
See Also:
InputModule

Field Summary
 
Fields inherited from class org.apache.cocoon.acting.ConfigurableServiceableAction
manager
 
Fields inherited from class org.apache.cocoon.acting.AbstractConfigurableAction
settings
 
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
 
Fields inherited from interface org.apache.cocoon.acting.Action
ROLE
 
Constructor Summary
InputModuleAction()
           
 
Method Summary
 Map act(org.apache.cocoon.environment.Redirector redirector, org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String source, Parameters parameters)
           
 void configure(Configuration conf)
           
 
Methods inherited from class org.apache.cocoon.acting.ConfigurableServiceableAction
service
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputModuleAction

public InputModuleAction()
Method Detail

act

public Map act(org.apache.cocoon.environment.Redirector redirector,
               org.apache.cocoon.environment.SourceResolver resolver,
               Map objectModel,
               String source,
               Parameters parameters)
        throws Exception
Specified by:
act in interface org.apache.cocoon.acting.Action
Throws:
Exception

configure

public void configure(Configuration conf)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException


Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.