org.apache.mina.io
Class AbstractIoFilterChain

java.lang.Object
  extended by org.apache.mina.io.AbstractIoFilterChain
All Implemented Interfaces:
IoFilterChain
Direct Known Subclasses:
IoSessionFilterChain, IoSessionManagerFilterChain

public abstract class AbstractIoFilterChain
extends Object
implements IoFilterChain

An abstract implementation of IoFilterChain that provides common operations for developers to support specific transport types.

All methods has been implemented. The list of filters is maintained as a doublely linked list. You can fire any MINA events which is filtered by this chain using these public methods:

The only method a developer should implement is doWrite(IoSession, ByteBuffer, Object). This method is invoked when filter chain is evaluated for IoFilter.filterWrite(NextFilter, IoSession, ByteBuffer, Object) and finally to be written to the underlying transport layer (e.g. socket)

Version:
$Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $
Author:
The Apache Directory Project

Constructor Summary
protected AbstractIoFilterChain()
           
 
Method Summary
 void addAfter(String baseName, String name, IoFilter filter)
          Adds the specified interceptor with the specified name just after the interceptor whose name is baseName in this chain.
 void addBefore(String baseName, String name, IoFilter filter)
          Adds the specified interceptor with the specified name just before the interceptor whose name is baseName in this chain.
 void addFirst(String name, IoFilter filter)
          Adds the specified interceptor with the specified name at the beginning of this chain.
 void addLast(String name, IoFilter filter)
          Adds the specified interceptor with the specified name at the end of this chain.
 void clear()
          Removes all interceptors added to this chain.
protected  IoFilter createHeadFilter()
          Override this method to create custom head of this filter chain.
protected  IoFilter createTailFilter()
          Override this method to create custom tail of this filter chain.
 void dataRead(IoSession session, ByteBuffer buf)
           
 void dataWritten(IoSession session, Object marker)
           
protected abstract  void doWrite(IoSession session, ByteBuffer buffer, Object marker)
           
 void exceptionCaught(IoSession session, Throwable cause)
           
 void filterWrite(IoSession session, ByteBuffer buf, Object marker)
           
 IoFilter getChild(String name)
           
 List getChildren()
           
 List getChildrenReversed()
           
 IoFilter remove(String name)
          Removes the interceptor with the specified name from this chain.
 void sessionClosed(IoSession session)
           
 void sessionIdle(IoSession session, IdleStatus status)
           
 void sessionOpened(IoSession session)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractIoFilterChain

protected AbstractIoFilterChain()
Method Detail

createHeadFilter

protected IoFilter createHeadFilter()
Override this method to create custom head of this filter chain.


createTailFilter

protected IoFilter createTailFilter()
Override this method to create custom tail of this filter chain.


getChild

public IoFilter getChild(String name)
Specified by:
getChild in interface IoFilterChain

addFirst

public void addFirst(String name,
                     IoFilter filter)
Adds the specified interceptor with the specified name at the beginning of this chain.

Specified by:
addFirst in interface IoFilterChain

addLast

public void addLast(String name,
                    IoFilter filter)
Adds the specified interceptor with the specified name at the end of this chain.

Specified by:
addLast in interface IoFilterChain

addBefore

public void addBefore(String baseName,
                      String name,
                      IoFilter filter)
Adds the specified interceptor with the specified name just before the interceptor whose name is baseName in this chain.

Specified by:
addBefore in interface IoFilterChain

addAfter

public void addAfter(String baseName,
                     String name,
                     IoFilter filter)
Adds the specified interceptor with the specified name just after the interceptor whose name is baseName in this chain.

Specified by:
addAfter in interface IoFilterChain

remove

public IoFilter remove(String name)
Removes the interceptor with the specified name from this chain.

Specified by:
remove in interface IoFilterChain

clear

public void clear()
Removes all interceptors added to this chain.

Specified by:
clear in interface IoFilterChain

sessionOpened

public void sessionOpened(IoSession session)

sessionClosed

public void sessionClosed(IoSession session)

sessionIdle

public void sessionIdle(IoSession session,
                        IdleStatus status)

dataRead

public void dataRead(IoSession session,
                     ByteBuffer buf)

dataWritten

public void dataWritten(IoSession session,
                        Object marker)

exceptionCaught

public void exceptionCaught(IoSession session,
                            Throwable cause)

filterWrite

public void filterWrite(IoSession session,
                        ByteBuffer buf,
                        Object marker)

getChildren

public List getChildren()
Specified by:
getChildren in interface IoFilterChain

getChildrenReversed

public List getChildrenReversed()
Specified by:
getChildrenReversed in interface IoFilterChain

doWrite

protected abstract void doWrite(IoSession session,
                                ByteBuffer buffer,
                                Object marker)


Copyright © 2004-2005 . All Rights Reserved.