View Javadoc

    1   /*
    2    *  Licensed to the Apache Software Foundation (ASF) under one
    3    *  or more contributor license agreements.  See the NOTICE file
    4    *  distributed with this work for additional information
    5    *  regarding copyright ownership.  The ASF licenses this file
    6    *  to you under the Apache License, Version 2.0 (the
    7    *  "License"); you may not use this file except in compliance
    8    *  with the License.  You may obtain a copy of the License at
    9    *
    10   *    http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   *  Unless required by applicable law or agreed to in writing,
    13   *  software distributed under the License is distributed on an
    14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15   *  KIND, either express or implied.  See the License for the
    16   *  specific language governing permissions and limitations
    17   *  under the License.
    18   *
    19   */
    20  package org.apache.mina.common;
    21
    22  /**
    23   * An abstract adapter class for {@link IoFilter}.  You can extend
    24   * this class and selectively override required event filter methods only.  All
    25   * methods forwards events to the next filter by default.
    26   *
    27   * @author The Apache Directory Project (mina-dev@directory.apache.org)
    28   * @version $Rev: 555855 $, $Date: 2007-07-13 05:19:00 +0200 (Fri, 13 Jul 2007) $
    29   */
    30  public class IoFilterAdapter implements IoFilter {
    31      public void init() throws Exception {
    32      }
    33
    34      public void destroy() throws Exception {
    35      }
    36
    37      public void onPreAdd(IoFilterChain parent, String name,
    38              NextFilter nextFilter) throws Exception {
    39      }
    40
    41      public void onPostAdd(IoFilterChain parent, String name,
    42              NextFilter nextFilter) throws Exception {
    43      }
    44
    45      public void onPreRemove(IoFilterChain parent, String name,
    46              NextFilter nextFilter) throws Exception {
    47      }
    48
    49      public void onPostRemove(IoFilterChain parent, String name,
    50              NextFilter nextFilter) throws Exception {
    51      }
    52
    53      public void sessionCreated(NextFilter nextFilter, IoSession session)
    54              throws Exception {
    55          nextFilter.sessionCreated(session);
    56      }
    57
    58      public void sessionOpened(NextFilter nextFilter, IoSession session)
    59              throws Exception {
    60          nextFilter.sessionOpened(session);
    61      }
    62
    63      public void sessionClosed(NextFilter nextFilter, IoSession session)
    64              throws Exception {
    65          nextFilter.sessionClosed(session);
    66      }
    67
    68      public void sessionIdle(NextFilter nextFilter, IoSession session,
    69              IdleStatus status) throws Exception {
    70          nextFilter.sessionIdle(session, status);
    71      }
    72
    73      public void exceptionCaught(NextFilter nextFilter, IoSession session,
    74              Throwable cause) throws Exception {
    75          nextFilter.exceptionCaught(session, cause);
    76      }
    77
    78      public void messageReceived(NextFilter nextFilter, IoSession session,
    79              Object message) throws Exception {
    80          nextFilter.messageReceived(session, message);
    81      }
    82
    83      public void messageSent(NextFilter nextFilter, IoSession session,
    84              Object message) throws Exception {
    85          nextFilter.messageSent(session, message);
    86      }
    87
    88      public void filterWrite(NextFilter nextFilter, IoSession session,
    89              WriteRequest writeRequest) throws Exception {
    90          nextFilter.filterWrite(session, writeRequest);
    91      }
    92
    93      public void filterClose(NextFilter nextFilter, IoSession session)
    94              throws Exception {
    95          nextFilter.filterClose(session);
    96      }
    97  }