public final class JVoiceXmlDocumentServer extends java.lang.Object implements DocumentServer
DocumentServer.
This implementation offers an extensible support for multiple schemes. All
known handlers for schemes are held in a list of SchemeStrategys.
TEXT_PLAIN, TEXT_XML| Constructor and Description |
|---|
JVoiceXmlDocumentServer()
Creates a new object.
|
| Modifier and Type | Method and Description |
|---|---|
java.net.URI |
addGrammarDocument(java.lang.String sessionId,
GrammarDocument document)
Adds the given grammar document to the documents store and retrieves the
URI to access it.
|
void |
addSchemeStrategy(SchemeStrategy strategy)
Adds the given scheme strategy.
|
javax.sound.sampled.AudioInputStream |
getAudioInputStream(java.lang.String sessionId,
java.net.URI uri)
Retrieves an
AudioStream to the audio file with the given
URI. |
org.jvoicexml.xml.vxml.VoiceXmlDocument |
getDocument(java.lang.String sessionId,
DocumentDescriptor descriptor)
Gets the document with the given URI.
|
GrammarDocument |
getGrammarDocument(java.lang.String sessionId,
java.net.URI uri,
FetchAttributes attrs)
Returns the external Grammar referenced by
URI. |
java.lang.Object |
getObject(java.lang.String sessionId,
DocumentDescriptor descriptor,
java.lang.String type)
Retrieves an object of the given type from the given URI.
|
java.net.URI |
resolveBuiltinUri(java.net.URI uri)
Resolves the given URI ofg a builtin grammar to an URI that can be
handled by this document server.
|
void |
sessionClosed(java.lang.String sessionId)
Notification that the given session is closed.
|
void |
setDocumentStorage(DocumentStorage documentStorage)
Sets the document storage
|
void |
setFetchAttributes(FetchAttributes attrs)
Sets the default fetch attributes.
|
void |
setSchemeStrategies(java.util.List<SchemeStrategy> schemeStrategies)
Adds the given list of strategies for schemes to the supported schemes.
|
void |
start()
Starts this document server.
|
void |
stop()
Stops this document server.
|
java.net.URI |
storeAudio(javax.sound.sampled.AudioInputStream in)
Stores the audio from the given stream.
|
public JVoiceXmlDocumentServer()
This method should not be called by any application. Use
JVoiceXml.getDocumentServer() to obtain a reference to the
document server.
public void setDocumentStorage(DocumentStorage documentStorage)
documentStorage - the document storagepublic void start()
throws java.lang.Exception
start in interface DocumentServerjava.lang.Exception - error starting the document server.public void setSchemeStrategies(java.util.List<SchemeStrategy> schemeStrategies)
schemeStrategies - List with strategies.public void setFetchAttributes(FetchAttributes attrs)
attrs - default fetch attributes.public org.jvoicexml.xml.vxml.VoiceXmlDocument getDocument(java.lang.String sessionId,
DocumentDescriptor descriptor)
throws BadFetchError
getDocument in interface DocumentServersessionId - the Id of the current JVoiceXML sessiondescriptor - descriptor for the document to fetch.BadFetchError - The URI does not reference a document or an error occurred
retrieving the document.public void addSchemeStrategy(SchemeStrategy strategy)
strategy - Scheme strategy to be added.public java.net.URI resolveBuiltinUri(java.net.URI uri)
resolveBuiltinUri in interface DocumentServeruri - the builtin URIpublic java.net.URI addGrammarDocument(java.lang.String sessionId,
GrammarDocument document)
throws java.net.URISyntaxException
addGrammarDocument in interface DocumentServersessionId - the id of the initiating sessiondocument - the document to addjava.net.URISyntaxException - error generating the URI for the documentpublic GrammarDocument getGrammarDocument(java.lang.String sessionId, java.net.URI uri, FetchAttributes attrs) throws BadFetchError
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.
getGrammarDocument in interface DocumentServersessionId - the Id of the current JVoiceXML sessionuri - Where to find the grammar.attrs - attributes governing the fetch.BadFetchError - The URI does not reference a document or an error occurred
retrieving the document.public javax.sound.sampled.AudioInputStream getAudioInputStream(java.lang.String sessionId,
java.net.URI uri)
throws BadFetchError
AudioStream to the audio file with the given
URI.getAudioInputStream in interface DocumentServersessionId - the Id of the current JVoiceXML sessionuri - URI of the audio file.AudioInputStream for the audio file.BadFetchError - Error retrieving the audio file.public java.lang.Object getObject(java.lang.String sessionId,
DocumentDescriptor descriptor,
java.lang.String type)
throws BadFetchError
text/plain and text/xml are
supported.getObject in interface DocumentServersessionId - the Id of the current JVoiceXML sessiondescriptor - descriptor for the document to fetch.type - the type, e.g. text/plain.BadFetchError - Error retrieving the object.public java.net.URI storeAudio(javax.sound.sampled.AudioInputStream in)
throws BadFetchError
storeAudio in interface DocumentServerin - stream to read the audio data fromBadFetchError - Error writing.public void sessionClosed(java.lang.String sessionId)
sessionClosed in interface DocumentServersessionId - the Id of the current JVoiceXML session.public void stop()
DocumentServerstop in interface DocumentServer