simple.http.load
Class MapperFactory

java.lang.Object
  extended by simple.http.load.MapperFactory

public final class MapperFactory
extends java.lang.Object

The MapperFactory retrieves the Mapper implementation for the system. This is used so that a mapping scheme can be imposed on the system using the command line. This has a number of advantages. For one it enables a mapping to be used without any changes to code, the Mapper object only needs to be implemented and specified at the command line.

In order to define a system wide implementation a property is needed to define the object. This uses the System properties to define the class name for the default instance. The property is the simple.http.load.mapper property that can be set using an argument to the VM.

 java -Dsimple.http.load.mapper=demo.example.ExampleMapper
 
This will set the System property to the class name demo.example.ExampleMapper. When the factory method getInstance is invoked it will return an implementation of this object or if the implementation cannot be loaded by this classes class loader a default implementation DefaultMapper is returned instead.

Author:
Niall Gallagher

Constructor Summary
MapperFactory()
           
 
Method Summary
static Mapper getInstance(Context context)
          This is used to produce the system wide Mapper implementation so that the MapperEngine objects can remain consistant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapperFactory

public MapperFactory()
Method Detail

getInstance

public static Mapper getInstance(Context context)
This is used to produce the system wide Mapper implementation so that the MapperEngine objects can remain consistant. This will use a system property simple.http.load.mapper to define the class name of the implementation that will be used for the system wide Mapper. The property should contain the fully qualified class name of the object and should be loadable by this classes class loader. If the specified class cannot be loaded the DefaultMapper is used.

Parameters:
context - this is context used by the implementation
Returns:
the systems Mapper implementation