Package org.apache.qpid.jms.transports
Class TransportFactory
- java.lang.Object
-
- org.apache.qpid.jms.transports.TransportFactory
-
- Direct Known Subclasses:
NettyTcpTransportFactory,NettyWsTransportFactory
public abstract class TransportFactory extends Object
Interface that all Transport types must implement.
-
-
Constructor Summary
Constructors Constructor Description TransportFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected TransportOptionsapplyTransportConfiguration(TransportOptions transportOptions, Map<String,String> transportURIOptions)Apply URI options to a freshly createdTransportOptionsinstance which will be used when the actualTransportis created.static Transportcreate(String transportKey, URI remoteURI)Static create method that performs the TransportFactory search and handles the configuration and setup.TransportcreateTransport(URI remoteURI)Creates an instance of the given Transport and configures it using the properties set on the given remote broker URI.protected abstract TransportdoCreateTransport(URI remoteURI, TransportOptions transportOptions)Create the actual Transport instance for this factory using the provided URI and TransportOptions instances.protected TransportOptionsdoCreateTransportOptions()Create and return an instance of TransportOptions appropriate for the Transport type that this factory will return.static TransportFactoryfindTransportFactory(String transportKey)Searches for a TransportFactory by using the scheme from the given key.abstract StringgetName()booleanisSecure()
-
-
-
Method Detail
-
createTransport
public Transport createTransport(URI remoteURI) throws Exception
Creates an instance of the given Transport and configures it using the properties set on the given remote broker URI.- Parameters:
remoteURI- The URI used to connect to a remote Peer.- Returns:
- a new Transport instance.
- Throws:
Exception- if an error occurs while creating the Transport instance.
-
doCreateTransportOptions
protected TransportOptions doCreateTransportOptions()
Create and return an instance of TransportOptions appropriate for the Transport type that this factory will return.- Returns:
- a newly allocated TransportOptions instance appropriate to the factory.
-
applyTransportConfiguration
protected TransportOptions applyTransportConfiguration(TransportOptions transportOptions, Map<String,String> transportURIOptions)
Apply URI options to a freshly createdTransportOptionsinstance which will be used when the actualTransportis created.- Parameters:
transportOptions- TheTransportOptionsinstance to configure.transportURIOptions- The URI options to apply to the givenTransportOptions.- Returns:
-
doCreateTransport
protected abstract Transport doCreateTransport(URI remoteURI, TransportOptions transportOptions) throws Exception
Create the actual Transport instance for this factory using the provided URI and TransportOptions instances.- Parameters:
remoteURI- The URI used to connect to a remote Peer.transportOptions- The TransportOptions used to configure the new Transport.- Returns:
- a newly created and configured Transport instance.
- Throws:
Exception- if an error occurs while creating the Transport instance.
-
getName
public abstract String getName()
- Returns:
- the name of this Transport.
-
isSecure
public boolean isSecure()
- Returns:
- true if the Transport that this factory provides uses a secure channel.
-
create
public static Transport create(String transportKey, URI remoteURI) throws Exception
Static create method that performs the TransportFactory search and handles the configuration and setup.- Parameters:
transportKey- The transport type name used to locate a TransportFactory.remoteURI- the URI of the remote peer.- Returns:
- a new Transport instance that is ready for use.
- Throws:
Exception- if an error occurs while creating the Transport instance.
-
findTransportFactory
public static TransportFactory findTransportFactory(String transportKey) throws IOException
Searches for a TransportFactory by using the scheme from the given key. The search first checks the local cache of Transport factories before moving on to search in the class-path.- Parameters:
transportKey- The transport type name used to locate a TransportFactory.- Returns:
- a Transport factory instance matching the transport key.
- Throws:
IOException- if an error occurs while locating the factory.
-
-