org.apache.mina.protocol
Class ProtocolHandlerAdapter

java.lang.Object
  extended by org.apache.mina.protocol.ProtocolHandlerAdapter
All Implemented Interfaces:
ProtocolHandler
Direct Known Subclasses:
DemuxingProtocolHandler

public class ProtocolHandlerAdapter
extends Object
implements ProtocolHandler

An abstract adapter class for ProtocolHandler. You can extend this class and selectively override required event handler methods only. All methods do nothing by default.

Version:
$Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $
Author:
The Apache Directory Project (dev@directory.apache.org)

Constructor Summary
ProtocolHandlerAdapter()
           
 
Method Summary
 void exceptionCaught(ProtocolSession session, Throwable cause)
          Invoked when any exception is thrown by user ProtocolHandler implementation or by MINA.
 void messageReceived(ProtocolSession session, Object message)
          Invoked when protocol message is received.
 void messageSent(ProtocolSession session, Object message)
          Invoked when protocol message that user requested by ProtocolSession.write(Object) is sent out actually.
 void sessionClosed(ProtocolSession session)
          Invoked when the connection is closed.
 void sessionCreated(ProtocolSession session)
          Invoked when the session is created.
 void sessionIdle(ProtocolSession session, IdleStatus status)
          Invoked when the connection is idle.
 void sessionOpened(ProtocolSession session)
          Invoked when the connection is opened.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtocolHandlerAdapter

public ProtocolHandlerAdapter()
Method Detail

sessionCreated

public void sessionCreated(ProtocolSession session)
                    throws Exception
Description copied from interface: ProtocolHandler
Invoked when the session is created. Initialize default socket parameters and user-defined attributes here.

Specified by:
sessionCreated in interface ProtocolHandler
Throws:
Exception

sessionOpened

public void sessionOpened(ProtocolSession session)
                   throws Exception
Description copied from interface: ProtocolHandler
Invoked when the connection is opened. This method is not invoked if the transport type is UDP.

Specified by:
sessionOpened in interface ProtocolHandler
Throws:
Exception

sessionClosed

public void sessionClosed(ProtocolSession session)
                   throws Exception
Description copied from interface: ProtocolHandler
Invoked when the connection is closed. This method is not invoked if the transport type is UDP.

Specified by:
sessionClosed in interface ProtocolHandler
Throws:
Exception

sessionIdle

public void sessionIdle(ProtocolSession session,
                        IdleStatus status)
                 throws Exception
Description copied from interface: ProtocolHandler
Invoked when the connection is idle. Refer to IdleStatus. This method is not invoked if the transport type is UDP.

Specified by:
sessionIdle in interface ProtocolHandler
Throws:
Exception

exceptionCaught

public void exceptionCaught(ProtocolSession session,
                            Throwable cause)
                     throws Exception
Description copied from interface: ProtocolHandler
Invoked when any exception is thrown by user ProtocolHandler implementation or by MINA. If cause is instanceof IOException, MINA will close the connection automatically.

Specified by:
exceptionCaught in interface ProtocolHandler
Throws:
Exception

messageReceived

public void messageReceived(ProtocolSession session,
                            Object message)
                     throws Exception
Description copied from interface: ProtocolHandler
Invoked when protocol message is received. Implement your protocol flow here.

Specified by:
messageReceived in interface ProtocolHandler
Throws:
Exception

messageSent

public void messageSent(ProtocolSession session,
                        Object message)
                 throws Exception
Description copied from interface: ProtocolHandler
Invoked when protocol message that user requested by ProtocolSession.write(Object) is sent out actually.

Specified by:
messageSent in interface ProtocolHandler
Throws:
Exception


Copyright © 2004-2005 . All Rights Reserved.