org.apache.qpid.server.protocol
Class AMQPFastProtocolHandler

java.lang.Object
  extended by org.apache.mina.common.IoHandlerAdapter
      extended by org.apache.qpid.server.protocol.AMQPFastProtocolHandler
All Implemented Interfaces:
org.apache.mina.common.IoHandler, org.apache.qpid.framing.ProtocolVersionList

public class AMQPFastProtocolHandler
extends org.apache.mina.common.IoHandlerAdapter
implements org.apache.qpid.framing.ProtocolVersionList

The protocol handler handles "protocol events" for all connections. The state associated with an individual connection is accessed through the protocol session. We delegate all frame (message) processing to the AMQProtocolSession which wraps the state for the connection.


Field Summary
 
Fields inherited from interface org.apache.qpid.framing.ProtocolVersionList
PROTOCOL_MAJOR, PROTOCOL_MINOR, pv
 
Constructor Summary
protected AMQPFastProtocolHandler(AMQPFastProtocolHandler handler)
           
  AMQPFastProtocolHandler(java.lang.Integer applicationRegistryInstance)
           
  AMQPFastProtocolHandler(QueueRegistry queueRegistry, ExchangeRegistry exchangeRegistry)
           
 
Method Summary
protected  void createSession(org.apache.mina.common.IoSession session, QueueRegistry queues, ExchangeRegistry exchanges, org.apache.qpid.codec.AMQCodecFactory codec)
          Separated into its own, protected, method to allow easier reuse
 void exceptionCaught(org.apache.mina.common.IoSession protocolSession, java.lang.Throwable throwable)
           
 boolean isUseSSL()
           
 void messageReceived(org.apache.mina.common.IoSession protocolSession, java.lang.Object message)
          Invoked when a message is received on a particular protocol session.
 void messageSent(org.apache.mina.common.IoSession protocolSession, java.lang.Object object)
          Called after a message has been sent out on a particular protocol session
 void sessionClosed(org.apache.mina.common.IoSession protocolSession)
           
 void sessionCreated(org.apache.mina.common.IoSession protocolSession)
           
 void sessionIdle(org.apache.mina.common.IoSession session, org.apache.mina.common.IdleStatus status)
           
 void sessionOpened(org.apache.mina.common.IoSession protocolSession)
           
 void setUseSSL(boolean useSSL)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AMQPFastProtocolHandler

public AMQPFastProtocolHandler(java.lang.Integer applicationRegistryInstance)

AMQPFastProtocolHandler

public AMQPFastProtocolHandler(QueueRegistry queueRegistry,
                               ExchangeRegistry exchangeRegistry)

AMQPFastProtocolHandler

protected AMQPFastProtocolHandler(AMQPFastProtocolHandler handler)
Method Detail

sessionCreated

public void sessionCreated(org.apache.mina.common.IoSession protocolSession)
                    throws java.lang.Exception
Specified by:
sessionCreated in interface org.apache.mina.common.IoHandler
Overrides:
sessionCreated in class org.apache.mina.common.IoHandlerAdapter
Throws:
java.lang.Exception

createSession

protected void createSession(org.apache.mina.common.IoSession session,
                             QueueRegistry queues,
                             ExchangeRegistry exchanges,
                             org.apache.qpid.codec.AMQCodecFactory codec)
                      throws org.apache.qpid.AMQException
Separated into its own, protected, method to allow easier reuse

Throws:
org.apache.qpid.AMQException

sessionOpened

public void sessionOpened(org.apache.mina.common.IoSession protocolSession)
                   throws java.lang.Exception
Specified by:
sessionOpened in interface org.apache.mina.common.IoHandler
Overrides:
sessionOpened in class org.apache.mina.common.IoHandlerAdapter
Throws:
java.lang.Exception

sessionClosed

public void sessionClosed(org.apache.mina.common.IoSession protocolSession)
                   throws java.lang.Exception
Specified by:
sessionClosed in interface org.apache.mina.common.IoHandler
Overrides:
sessionClosed in class org.apache.mina.common.IoHandlerAdapter
Throws:
java.lang.Exception

sessionIdle

public void sessionIdle(org.apache.mina.common.IoSession session,
                        org.apache.mina.common.IdleStatus status)
                 throws java.lang.Exception
Specified by:
sessionIdle in interface org.apache.mina.common.IoHandler
Overrides:
sessionIdle in class org.apache.mina.common.IoHandlerAdapter
Throws:
java.lang.Exception

exceptionCaught

public void exceptionCaught(org.apache.mina.common.IoSession protocolSession,
                            java.lang.Throwable throwable)
                     throws java.lang.Exception
Specified by:
exceptionCaught in interface org.apache.mina.common.IoHandler
Overrides:
exceptionCaught in class org.apache.mina.common.IoHandlerAdapter
Throws:
java.lang.Exception

messageReceived

public void messageReceived(org.apache.mina.common.IoSession protocolSession,
                            java.lang.Object message)
                     throws java.lang.Exception
Invoked when a message is received on a particular protocol session. Note that a protocol session is directly tied to a particular physical connection.

Specified by:
messageReceived in interface org.apache.mina.common.IoHandler
Overrides:
messageReceived in class org.apache.mina.common.IoHandlerAdapter
Parameters:
protocolSession - the protocol session that received the message
message - the message itself (i.e. a decoded frame)
Throws:
java.lang.Exception - if the message cannot be processed

messageSent

public void messageSent(org.apache.mina.common.IoSession protocolSession,
                        java.lang.Object object)
                 throws java.lang.Exception
Called after a message has been sent out on a particular protocol session

Specified by:
messageSent in interface org.apache.mina.common.IoHandler
Overrides:
messageSent in class org.apache.mina.common.IoHandlerAdapter
Parameters:
protocolSession - the protocol session (i.e. connection) on which this message was sent
object - the message (frame) that was encoded and sent
Throws:
java.lang.Exception - if we want to indicate an error

isUseSSL

public boolean isUseSSL()

setUseSSL

public void setUseSSL(boolean useSSL)