com::softwareag::umtransport::TransportFactory Class Reference

The TransportFactory is used to to create ServerTransports or client Transports. To bind a server Transport you need to first create a ServerTransportContext or to connect to an existing server you need to create a ClientTransportContext. More...

#include <TransportFactory.h>

Static Public Member Functions

static std::unique_ptr
< AsynchronousServerTransport
bind (std::unique_ptr< ServerTransportContext > context, AcceptHandler *ahandler, DataHandler *dHandler, CloseHandler *cHandler)
 Bind a new ServerTransport as defined by the context. This method takes several callback objects which will be notified asynchronously when certain events occur. More...
 
static std::unique_ptr
< SynchronousServerTransport
bind (std::unique_ptr< ServerTransportContext > context)
 Create a new SynchronousServerTransport using the configuration stored in the ServerTransportContext. This ServerTransport can be used to accept connections. More...
 
static std::unique_ptr
< AsynchronousTransport
connect (std::unique_ptr< ClientTransportContext > context, ConnectHandler *connectHandler, DataHandler *dataHandler, CloseHandler *closeHandler)
 Connect to a ServerTransport using the configuration defined in the ClientTransportContext More...
 
static std::unique_ptr
< SynchronousTransport
connect (std::unique_ptr< ClientTransportContext > context)
 Connect a new SynchronousTransport as defined in the context to a server. More...
 
static bool TransportSupported (const std::string &transportName)
 This function tests to see if the requested transport is supported on the current hardware. Transports like RDMA require specialised Infiniband cards and drivers to be present. More...
 

Detailed Description

The TransportFactory is used to to create ServerTransports or client Transports. To bind a server Transport you need to first create a ServerTransportContext or to connect to an existing server you need to create a ClientTransportContext.

<seealso cref= com.softwareag.um.io.ClientTransportContext

<seealso cref= com.softwareag.um.io.ServerTransportContext

Member Function Documentation

static std::unique_ptr<AsynchronousServerTransport> com::softwareag::umtransport::TransportFactory::bind ( std::unique_ptr< ServerTransportContext context,
AcceptHandler ahandler,
DataHandler dHandler,
CloseHandler cHandler 
)
static

Bind a new ServerTransport as defined by the context. This method takes several callback objects which will be notified asynchronously when certain events occur.

Parameters
contextThe ServerTransportContext which defines what type of ServerTransport to create
ahandlerThe AcceptHandler that will be notified when new client Transports connect
dHandlerThe DataHandler that will be notified when data is available to be read from an AsynchronousTranport
cHandlerThe CloseHandler that will be notified when a client Transport is closed
Returns
AsynchronousServerTransport that will asynchronously accept client connections
Exceptions
IOExceptionif the ServerTransport cannot be bound using the configuration in the context
static std::unique_ptr<SynchronousServerTransport> com::softwareag::umtransport::TransportFactory::bind ( std::unique_ptr< ServerTransportContext context)
static

Create a new SynchronousServerTransport using the configuration stored in the ServerTransportContext. This ServerTransport can be used to accept connections.

Parameters
contextthe configuration to use to create the ServerTransport
Returns
the SynchronousServerTransport that can be used to accept new client connections
Exceptions
IOExceptionif the ServerTransport as defined in the context cannot be bound to
static std::unique_ptr<AsynchronousTransport> com::softwareag::umtransport::TransportFactory::connect ( std::unique_ptr< ClientTransportContext context,
ConnectHandler connectHandler,
DataHandler dataHandler,
CloseHandler closeHandler 
)
static

Connect to a ServerTransport using the configuration defined in the ClientTransportContext

Parameters
contextcontains the configuration required to connect to the ServerTransport
connectHandlernotified when the AsynchronousTransport is connected
dataHandlernotified when data is available to be read from the AsynchronousTransport
closeHandlernotified when the AsynchronousTransport is closed
Returns
AsynchronousTransport that can be written to and will fire callbacks when data is available to be read
Exceptions
IOExceptionif there is a problem connecting to the ServerTransport
static std::unique_ptr<SynchronousTransport> com::softwareag::umtransport::TransportFactory::connect ( std::unique_ptr< ClientTransportContext context)
static

Connect a new SynchronousTransport as defined in the context to a server.

Parameters
contextdefines the configuration fo the SynchronousTransport
Returns
SynchronousTransport that can be used to read/write data to the server
Exceptions
IOExceptionif the SynchronousTransport as defined in the context cannot connect to the server
static bool com::softwareag::umtransport::TransportFactory::TransportSupported ( const std::string &  transportName)
static

This function tests to see if the requested transport is supported on the current hardware. Transports like RDMA require specialised Infiniband cards and drivers to be present.

Parameters
transportNameto test
Returns
true or false, depending if the transport is supported