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.write.WriteRequest;
25  
26  /**
27   * An adapter class for {@link IoFilter}.  You can extend
28   * this class and selectively override required event filter methods only.  All
29   * methods forwards events to the next filter by default.
30   *
31   * @author <a href="http://mina.apache.org">Apache MINA Project</a>
32   */
33  public class IoFilterAdapter implements IoFilter {
34      /**
35       * {@inheritDoc}
36       */
37      @Override
38      public void init() throws Exception {
39      }
40  
41      /**
42       * {@inheritDoc}
43       */
44      @Override
45      public void destroy() throws Exception {
46      }
47  
48      /**
49       * {@inheritDoc}
50       */
51      @Override
52      public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
53      }
54  
55      /**
56       * {@inheritDoc}
57       */
58      @Override
59      public void onPostAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
60      }
61  
62      /**
63       * {@inheritDoc}
64       */
65      @Override
66      public void onPreRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
67      }
68  
69      /**
70       * {@inheritDoc}
71       */
72      @Override
73      public void onPostRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
74      }
75  
76      /**
77       * {@inheritDoc}
78       */
79      @Override
80      public void sessionCreated(NextFilter nextFilter, IoSession session) throws Exception {
81          nextFilter.sessionCreated(session);
82      }
83  
84      /**
85       * {@inheritDoc}
86       */
87      @Override
88      public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception {
89          nextFilter.sessionOpened(session);
90      }
91  
92      /**
93       * {@inheritDoc}
94       */
95      @Override
96      public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception {
97          nextFilter.sessionClosed(session);
98      }
99  
100     /**
101      * {@inheritDoc}
102      */
103     @Override
104     public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception {
105         nextFilter.sessionIdle(session, status);
106     }
107 
108     /**
109      * {@inheritDoc}
110      */
111     @Override
112     public void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) throws Exception {
113         nextFilter.exceptionCaught(session, cause);
114     }
115 
116     /**
117      * {@inheritDoc}
118      */
119     @Override
120     public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception {
121         nextFilter.messageReceived(session, message);
122     }
123 
124     /**
125      * {@inheritDoc}
126      */
127     @Override
128     public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception {
129         nextFilter.messageSent(session, writeRequest);
130     }
131 
132     /**
133      * {@inheritDoc}
134      */
135     @Override
136     public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception {
137         nextFilter.filterWrite(session, writeRequest);
138     }
139 
140     /**
141      * {@inheritDoc}
142      */
143     @Override
144     public void filterClose(NextFilter nextFilter, IoSession session) throws Exception {
145         nextFilter.filterClose(session);
146     }
147 
148     /**
149      * {@inheritDoc}
150      */
151     @Override
152     public void inputClosed(NextFilter nextFilter, IoSession session) throws Exception {
153         nextFilter.inputClosed(session);
154     }
155 
156     /**
157      * {@inheritDoc}
158      */
159     @Override
160     public String toString() {
161         return this.getClass().getSimpleName();
162     }
163 }