org.apache.mina.handler.multiton
Class SingleSessionIoHandlerDelegate

java.lang.Object
  extended by org.apache.mina.handler.multiton.SingleSessionIoHandlerDelegate
All Implemented Interfaces:
IoHandler

public class SingleSessionIoHandlerDelegate
extends Object
implements IoHandler

An IoHandler implementation which delegates all requests to SingleSessionIoHandlers. A SingleSessionIoHandlerFactory is used to create a new SingleSessionIoHandler for each newly created session.

Version:
$Rev: 436993 $, $Date: 2006-08-26 00:36:56 +0200 (Sat, 26 Aug 2006) $
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Field Summary
static String HANDLER
          The key used to store the SingleSessionIoHandler as a session attribute.
 
Constructor Summary
SingleSessionIoHandlerDelegate(SingleSessionIoHandlerFactory factory)
          Creates a new instance that uses the passed in SingleSessionIoHandlerFactory to create new SingleSessionIoHandlers.
 
Method Summary
 void exceptionCaught(IoSession session, Throwable cause)
          Delegates the method call to the SingleSessionIoHandler.exceptionCaught(Throwable) method of the handler assigned to this session.
 void messageReceived(IoSession session, Object message)
          Delegates the method call to the SingleSessionIoHandler.messageReceived(Object) method of the handler assigned to this session.
 void messageSent(IoSession session, Object message)
          Delegates the method call to the SingleSessionIoHandler.messageSent(Object) method of the handler assigned to this session.
 void sessionClosed(IoSession session)
          Delegates the method call to the SingleSessionIoHandler.sessionClosed() method of the handler assigned to this session.
 void sessionCreated(IoSession session)
          Creates a new instance with the factory passed to the constructor of this class.
 void sessionIdle(IoSession session, IdleStatus status)
          Delegates the method call to the SingleSessionIoHandler.sessionIdle(IdleStatus) method of the handler assigned to this session.
 void sessionOpened(IoSession session)
          Delegates the method call to the SingleSessionIoHandler.sessionOpened() method of the handler assigned to this session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HANDLER

public static final String HANDLER
The key used to store the SingleSessionIoHandler as a session attribute.

Constructor Detail

SingleSessionIoHandlerDelegate

public SingleSessionIoHandlerDelegate(SingleSessionIoHandlerFactory factory)
Creates a new instance that uses the passed in SingleSessionIoHandlerFactory to create new SingleSessionIoHandlers.

Parameters:
factory - the factory for SingleSessionIoHandlers
Method Detail

sessionCreated

public void sessionCreated(IoSession session)
                    throws Exception
Creates a new instance with the factory passed to the constructor of this class. The created handler is stored as a session attribute named HANDLER.

Specified by:
sessionCreated in interface IoHandler
Throws:
Exception
See Also:
IoHandler.sessionCreated(org.apache.mina.common.IoSession)

sessionOpened

public void sessionOpened(IoSession session)
                   throws Exception
Delegates the method call to the SingleSessionIoHandler.sessionOpened() method of the handler assigned to this session.

Specified by:
sessionOpened in interface IoHandler
Throws:
Exception

sessionClosed

public void sessionClosed(IoSession session)
                   throws Exception
Delegates the method call to the SingleSessionIoHandler.sessionClosed() method of the handler assigned to this session.

Specified by:
sessionClosed in interface IoHandler
Throws:
Exception

sessionIdle

public void sessionIdle(IoSession session,
                        IdleStatus status)
                 throws Exception
Delegates the method call to the SingleSessionIoHandler.sessionIdle(IdleStatus) method of the handler assigned to this session.

Specified by:
sessionIdle in interface IoHandler
Throws:
Exception

exceptionCaught

public void exceptionCaught(IoSession session,
                            Throwable cause)
                     throws Exception
Delegates the method call to the SingleSessionIoHandler.exceptionCaught(Throwable) method of the handler assigned to this session.

Specified by:
exceptionCaught in interface IoHandler
Throws:
Exception

messageReceived

public void messageReceived(IoSession session,
                            Object message)
                     throws Exception
Delegates the method call to the SingleSessionIoHandler.messageReceived(Object) method of the handler assigned to this session.

Specified by:
messageReceived in interface IoHandler
Throws:
Exception

messageSent

public void messageSent(IoSession session,
                        Object message)
                 throws Exception
Delegates the method call to the SingleSessionIoHandler.messageSent(Object) method of the handler assigned to this session.

Specified by:
messageSent in interface IoHandler
Throws:
Exception