org.jvoicexml
Interface DocumentServer

All Known Implementing Classes:
JVoiceXmlDocumentServer

public interface DocumentServer

A document server processes requests from a client application.

Since:
0.5.5
Version:
$Revision: 2830 $
Author:
Dirk Schnelle-Walka

Field Summary
static String TEXT_PLAIN
          Constant for the object type text/plain to retrieve.
static String TEXT_XML
          Constant for the object type text/xml to retrieve.
 
Method Summary
 AudioInputStream getAudioInputStream(String sessionId, URI uri)
          Retrieves an AudioStream to the audio file with the given URI.
 VoiceXmlDocument getDocument(String sessionId, DocumentDescriptor descriptor)
          Gets the document with the given URI.
 GrammarDocument getGrammarDocument(String sessionId, URI uri, FetchAttributes attributes)
          Returns the external Grammar referenced by URI.
 Object getObject(String sessionId, DocumentDescriptor descriptor, String type)
          Retrieves an object of the given type from the given URI.
 void sessionClosed(String sessionId)
          Notification that the given session is closed.
 URI storeAudio(AudioInputStream in)
          Stores the audio from the given stream.
 

Field Detail

TEXT_PLAIN

static final String TEXT_PLAIN
Constant for the object type text/plain to retrieve.

See Also:
Constant Field Values

TEXT_XML

static final String TEXT_XML
Constant for the object type text/xml to retrieve.

See Also:
Constant Field Values
Method Detail

getDocument

VoiceXmlDocument getDocument(String sessionId,
                             DocumentDescriptor descriptor)
                             throws BadFetchError
Gets the document with the given URI.

Parameters:
sessionId - the Id of the current JVoiceXML session
descriptor - descriptor for the document to fetch.
Returns:
VoiceXML document with the given URI.
Throws:
BadFetchError - The URI does not reference a document or an error occurred retrieving the document.

getGrammarDocument

GrammarDocument getGrammarDocument(String sessionId,
                                   URI uri,
                                   FetchAttributes attributes)
                                   throws BadFetchError
Returns the external Grammar referenced by URI.

If more than one grammar is available at the given URI, the grammar with the optional type is preferred. If preferredType is null, the ContentServer does not have to care about the preferredType.

Parameters:
sessionId - the Id of the current JVoiceXML session
uri - Where to find the grammar.
attributes - attributes governing the fetch.
Returns:
the grammar referenced by the URI.
Throws:
BadFetchError - The URI does not reference a document or an error occurred retrieving the document.

getAudioInputStream

AudioInputStream getAudioInputStream(String sessionId,
                                     URI uri)
                                     throws BadFetchError
Retrieves an AudioStream to the audio file with the given URI.

Parameters:
sessionId - the Id of the current JVoiceXML session
uri - URI of the audio file.
Returns:
AudioInputStream for the audio file.
Throws:
BadFetchError - Error retrieving the audio file.

getObject

Object getObject(String sessionId,
                 DocumentDescriptor descriptor,
                 String type)
                 throws BadFetchError
Retrieves an object of the given type from the given URI.

Parameters:
sessionId - the Id of the current JVoiceXML session
descriptor - descriptor for the document to fetch.
type - the type, e.g. text/plain.
Returns:
retrieved object
Throws:
BadFetchError - Error retrieving the object.
Since:
0.6

storeAudio

URI storeAudio(AudioInputStream in)
               throws BadFetchError
Stores the audio from the given stream.

Parameters:
in - stream to read the audio data from
Returns:
URI of the file.
Throws:
BadFetchError - Error writing.

sessionClosed

void sessionClosed(String sessionId)
Notification that the given session is closed. Now the document server may free any resources related to the given session.

Parameters:
sessionId - the Id of the current JVoiceXML session.
Since:
0.7


Copyright © 2005-2010JVoiceXML group.