org.elkoserver.foundation.net
Interface ConnectionManager


public interface ConnectionManager

Interface implemented by classes that support message channel connectivity via some I/O pathway (e.g., TCP/IP, etc.). The expectation, though it is not expressible by the semantics of Java's 'interface' abstraction, is that classes implementing this interface will be singletons; that is, one and only one instance of a given ConnectionManager class will be created.


Method Summary
 void connect(String propRoot, MessageHandlerFactory handlerFactory, String hostPort)
          Make a connection, using this connection manager's communications modality, to another host given a host:port address.
 void init(NetworkManager networkManager, Trace msgTrace)
          Initialize this connection manager.
 NetAddr listen(String propRoot, String listenAddress, MessageHandlerFactory handlerFactory, boolean secure)
          Begin listening for incoming connections on some port, using this connection manager's communications modality.
 

Method Detail

init

void init(NetworkManager networkManager,
          Trace msgTrace)
Initialize this connection manager.

Parameters:
networkManager - The network manager this connection manager will be managing connections for.
msgTrace - Trace object for logging message traffic.

connect

void connect(String propRoot,
             MessageHandlerFactory handlerFactory,
             String hostPort)
Make a connection, using this connection manager's communications modality, to another host given a host:port address.

Parameters:
propRoot - Prefix string for all the properties describing the connection that is to be made.
handlerFactory - Message handler factory to provide the handler for the connection that results from this operation.
hostPort - The host name (or IP address) and port to connect to, separated by a colon. For example, "bithlo.example.com:8002".

listen

NetAddr listen(String propRoot,
               String listenAddress,
               MessageHandlerFactory handlerFactory,
               boolean secure)
               throws IOException
Begin listening for incoming connections on some port, using this connection manager's communications modality.

Parameters:
propRoot - Prefix string for all the properties describing the listener that is to be started.
listenAddress - Host name and port to listen for connections on.
handlerFactory - Message handler factory to provide message handlers for connections made to this port.
secure - If true, use a secure connection pathway (e.g., SSL).
Returns:
the address that ended up being listened upon
Throws:
IOException - if there was a problem establishing the listener