org.w3c.mwi.mobileok.basic
Class TesterConfiguration

java.lang.Object
  extended by org.w3c.mwi.mobileok.basic.TesterConfiguration

public final class TesterConfiguration
extends java.lang.Object

Encapsulates configuration options that determine how the Checker behaves in terms of resource preprocessing and tests checking.

The Checker cannot be run without a proper configuration. Mandatory settings are:

The class also contains a generic key/value list that may be used to set additional settings specific to some other class, such as the host and port of an HTTP proxy to use to retrieve HTTP resources, the value of the User-Agent HTTP header to send in HTTP requests, or authentication parameters.

The class is implemented as a per-thread singleton to make it easy to access options across the code. Note to developers: beware, the Checker uses multi-threading and so the singleton must be passed along to any thread created while running tests on a resource.

Version:
$Revision: 1.1 $
Author:
The W3C mobileOK Checker Task Force
See Also:
Tester

Field Summary
private  java.util.Map<java.lang.String,java.lang.Object> configurationMap
          Generic list of parameters that may be used by some classes.
private  DecodedContentFactory decodedContentFactory
          Decoded content factory.
private  java.util.List<ResourceExtractor> extractors
          List of resource extractors to be applied to retrieved resources in this configuration.
static java.lang.String PASSWORD
           
private static java.lang.ThreadLocal<TesterConfiguration> perThreadConfiguration
          Single thread instance of the configuration.
private  ResourceRetrieverFactory resourceRetrieverFactory
          Resource retriever factory.
private  java.util.List<TestImplementation> tests
          List of tests that need to be applied to the moki representation.
static java.lang.String USERNAME
           
 
Constructor Summary
TesterConfiguration(ResourceRetrieverFactory resourceRetrieverFactory, DecodedContentFactory decodedContentFactory, java.util.List<ResourceExtractor> extractors, java.util.List<TestImplementation> tests, java.util.Map<java.lang.String,java.lang.Object> settings)
          Creates a new instance of a tester configuration.
 
Method Summary
 java.lang.Object get(java.lang.String key)
           
static TesterConfiguration getConfiguration()
           
 DecodedContentFactory getDecodedContentFactory()
          Returns the decoded content factory to be used in this configuration of the Checker.
 java.util.List<ResourceExtractor> getResourceExtractors()
          Returns the list of resource extractors to apply in this configuration of the Checker.
 ResourceRetrieverFactory getResourceRetrieverFactory()
          Returns the resource retriever factory to be used in this configuration of the Checker.
 java.lang.String getString(java.lang.String key)
           
 java.util.List<TestImplementation> getTests()
          Returns the list of tests that should be run on the moki representation of the resource under test.
static void setConfiguration(TesterConfiguration configuration)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USERNAME

public static final java.lang.String USERNAME
See Also:
Constant Field Values

PASSWORD

public static final java.lang.String PASSWORD
See Also:
Constant Field Values

perThreadConfiguration

private static final java.lang.ThreadLocal<TesterConfiguration> perThreadConfiguration
Single thread instance of the configuration.


resourceRetrieverFactory

private final ResourceRetrieverFactory resourceRetrieverFactory
Resource retriever factory.

The factory is used to create resource retrievers based on the scheme of the URI.


decodedContentFactory

private final DecodedContentFactory decodedContentFactory
Decoded content factory.

Used to map retrieved resources to the most appropriate DecodedContent implementation known in this configuration.


extractors

private final java.util.List<ResourceExtractor> extractors
List of resource extractors to be applied to retrieved resources in this configuration.


tests

private final java.util.List<TestImplementation> tests
List of tests that need to be applied to the moki representation.


configurationMap

private final java.util.Map<java.lang.String,java.lang.Object> configurationMap
Generic list of parameters that may be used by some classes.

Constructor Detail

TesterConfiguration

public TesterConfiguration(ResourceRetrieverFactory resourceRetrieverFactory,
                           DecodedContentFactory decodedContentFactory,
                           java.util.List<ResourceExtractor> extractors,
                           java.util.List<TestImplementation> tests,
                           java.util.Map<java.lang.String,java.lang.Object> settings)
Creates a new instance of a tester configuration.

Parameters:
resourceRetrieverFactory - factory to use to create resource retrievers.
decodedContentFactory - factory to use to decode content
extractors - list of resource extractors to use
tests - list of tests to apply on the moki representation
settings - list of other settings
Method Detail

get

public java.lang.Object get(java.lang.String key)

getString

public java.lang.String getString(java.lang.String key)

getResourceRetrieverFactory

public ResourceRetrieverFactory getResourceRetrieverFactory()
Returns the resource retriever factory to be used in this configuration of the Checker.

Returns:
the resource retriever factory. Cannot be null.

getDecodedContentFactory

public DecodedContentFactory getDecodedContentFactory()
Returns the decoded content factory to be used in this configuration of the Checker.

Returns:
the decoded content factory. Cannot be null.

getResourceExtractors

public java.util.List<ResourceExtractor> getResourceExtractors()
Returns the list of resource extractors to apply in this configuration of the Checker.

Returns:
the list of resource extractors.

getTests

public java.util.List<TestImplementation> getTests()
Returns the list of tests that should be run on the moki representation of the resource under test.

Returns:
the list of tests to run.

setConfiguration

public static void setConfiguration(TesterConfiguration configuration)

getConfiguration

public static TesterConfiguration getConfiguration()