org.apache.mina.common
Class IoFilterAdapter

java.lang.Object
  extended byorg.apache.mina.common.IoFilterAdapter
All Implemented Interfaces:
IoFilter
Direct Known Subclasses:
BlacklistFilter, CompressionFilter, ExecutorFilter, LoggingFilter, ProtocolCodecFilter, SSLFilter, StreamWriteFilter

public class IoFilterAdapter
extends Object
implements IoFilter

An abstract adapter class for IoFilter. You can extend this class and selectively override required event filter methods only. All methods forwards events to the next filter by default.

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)

Nested Class Summary
 
Nested classes inherited from class org.apache.mina.common.IoFilter
IoFilter.NextFilter, IoFilter.WriteRequest
 
Constructor Summary
IoFilterAdapter()
           
 
Method Summary
 void destroy()
          Invoked by ReferenceCountingIoFilter when this filter is not used by any IoFilterChain anymore, so you can destroy shared resources.
 void exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause)
          Filters IoHandler.exceptionCaught(IoSession,Throwable) event.
 void filterClose(IoFilter.NextFilter nextFilter, IoSession session)
          Filters IoSession.close() method invocation.
 void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, IoFilter.WriteRequest writeRequest)
          Filters IoSession.write(Object) method invocation.
 void init()
          Invoked by ReferenceCountingIoFilter when this filter is added to a IoFilterChain at the first time, so you can initialize shared resources.
 void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message)
          Filters IoHandler.messageReceived(IoSession,Object) event.
 void messageSent(IoFilter.NextFilter nextFilter, IoSession session, Object message)
          Filters IoHandler.messageSent(IoSession,Object) event.
 void onPostAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter)
          Invoked after this filter is added to the specified parent.
 void onPostRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter)
          Invoked after this filter is removed from the specified parent.
 void onPreAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter)
          Invoked before this filter is added to the specified parent.
 void onPreRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter)
          Invoked before this filter is removed from the specified parent.
 void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session)
          Filters IoHandler.sessionClosed(IoSession) event.
 void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session)
          Filters IoHandler.sessionCreated(IoSession) event.
 void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status)
          Filters IoHandler.sessionIdle(IoSession,IdleStatus) event.
 void sessionOpened(IoFilter.NextFilter nextFilter, IoSession session)
          Filters IoHandler.sessionOpened(IoSession) event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IoFilterAdapter

public IoFilterAdapter()
Method Detail

init

public void init()
          throws Exception
Description copied from interface: IoFilter
Invoked by ReferenceCountingIoFilter when this filter is added to a IoFilterChain at the first time, so you can initialize shared resources. Please note that this method is never called if you don't wrap a filter with ReferenceCountingIoFilter.

Specified by:
init in interface IoFilter
Throws:
Exception

destroy

public void destroy()
             throws Exception
Description copied from interface: IoFilter
Invoked by ReferenceCountingIoFilter when this filter is not used by any IoFilterChain anymore, so you can destroy shared resources. Please note that this method is never called if you don't wrap a filter with ReferenceCountingIoFilter.

Specified by:
destroy in interface IoFilter
Throws:
Exception

onPreAdd

public void onPreAdd(IoFilterChain parent,
                     String name,
                     IoFilter.NextFilter nextFilter)
              throws Exception
Description copied from interface: IoFilter
Invoked before this filter is added to the specified parent. Please note that this method can be invoked more than once if this filter is added to more than one parents. This method is not invoked before IoFilter.init() is invoked.

Specified by:
onPreAdd in interface IoFilter
Parameters:
parent - the parent who called this method
name - the name assigned to this filter
nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
Throws:
Exception

onPostAdd

public void onPostAdd(IoFilterChain parent,
                      String name,
                      IoFilter.NextFilter nextFilter)
               throws Exception
Description copied from interface: IoFilter
Invoked after this filter is added to the specified parent. Please note that this method can be invoked more than once if this filter is added to more than one parents. This method is not invoked before IoFilter.init() is invoked.

