org.inria.ns.reflex.processor.xcl
Class ChooseAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.xcl.ChooseAction
All Implemented Interfaces:
Executable, Presentable, NamespaceContextFactory

public class ChooseAction
extends AbstractAction

The <xcl:choose> element selects one among a number of possible alternatives.

It consists of a sequence of <xcl:when> elements followed by an optional <xcl:otherwise> element.
Each <xcl:when> element has a single attribute, test, which specifies an expression.

<xcl:choose>
    <xcl:when test="{expression}">
        <!-- do something -->
    </xcl:when>
    <xcl:when test="{expression}">
        <!-- do something -->
    </xcl:when>
    <xcl:otherwise>
        <!-- do something else -->
    </xcl:otherwise>
</xcl:choose>

Author:
Philippe Poulard
See Also:
AlternativeAction

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Constructor Summary
ChooseAction(Element element, AbstractAction parent)
          Creates a new instance of ChooseAction.
 
Method Summary
 void addAction(AbstractAction action)
          Handle <xcl:when> and <xcl:otherwise> elements.
 void runAction(DataSet dataSet)
          Execute the action by choosing the appropriate branch.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for ChooseAction.
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction
addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChooseAction

public ChooseAction(Element element,
                    AbstractAction parent)
Creates a new instance of ChooseAction.

Parameters:
element - The element from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from
Method Detail

unmarshal

public static AbstractAction unmarshal(AbstractAction parent,
                                       Element element)
                                throws XMLException
XML unmarshaller for ChooseAction.

Parameters:
parent - The action depending from
e - The XML element to unmarshall.
Returns:
The ChooseAction created.
Throws:
UnmarshalException - When the element and its content is not those expected.
XMLException

addAction

public void addAction(AbstractAction action)
Handle <xcl:when> and <xcl:otherwise> elements.

Overrides:
addAction in class AbstractAction
Parameters:
action - A subelement.
See Also:
AlternativeAction, AbstractAction.addAction(org.inria.ns.reflex.processor.core.AbstractAction)

runAction

public void runAction(DataSet dataSet)
               throws ExecutionException,
                      XPathException
Execute the action by choosing the appropriate branch.

Overrides:
runAction in class AbstractAction
Parameters:
dataSet - The set of datas used when the action is running.
Throws:
ExecutionException - If the action can't be performed.
XPathException