simple.http.connect
Class ConnectionFactory

java.lang.Object
  extended by simple.http.connect.ConnectionFactory

public final class ConnectionFactory
extends java.lang.Object

This is used to create a Connection that will dispatch either HTTP requests or Pipeline objects to the handler specified. If a ProtocolHandler is used then HTTP requests will be dispatched using a default instances of the PipelineHandler using the PipelineHandlerFactory.getInstance method.

This also allows a Connection to be produced that can use a PipelineFactory which enables the Connection to attach desired functionality. This can be used to add some form of security or network buffering features to the pipeline instances.

Author:
Niall Gallagher

Constructor Summary
ConnectionFactory()
           
 
Method Summary
static Connection getConnection(PipelineHandler handler)
          Creates Connection object using the PipelineHandler given.
static Connection getConnection(PipelineHandler handler, PipelineFactory factory)
          Creates Connection object using the PipelineHandler given.
static Connection getConnection(ProtocolHandler handler)
          Creates the default PipelineHandler object using the PipelineHandlerFactory.getInstance method.
static Connection getConnection(ProtocolHandler handler, PipelineFactory factory)
          Creates the default PipelineHandler object using the PipelineHandlerFactory.getInstance method.
static Connection getConnection(ResourceEngine engine)
          Creates the default PipelineHandler object using the PipelineHandlerFactory.getInstance method.
static Connection getConnection(ResourceEngine engine, PipelineFactory factory)
          Creates the default PipelineHandler object using the PipelineHandlerFactory.getInstance method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionFactory

public ConnectionFactory()
Method Detail

getConnection

public static Connection getConnection(ResourceEngine engine)
Creates the default PipelineHandler object using the PipelineHandlerFactory.getInstance method. This PipelineHandler will then send HTTP requests to a ProtocolHandler issued from the ProtocolHandlerFactory.getInstance.

Parameters:
engine - this is the ResourceEngine that is used to acquire resources for each request
Returns:
this returns a Connection that can be used to establish listening sockets a port

getConnection

public static Connection getConnection(ResourceEngine engine,
                                       PipelineFactory factory)
Creates the default PipelineHandler object using the PipelineHandlerFactory.getInstance method. This PipelineHandler will then send HTTP requests to a ProtocolHandler issued from the ProtocolHandlerFactory.getInstance.

Parameters:
engine - this is the ResourceEngine that is used to acquire resources for each request
factory - this is the factory object that will produce Pipeline implementations
Returns:
this returns a Connection that can be used to establish listening sockets a port

getConnection

public static Connection getConnection(ProtocolHandler handler)
Creates the default PipelineHandler object using the PipelineHandlerFactory.getInstance method. This PipelineHandler will then send HTTP requests to the ProtocolHandler.

Parameters:
handler - this is the ProtocolHandler that will receive HTTP requests from ports specified by the Connection
Returns:
this returns a Connection that can be used to establish listening sockets a port

getConnection

public static Connection getConnection(ProtocolHandler handler,
                                       PipelineFactory factory)
Creates the default PipelineHandler object using the PipelineHandlerFactory.getInstance method. This PipelineHandler will then send HTTP requests to the ProtocolHandler.

Parameters:
handler - this is the ProtocolHandler that will receive HTTP requests from ports specified by the Connection
factory - this is the factory object that will produce Pipeline implementations
Returns:
this returns a Connection that can be used to establish listening sockets a port

getConnection

public static Connection getConnection(PipelineHandler handler)
Creates Connection object using the PipelineHandler given. This enables the Connection to manage connections to requested port numbers an dispatch Pipeline objects to the PipelineHandler.handle method.

Parameters:
handler - this is the PipelineHandler that will manage Pipeline objects created by the Connection
Returns:
this returns a Connection that can be used to establish listening sockets a port

getConnection

public static Connection getConnection(PipelineHandler handler,
                                       PipelineFactory factory)
Creates Connection object using the PipelineHandler given. This enables the Connection to manage connections to requested port numbers an dispatch Pipeline objects to the PipelineHandler.handle method.

Parameters:
handler - this is the PipelineHandler that will manage Pipeline objects created by the Connection
factory - this is the factory object that will produce Pipeline implementations
Returns:
this returns a Connection that can be used to establish listening sockets a port