Specified by:
onPostAdd in interface IoFilter
Parameters:
parent - the parent who called this method
name - the name assigned to this filter
nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
Throws:
Exception

onPreRemove

public void onPreRemove(IoFilterChain parent,
                        String name,
                        IoFilter.NextFilter nextFilter)
                 throws Exception
Description copied from interface: IoFilter
Invoked before this filter is removed from the specified parent. Please note that this method can be invoked more than once if this filter is removed from more than one parents. This method is always invoked before IoFilter.destroy() is invoked.

Specified by:
onPreRemove in interface IoFilter
Parameters:
parent - the parent who called this method
name - the name assigned to this filter
nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
Throws:
Exception

onPostRemove

public void onPostRemove(IoFilterChain parent,
                         String name,
                         IoFilter.NextFilter nextFilter)
                  throws Exception
Description copied from interface: IoFilter
Invoked after this filter is removed from the specified parent. Please note that this method can be invoked more than once if this filter is removed from more than one parents. This method is always invoked before IoFilter.destroy() is invoked.

Specified by:
onPostRemove in interface IoFilter
Parameters:
parent - the parent who called this method
name - the name assigned to this filter
nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
Throws:
Exception

sessionCreated

public void sessionCreated(IoFilter.NextFilter nextFilter,
                           IoSession session)
                    throws Exception
Description copied from interface: IoFilter
Filters IoHandler.sessionCreated(IoSession) event.

Specified by:
sessionCreated in interface IoFilter
Throws:
Exception

sessionOpened

public void sessionOpened(IoFilter.NextFilter nextFilter,
                          IoSession session)
                   throws Exception
Description copied from interface: IoFilter
Filters IoHandler.sessionOpened(IoSession) event.

Specified by:
sessionOpened in interface IoFilter
Throws:
Exception

sessionClosed

public void sessionClosed(IoFilter.NextFilter nextFilter,
                          IoSession session)
                   throws Exception
Description copied from interface: IoFilter
Filters IoHandler.sessionClosed(IoSession) event.

Specified by:
sessionClosed in interface IoFilter
Throws:
Exception

sessionIdle

public void sessionIdle(IoFilter.NextFilter nextFilter,
                        IoSession session,
                        IdleStatus status)
                 throws Exception
Description copied from interface: IoFilter
Filters IoHandler.sessionIdle(IoSession,IdleStatus) event.

Specified by:
sessionIdle in interface IoFilter
Throws:
Exception

exceptionCaught

public void exceptionCaught(IoFilter.NextFilter nextFilter,
                            IoSession session,
                            Throwable cause)
                     throws Exception
Description copied from interface: IoFilter
Filters IoHandler.exceptionCaught(IoSession,Throwable) event.

Specified by:
exceptionCaught in interface IoFilter
Throws:
Exception

messageReceived

public void messageReceived(IoFilter.NextFilter nextFilter,
                            IoSession session,
                            Object message)
                     throws Exception
Description copied from interface: IoFilter
Filters IoHandler.messageReceived(IoSession,Object) event.

Specified by:
messageReceived in interface IoFilter
Throws:
Exception

messageSent

public void messageSent(IoFilter.NextFilter nextFilter,
                        IoSession session,
                        Object message)
                 throws Exception
Description copied from interface: IoFilter
Filters IoHandler.messageSent(IoSession,Object) event.

Specified by:
messageSent in interface IoFilter
Throws:
Exception

filterWrite

public void filterWrite(IoFilter.NextFilter nextFilter,
                        IoSession session,
                        IoFilter.WriteRequest writeRequest)
                 throws Exception
Description copied from interface: IoFilter
Filters IoSession.write(Object) method invocation.

Specified by:
filterWrite in interface IoFilter
Throws:
Exception

filterClose

public void filterClose(IoFilter.NextFilter nextFilter,
                        IoSession session)
                 throws Exception
Description copied from interface: IoFilter
Filters IoSession.close() method invocation.

Specified by:
filterClose in interface IoFilter
Throws:
Exception