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

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

public class CallAction
extends AbstractAction

The <xcl:call> element calls a logic procedure.

<xcl:call logic="myFunction">
    <xcl:param name="input" value="{$myParam}"/>
    <xcl:keep name="myResult" value="{$output}" scope="global"/>
 </xcl:call>

Parameters and return values

At runtime, the procedure called has its own set of local datas. The call action may pass parameters to the logic procedure with the <xcl:param> element. Global and shared properties are accessible by the logic procedure.

As the logic procedure may store new properties within the local data set, the caller logic procedure can declare which of them must be kept thanks to the <xcl:keep> element. Each other property defined locally by the called logic procedure is not kept.

Example

    <xcl:call logic="duplicate-string">
        <xcl:param name="the-string" value="Hello world !"/>
        <xcl:keep name="dup" value="{$dup-string}"/>
    </xcl:call>

 <!-- .../... -->

<xcl:logic name="duplicate-string">
    <xcl:set name="dup-string" value="{$the-string} {$the-string}"/>
</xcl:logic>

Author:
Philippe Poulard
See Also:
ExitException

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
CallAction(QExpression logic, Node node, AbstractAction parent)
          Creates a new instance of CallAction.
 
Method Summary
 void addAction(AbstractAction action)
          Handle <xcl:keep> elements.
 void runAction(DataSet dataSet)
          Execute the action by calling the appropriate logic function.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for CallAction.
 
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

CallAction

public CallAction(QExpression logic,
                  Node node,
                  AbstractAction parent)
           throws XPathException
Creates a new instance of CallAction.

Parameters:
logic - The logic name of the function, as a qualified name.
node - The node from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Throws:
XPathException - When the logic procedure name can't be processed.
Method Detail

unmarshal

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

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

addAction

public void addAction(AbstractAction action)
Handle <xcl:keep> elements.

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

runAction

public void runAction(DataSet dataSet)
               throws ExecutionException,
                      XPathException
Execute the action by calling the appropriate logic function.

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