예제 #1
0
  /** {@inheritDoc} */
  public void execute(
      final VoiceXmlInterpreterContext context,
      final VoiceXmlInterpreter interpreter,
      final FormInterpretationAlgorithm fia,
      final FormItem item,
      final VoiceXmlNode node)
      throws JVoiceXMLEvent {
    if (nextItem != null) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("going to item '" + nextItem + "'...");
      }
      throw new GotoNextFormItemEvent(nextItem);
    }

    if (next.startsWith("#")) {
      final String nextForm = next.substring(1);
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("going to form '" + nextForm + "'...");
      }
      throw new GotoNextFormEvent(nextForm);
    } else {
      final URI uri;
      try {
        uri = new URI(next);
      } catch (java.net.URISyntaxException use) {
        throw new BadFetchError(use);
      }

      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("going to uri '" + uri + "'...");
      }

      final DocumentDescriptor descriptor = new DocumentDescriptor(uri);
      final FetchAttributes attributes = getFetchAttributes();
      descriptor.setAttributes(attributes);
      final VoiceXmlDocument document = context.loadDocument(descriptor);
      final URI resolvedUri = descriptor.getUri();
      throw new GotoNextDocumentEvent(resolvedUri, document);
    }
  }