class Jsapi10SpokenInput implements SpokenInput, StreamableSpokenInput {

    public void activateGrammars(
            final Collection<GrammarImplementation<? extends Object>> grammars)
            throws BadFetchError, UnsupportedLanguageError, NoresourceError {
        if (recognizer == null) {
            throw new NoresourceError("No recognizer available!");
        }

        boolean changedGrammar = false;
        for (GrammarImplementation<? extends Object> current : grammars) {
            if (current instanceof RuleGrammarImplementation) {
                final RuleGrammarImplementation ruleGrammar = (RuleGrammarImplementation) current;
                final String name = ruleGrammar.getName();
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("activating grammar '" + name + "'...");
                }

                final RuleGrammar grammar = recognizer.getRuleGrammar(name);
                if (!grammar.isEnabled()) {
                    changedGrammar = true;
                    grammar.setEnabled(true);
                    grammar.setActivationMode(Grammar.RECOGNIZER_FOCUS);
                }
            }
        }

        // Commit the changes if changes were made.
        if (changedGrammar) {
            try {
                recognizer.commitChanges();
            } catch (GrammarException e) {
                throw new BadFetchError(e.getMessage(), e);
            } catch (EngineStateError e) {
                throw new BadFetchError(e.getMessage(), e);
            }
        }
        if (LOGGER.isDebugEnabled()) {
            dumpLoadedGrammars();
        }
    }

    public  Jsapi10SpokenInput(final RecognizerModeDesc defaultDescriptor);

}