public final class JVoiceXmlGrammarProcessor extends java.lang.Object implements GrammarProcessor
GrammarProcessor is the main entry point for grammar
processing.| Constructor and Description |
|---|
JVoiceXmlGrammarProcessor()
Private constructor to prevent manual instantiation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
init(Configuration configuration)
Initializes this component with data from the given configuration object.
|
GrammarDocument |
process(VoiceXmlInterpreterContext context,
FetchAttributes attributes,
org.jvoicexml.xml.srgs.Grammar grammar,
java.util.Locale language)
Give in grammar into this processor and let it do it's job.
|
void |
setGrammaridentifier(GrammarIdentifierCentral central)
Sets the central to identify grammars.
|
public JVoiceXmlGrammarProcessor()
public void init(Configuration configuration) throws ConfigurationException
GrammarIdentifiers
from the configuration. They can also be added manually by
GrammarIdentifierCentral.addIdentifier(GrammarIdentifier) TODO
Rewrite the configuration to let the centrals be configured.init in interface Configurableconfiguration - the current configuration, maybe nullConfigurationException - error initializing the component.public void setGrammaridentifier(GrammarIdentifierCentral central)
central - GrammarIdentifierCentralpublic GrammarDocument process(VoiceXmlInterpreterContext context, FetchAttributes attributes, org.jvoicexml.xml.srgs.Grammar grammar, java.util.Locale language) throws NoresourceError, BadFetchError, UnsupportedFormatError, SemanticError
Ok, to be a more specific, here is a short briefing, what is done to the grammar:
First of all, the grammar node is going to be walked along to check it's attributes and children. If it has a "src" attribut as well as an inline grammar an "error.badfetch" is thrown.
External grammars referenced by the src attribute as well as
external rule expansions are going to be fetched. This is done
in a loop until all external grammars are loaded.
While fetching all grammars one by one, the type and language
is going to be checked.
If a unsupported grammar type is referenced an
"UnsupportedFormatError" is thrown.
If a grammar for an unsupported language is fetched
"UnsupportedLanguageError" is thrown.
process in interface GrammarProcessorcontext - the current context.attributes - attributes governing the fetch.grammar - the grammar to processlanguage - the default xml:lang attributeNoresourceError - Error accessing the input device.BadFetchError - If the document could not be fetched successfully.UnsupportedFormatError - If an unsupported grammar has to be processed.SemanticError - if there was an error evaluating a scripting expression