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 Details

    • TransportFactory

      public TransportFactory()
  • Method Details

    • 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 created TransportOptions instance which will be used when the actual Transport is created.
      Parameters:
      transportOptions - The TransportOptions instance to configure.
      transportURIOptions - The URI options to apply to the given TransportOptions.
      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.