Class TransportFactory

    • Constructor Detail

      • TransportFactory

        public TransportFactory()
    • 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.
      • 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.