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.core.filterchain;
21  
22  import org.apache.mina.core.session.IdleStatus;
23  import org.apache.mina.core.session.IoSession;
24  import org.apache.mina.core.session.TrafficMask;
25  import org.apache.mina.core.write.WriteRequest;
26  
27  /**
28   * An abstract adapter class for {@link IoFilter}.  You can extend
29   * this class and selectively override required event filter methods only.  All
30   * methods forwards events to the next filter by default.
31   *
32   * @author The Apache MINA Project (dev@mina.apache.org)
33   * @version $Rev: 591770 $, $Date: 2007-11-04 13:22:44 +0100 (Sun, 04 Nov 2007) $
34   */
35  public class IoFilterAdapter implements IoFilter {
36      public void init() throws Exception {
37      }
38  
39      public void destroy() throws Exception {
40      }
41  
42      public void onPreAdd(IoFilterChain parent, String name,
43              NextFilter nextFilter) throws Exception {
44      }
45  
46      public void onPostAdd(IoFilterChain parent, String name,
47              NextFilter nextFilter) throws Exception {
48      }
49  
50      public void onPreRemove(IoFilterChain parent, String name,
51              NextFilter nextFilter) throws Exception {
52      }
53  
54      public void onPostRemove(IoFilterChain parent, String name,
55              NextFilter nextFilter) throws Exception {
56      }
57  
58      public void sessionCreated(NextFilter nextFilter, IoSession session)
59              throws Exception {
60          nextFilter.sessionCreated(session);
61      }
62  
63      public void sessionOpened(NextFilter nextFilter, IoSession session)
64              throws Exception {
65          nextFilter.sessionOpened(session);
66      }
67  
68      public void sessionClosed(NextFilter nextFilter, IoSession session)
69              throws Exception {
70          nextFilter.sessionClosed(session);
71      }
72  
73      public void sessionIdle(NextFilter nextFilter, IoSession session,
74              IdleStatus status) throws Exception {
75          nextFilter.sessionIdle(session, status);
76      }
77  
78      public void exceptionCaught(NextFilter nextFilter, IoSession session,
79              Throwable cause) throws Exception {
80          nextFilter.exceptionCaught(session, cause);
81      }
82  
83      public void messageReceived(NextFilter nextFilter, IoSession session,
84              Object message) throws Exception {
85          nextFilter.messageReceived(session, message);
86      }
87  
88      public void messageSent(NextFilter nextFilter, IoSession session,
89              WriteRequest writeRequest) throws Exception {
90          nextFilter.messageSent(session, writeRequest);
91      }
92  
93      public void filterWrite(NextFilter nextFilter, IoSession session,
94              WriteRequest writeRequest) throws Exception {
95          nextFilter.filterWrite(session, writeRequest);
96      }
97  
98      public void filterClose(NextFilter nextFilter, IoSession session)
99              throws Exception {
100         nextFilter.filterClose(session);
101     }
102 
103     public void filterSetTrafficMask(NextFilter nextFilter, IoSession session,
104             TrafficMask trafficMask) throws Exception {
105         nextFilter.filterSetTrafficMask(session, trafficMask);
106     }
107 }