org.jvoicexml.documentserver.schemestrategy
Class DocumentMap

java.lang.Object
  extended by org.jvoicexml.documentserver.schemestrategy.DocumentMap
All Implemented Interfaces:
MappedDocumentRepository

public final class DocumentMap
extends Object
implements MappedDocumentRepository

Implementation of the MappedDocumentRepository.

Version:
$Revision: 1.1 $

Copyright © 2005 JVoiceXML group - http://jvoicexml.sourceforge.net/

Author:
Dirk Schnelle

Field Summary
private  Map<URI,String> documents
          A simple mapping of a URI to any document.
private static Logger LOGGER
          Logger for this class.
private static DocumentMap REPOSITORY
          The singleton.
 
Constructor Summary
private DocumentMap()
          Do not create from outside.
 
Method Summary
 void addDocument(URI uri, String document)
          Adds the given document to this repository.
 void addDocument(URI uri, VoiceXmlDocument document)
          Adds the given document to this repository.
 String getDocument(URI uri)
          Gets the document with the given URI.
static DocumentMap getInstance()
          Gets the singleton.
 URI getUri(String ssp)
          Gets an URI that can be evaluated by this scheme strategy for the given ssp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final Logger LOGGER
Logger for this class.


REPOSITORY

private static final DocumentMap REPOSITORY
The singleton.


documents

private final Map<URI,String> documents
A simple mapping of a URI to any document.

Constructor Detail

DocumentMap

private DocumentMap()
Do not create from outside.

Method Detail

getInstance

public static DocumentMap getInstance()
Gets the singleton.

Returns:
The only mapped document repository.

getUri

public URI getUri(String ssp)
Gets an URI that can be evaluated by this scheme strategy for the given ssp.

Specified by:
getUri in interface MappedDocumentRepository
Parameters:
ssp - Scheme specific part
Returns:
Valid URI for this strategy, null in case of an error.

addDocument

public void addDocument(URI uri,
                        String document)
Adds the given document to this repository.

Specified by:
addDocument in interface MappedDocumentRepository
Parameters:
uri - URI as a key for later retrieval.
document - Document to be added.

addDocument

public void addDocument(URI uri,
                        VoiceXmlDocument document)
Adds the given document to this repository.

Specified by:
addDocument in interface MappedDocumentRepository
Parameters:
uri - URI as a key for later retrieval.
document - Document to be added.

getDocument

public String getDocument(URI uri)
                   throws BadFetchError
Gets the document with the given URI.

Parameters:
uri - URI of the document.
Returns:
Document with the given URI, null if there is no such document or in case of an error.
Throws:
BadFetchError - There is no such document.


Copyright © 2005 JVoiceXML group.