org.apache.cocoon.selection
Class SimpleSelector

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.selection.AbstractSwitchSelector
          extended byorg.apache.cocoon.selection.SimpleSelector
All Implemented Interfaces:
LogEnabled, Selector, SwitchSelector, ThreadSafe

public class SimpleSelector
extends AbstractSwitchSelector
implements ThreadSafe

A very simple selector that operates on string literals, useful especially in conjunction with input modules. Usage example:

    <map:selector name="simple" src="org.apache.cocoon.selection.SimpleSelector"/>
 
    <map:select type="simple">
       <map:parameter name="value" value="{request:method}"/>
       <map:when test="GET">
           ...
       </map:when>
       <map:when test="POST">
           ...
       </map:when>
       <map:when test="PUT">
           ...
       </map:when>
       <map:otherwise>
           ...
       </map:otherwise>
    </map:select>
 

Since:
2.1
Version:
CVS $Id: SimpleSelector.java 30941 2004-07-29 19:56:58Z vgritsenko $
Author:
Christian Haul

Field Summary
 
Fields inherited from interface org.apache.cocoon.selection.SwitchSelector
ROLE
 
Constructor Summary
SimpleSelector()
           
 
Method Summary
 Object getSelectorContext(Map objectModel, Parameters parameters)
          Method to create a selector context.
 boolean select(String expression, Object selectorContext)
          Selectors test pattern against some objects in a Map model and signals success with the returned boolean value
 
Methods inherited from class org.apache.cocoon.selection.AbstractSwitchSelector
select
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSelector

public SimpleSelector()
Method Detail

getSelectorContext

public Object getSelectorContext(Map objectModel,
                                 Parameters parameters)
Description copied from class: AbstractSwitchSelector
Method to create a selector context.

Specified by:
getSelectorContext in interface SwitchSelector
Specified by:
getSelectorContext in class AbstractSwitchSelector
Parameters:
objectModel - The Map containing object of the calling environment which may be used to select values to test the expression.
parameters - The sitemap parameters, as specified by <parameter/> tags.
Returns:
selector context

select

public boolean select(String expression,
                      Object selectorContext)
Description copied from class: AbstractSwitchSelector
Selectors test pattern against some objects in a Map model and signals success with the returned boolean value

Specified by:
select in interface SwitchSelector
Specified by:
select in class AbstractSwitchSelector
Parameters:
expression - The expression to test.
Returns:
boolean Signals successful test.


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.