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: 671827 $, $Date: 2008-06-26 10:49:48 +0200 (jeu, 26 jun 2008) $
Author:
The Apache MINA Project (dev@mina.apache.org)

Field Summary
static AttributeKey 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.
 SingleSessionIoHandlerFactory getFactory()
          Returns the SingleSessionIoHandlerFactory that is used to create a new SingleSessionIoHandler instance.
 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 AttributeKey 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

getFactory

public SingleSessionIoHandlerFactory getFactory()
Returns the SingleSessionIoHandlerFactory that is used to create a new SingleSessionIoHandler instance.


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.core.session.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


Copyright © 2004-2008 Apache MINA Project. All Rights Reserved.