org.apache.qpid.proton.driver
Interface Connector<C>

Type Parameters:
C - application supplied context

public interface Connector<C>

Intermediates between a proton engine Connection and the I/O layer. The top half of the engine can be access via getConnection(). The bottom half of the engine is used by process(). Stores application specific context using setContext(Object). Implementations are not necessarily thread-safe.


Method Summary
 void close()
          Close the socket used by the connector.
 void destroy()
          Destructor for the given connector.
 Connection getConnection()
          Access the AMQP Connection associated with the connector.
 C getContext()
          Access the application context that is associated with the connector.
 boolean isClosed()
          Determine if the connector is closed.
 Listener listener()
          Access the listener which opened this connector.
 boolean process()
          Handle any inbound data, outbound data, or timing events pending on the connector.
 Sasl sasl()
          Access the Authentication and Security context of the connector.
 void setConnection(Connection connection)
          Assign the AMQP Connection associated with the connector.
 void setContext(C context)
          Assign a new application context to the connector.
 

Method Detail

process

boolean process()
                throws java.io.IOException
Handle any inbound data, outbound data, or timing events pending on the connector. Typically, applications repeatedly invoke this method during the lifetime of a connection.

Throws:
java.io.IOException

listener

Listener listener()
Access the listener which opened this connector.

Returns:
the listener which created this connector, or null if the connector has no listener (e.g. an outbound client connection).

sasl

Sasl sasl()
Access the Authentication and Security context of the connector.

Returns:
the Authentication and Security context for the connector, or null if none.

getConnection

Connection getConnection()
Access the AMQP Connection associated with the connector.

Returns:
the connection context for the connector, or null if none.

setConnection

void setConnection(Connection connection)
Assign the AMQP Connection associated with the connector.

Parameters:
connection - the connection to associate with the connector.

getContext

C getContext()
Access the application context that is associated with the connector.

Returns:
the application context that was passed when creating this connector. See createConnector(String, int, Object) and createConnector(java.nio.channels.SelectableChannel, Object).

setContext

void setContext(C context)
Assign a new application context to the connector.

Parameters:
context - new application context to associate with the connector

close

void close()
Close the socket used by the connector.


isClosed

boolean isClosed()
Determine if the connector is closed.


destroy

void destroy()
Destructor for the given connector. Assumes the connector's socket has been closed prior to call.