org.jvoicexml.interpreter
Interface TagStrategy

All Known Implementing Classes:
IfStrategy

public interface TagStrategy

Strategy to execute a node representing executable content. This can happen in the following cases:

  1. Form initialization
  2. Tag execution by the FIA
  3. Processing of <catch> elements

Form initialization
Strategy of the interpreter and the FIA to initialize a form. When the VoiceXmlInterpreter iterates overall VoiceXML tags, and asks a TagStrategyFactory for a strategy how to initialize the current node. If a matching strategy was found, it is executed.

Tag execution by the FIA
Strategy of the FIA to execute a Node. When the FormInterpretationAlgorithm comes to a VoiceXML tag, it asks a TagStrategyFactory for a strategy how to process the current node. If a matching strategy was found, the strategy is executed.

Execution of a TagStrategy comprises the following steps:

  1. newInstance
    Create a working copy from the template.
  2. getAttributes
    Retrieve the current attributes from the node.
  3. evalAttributes
    Evaluate attributes, that need to be evaluated by the current script context
  4. validateAttributes
    Check, if all necessary information are present.
  5. execute
    Process the node.

The tags for which a TagStrategy exists are executable content. Executable content refers to a block of procedural logic. Such logic appears in:

Executable elements are executed in document order in their block of procedural logic. If an executable element generates an error, that error is thrown immediately. Subsequent executable elements in that block of procedural logic are not executed.

Version:
$Revision: 2670 $
Author:
Dirk Schnelle-Walka
See Also:
TagStrategyFactory, FormInterpretationAlgorithm, BlockFormItem, FieldFormItem, ObjectFormItem, RecordFormItem, SubdialogFormItem

Method Summary
 void dumpNode(VoiceXmlNode node)
          Debugging facility to display the contents of all attributes in the node.
 void evalAttributes(VoiceXmlInterpreterContext context)
          Evaluates all attributes which have to be evaluated by the scripting environment.
 void execute(VoiceXmlInterpreterContext context, VoiceXmlInterpreter interpreter, FormInterpretationAlgorithm fia, FormItem item, VoiceXmlNode node)
          Executes the strategy with the current parameters.
 void executeLocal(VoiceXmlInterpreterContext context, VoiceXmlInterpreter interpreter, FormInterpretationAlgorithm fia, FormItem item, VoiceXmlNode node)
          Executes the strategy with the current parameters local to a form item.
 void getAttributes(VoiceXmlInterpreterContext context, FormInterpretationAlgorithm fia, VoiceXmlNode node)
          Retrieves all attributes specified by the given node or by a <property> tag and stores their values in the working copy of this strategy.
 Collection<String> getEvalAttributes()
          Retrieves the names of all attributes, which have to be evaluated by the scripting environment.
 TagStrategy newInstance()
          Factory method to get a new instance of this strategy.
 void validateAttributes()
          Validates the attributes of the current node.
 

Method Detail

newInstance

TagStrategy newInstance()
Factory method to get a new instance of this strategy.

Returns:
Strategy that can be used in the FIA.
See Also:
FormInterpretationAlgorithm

getEvalAttributes

Collection<String> getEvalAttributes()
Retrieves the names of all attributes, which have to be evaluated by the scripting environment.

Returns:
Names of all attributes to be evaluated, null if the related node has not attributes to be evaluated.
Since:
0.3.1

getAttributes

void getAttributes(VoiceXmlInterpreterContext context,
                   FormInterpretationAlgorithm fia,
                   VoiceXmlNode node)
Retrieves all attributes specified by the given node or by a <property> tag and stores their values in the working copy of this strategy.

Parameters:
context - The current VoiceXML interpreter context.
fia - The current form interpretation algorithm, maybe null if there is no current fia.
node - The node to process.
Since:
0.3.1

evalAttributes

void evalAttributes(VoiceXmlInterpreterContext context)
                    throws SemanticError
Evaluates all attributes which have to be evaluated by the scripting environment.

Parameters:
context - The current VoiceXML interpreter context.
Throws:
SemanticError - Error evaluating a variable.
Since:
0.3.1

validateAttributes

void validateAttributes()
                        throws ErrorEvent
Validates the attributes of the current node. Check, if all needed attributes are provided.

Throws:
ErrorEvent - Validation failed.
Since:
0.3.1

execute

void execute(VoiceXmlInterpreterContext context,
             VoiceXmlInterpreter interpreter,
             FormInterpretationAlgorithm fia,
             FormItem item,
             VoiceXmlNode node)
             throws JVoiceXMLEvent
Executes the strategy with the current parameters.

Parameters:
context - The VoiceXML interpreter context.
interpreter - The current VoiceXML interpreter.
fia - The current form interpretation algorithm, maybe null if there is no current fia.
item - The current form item,maybe null if there is no current form item.
node - The current child node.
Throws:
JVoiceXMLEvent - Error while executing this strategy.

executeLocal

void executeLocal(VoiceXmlInterpreterContext context,
                  VoiceXmlInterpreter interpreter,
                  FormInterpretationAlgorithm fia,
                  FormItem item,
                  VoiceXmlNode node)
                  throws JVoiceXMLEvent
Executes the strategy with the current parameters local to a form item.

Parameters:
context - The VoiceXML interpreter context.
interpreter - The current VoiceXML interpreter.
fia - The current form interpretation algorithm, maybe null if there is no current fia.
item - The current form item,maybe null if there is no current form item.
node - The current child node.
Throws:
JVoiceXMLEvent - Error while executing this strategy.

dumpNode

void dumpNode(VoiceXmlNode node)
Debugging facility to display the contents of all attributes in the node.

Parameters:
node - The current node.
Since:
0.4


Copyright © 2005-2010JVoiceXML group.