simple.http.serve
Class FormatFactory

java.lang.Object
  extended by simple.http.serve.FormatFactory

public final class FormatFactory
extends java.lang.Object

The FormatFactory retrives the Format implementation for the system. Because an implementor of a web server using the FileEngine may not implement a Format object a default system wide implementation is needed to keep the instances consistant. This object will produce implementations that are consistant within the system.

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.serve.format property that can be set using an argument to the VM.

 java -Dsimple.http.serve.format=demo.example.ExampleFormat
 
This will set the System property to the class name demo.example.ExampleFormat. 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 DefaultFormat is returned instead.

Author:
Niall Gallagher

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

Constructor Detail

FormatFactory

public FormatFactory()
Method Detail

getInstance

public static Format getInstance()
This is used to produce the system wide Format implementation so that the FileEngine objects can remain consistant. This will use a system property simple.http.serve.format to define the class name of the implementation that will be used for the system wide Format. 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 DefaultFormat is used.

Returns:
an implementation of the Format interface