Protocols::Http::ClientHttpSessionFactory Class Reference

#include <ClientHttpSessionFactory.h> [code]

Inherits Protocols::Generics::TransportFactoryStatus.

Inheritance diagram for Protocols::Http::ClientHttpSessionFactory:

Inheritance graph
[legend]
Collaboration diagram for Protocols::Http::ClientHttpSessionFactory:

Collaboration graph
[legend]
List of all members.

Detailed Description

Creates ClientHttpSession objects.

Todo:
It currently creates only CompositeSingleHostClientHttpSession objects. Should we rename the class to CompositeSingleHostClientHttpSessonFactory and extract an interface ClientHttpSessionFactory?

Definition at line 55 of file ClientHttpSessionFactory.h.

Public Member Functions

 ClientHttpSessionFactory (TransportFactory *)
 Creates a ClientHttpSessionFactory object.
 ~ClientHttpSessionFactory ()
 Destructor.
ClientHttpSessioncreateSession (Transport *, ClientHttpSessionStatus *)
 Creates a new ClientHttpSession object for an existing Transport object.
void createSession (const Uri &, ClientHttpSessionStatus *, ClientHttpSessionFactoryStatus *)
 Create a new ClientHttpSession object for a given Uri.
void destroySession (ClientHttpSession *)
 Destroys a ClientHttpSession object created by this factory object.
void transportFactorySucceeded (const Uri &, Transport *)
 Handler for a successfully created Transport object notification.
void transportFactoryFailed (const Uri &)
 Handler for the failed Transport object creation notification.

Static Public Member Functions

static Uri makeTransportUri (const Uri &httpUri)
 Helper that converts uri to a transport URI.

Private Types

typedef QHash< Uri, EstablishingSession * > EstablishingSessions
typedef QHash< ClientHttpSession *,
Transport * > 
Sessions

Static Private Member Functions

static Uri makeTcpUriFromHttpUri (const Uri &uri)
 Helper that converts uri to a tcp: URI.

Private Attributes

TransportFactorytransportFactory_
EstablishingSessions establishingSessions_
Sessions sessions_

Classes

struct  EstablishingSession


Member Typedef Documentation

typedef QHash<Uri, EstablishingSession *> Protocols::Http::ClientHttpSessionFactory::EstablishingSessions [private]
 

Definition at line 89 of file ClientHttpSessionFactory.h.

typedef QHash<ClientHttpSession *, Transport *> Protocols::Http::ClientHttpSessionFactory::Sessions [private]
 

Definition at line 90 of file ClientHttpSessionFactory.h.


Constructor & Destructor Documentation

ClientHttpSessionFactory::ClientHttpSessionFactory TransportFactory transportFactory  ) 
 

Creates a ClientHttpSessionFactory object.

Parameters:
transportFactory is the TransportFactory to use to create and destroy Transport objects.

Definition at line 35 of file ClientHttpSessionFactory.cpp.

ClientHttpSessionFactory::~ClientHttpSessionFactory  ) 
 

Destructor.

Destroys all open ClientHttpSession objects as well as their associated Transport objects.

Todo:
Should we somehow notify the TransportFactory that we are going down, or is it safe to assume that TransportFactory is also going down? That may be required when we have requested Transport objects to be created and established.

Definition at line 51 of file ClientHttpSessionFactory.cpp.


Member Function Documentation

void ClientHttpSessionFactory::createSession const Uri uri,
ClientHttpSessionStatus sessionStatus,
ClientHttpSessionFactoryStatus factoryStatus
 

Create a new ClientHttpSession object for a given Uri.

Parameters:
uri is the Uri for which we require a ClientHttpSession.
sessionStatus is the object that will receive the notifications of the new ClientHttpSession object.
factoryStatus is the object that will receive the notification whether or not the new ClientHttpSession object was created.
This functions completes asynchronously and the result is delivered via factoryStatus.

Definition at line 109 of file ClientHttpSessionFactory.cpp.

ClientHttpSession * ClientHttpSessionFactory::createSession Transport transport,
ClientHttpSessionStatus status
 

Creates a new ClientHttpSession object for an existing Transport object.

Parameters:
transport is the Transport to use for data exchange. We will own the transport object if the function succeeds.
status is the status interface to register with the newly created ClientHttpSession object.
Returns:
The newly created ClientHttpSession object which will send its status notifications via status.
Precondition:
transport must have been created via the TransportFactory object passed to the ctor. The reason is that transport will be destroyed via this same object.

Definition at line 88 of file ClientHttpSessionFactory.cpp.

void ClientHttpSessionFactory::destroySession ClientHttpSession session  ) 
 

Destroys a ClientHttpSession object created by this factory object.

Parameters:
session is the ClientHttpSession object to delete.
Precondition:
session must have been created by this factory object via one of the createSession() overloads.

session must not have already been deleted.

Definition at line 135 of file ClientHttpSessionFactory.cpp.

Uri ClientHttpSessionFactory::makeTcpUriFromHttpUri const Uri uri  )  [static, private]
 

Helper that converts uri to a tcp: URI.

The tcp: URI returned has the read and write buffer sizes set to 8192 bytes.

Definition at line 206 of file ClientHttpSessionFactory.cpp.

Uri ClientHttpSessionFactory::makeTransportUri const Uri uri  )  [static]
 

Helper that converts uri to a transport URI.

Parameters:
uri is the HTTP URL of a host or resource.
Returns:
An uri object matching the Transport URI for the host or resource given in uri.
Currently only the http: scheme is supported and it is mapped to a tcp: URI.

Definition at line 191 of file ClientHttpSessionFactory.cpp.

void ClientHttpSessionFactory::transportFactoryFailed const Uri transportUri  )  [virtual]
 

Handler for the failed Transport object creation notification.

Parameters:
uri is the Uri object for which we requested a new Transport object.
We complete the asynchronous createSession() operation and send the corresponding ClientHttpSessionFactoryStatus notification.

Implements Protocols::Generics::TransportFactoryStatus.

Definition at line 174 of file ClientHttpSessionFactory.cpp.

void ClientHttpSessionFactory::transportFactorySucceeded const Uri transportUri,
Transport transport
[virtual]
 

Handler for a successfully created Transport object notification.

Parameters:
uri is the Uri object for which we requested a Transport object.
transport is the successfully created Transport object.
We complete the asynchronous createSession() operation and send the corresponding ClientHttpSessionFactoryStatus notification.

Implements Protocols::Generics::TransportFactoryStatus.

Definition at line 154 of file ClientHttpSessionFactory.cpp.


Member Data Documentation

EstablishingSessions Protocols::Http::ClientHttpSessionFactory::establishingSessions_ [private]
 

Definition at line 93 of file ClientHttpSessionFactory.h.

Sessions Protocols::Http::ClientHttpSessionFactory::sessions_ [private]
 

Definition at line 94 of file ClientHttpSessionFactory.h.

TransportFactory* Protocols::Http::ClientHttpSessionFactory::transportFactory_ [private]
 

Definition at line 92 of file ClientHttpSessionFactory.h.


The documentation for this class was generated from the following files: