org.w3c.mwi.mobileok.basic
Interface DecodedContentFactory

All Known Implementing Classes:
MobileOKDecodedContentFactory

public interface DecodedContentFactory

Interface that must be implemented by resource factories.

A resource factory is used to create an instance of the appropriate derived class of Resource based on the content-type of the retrieved resource, and possibly on the context under which the resource is to be created.

When a resource couldn't be retrieved because of some network error, an instance of the RetrievalFailedContent class must be returned.

When a resource's content-type is not supported for the given context, an instance of the NotSupportedContent class must be returned.

Version:
$Revision: 1.1 $
Author:
Francois Daoust

Method Summary
 DecodedContent decodeContent(java.net.URI uri, java.util.List<RetrievalElement> retrieved, ResourceContext resourceContext)
          Creates an instance of a Resource based on the given parameters.
 boolean isContentSupported(java.lang.String contentType, ResourceContext resourceContext)
          Returns true when the factory is able to create content that match the given content-type under the given context.
 

Method Detail

decodeContent

DecodedContent decodeContent(java.net.URI uri,
                             java.util.List<RetrievalElement> retrieved,
                             ResourceContext resourceContext)
                             throws TestException
Creates an instance of a Resource based on the given parameters.

Parameters:
uri - absolute URI of the resource.
retrieved - the retrieved representation of the resource.
resourceContext - the context that gave birth to the resource.
Returns:
a Resource that best match the retrieved one, cannot be null.
Throws:
TestException - an unexpected error occurred while retrieving the resource.

isContentSupported

boolean isContentSupported(java.lang.String contentType,
                           ResourceContext resourceContext)
Returns true when the factory is able to create content that match the given content-type under the given context.

Parameters:
contentType - Content-Type to check
resourceContext - Context under which the resource would be created
Returns:
true when the content-type is supported, false otherwise