1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.mina.io;
20
21 import org.apache.mina.common.ByteBuffer;
22 import org.apache.mina.common.IdleStatus;
23
24 /***
25 * An {@link IoFilterChain} that forwards all events
26 * except <tt>filterWrite</tt> to the {@link IoSessionFilterChain}
27 * of the recipient session.
28 * <p>
29 * This filter chain is used by implementations of {@link IoSessionManager}s.
30 *
31 * @author The Apache Directory Project (dev@directory.apache.org)
32 * @author Trustin Lee (trustin@apache.org)
33 * @version $Rev: 210062 $, $Date: 2005-07-11 12:52:38 +0900 $
34 */
35 public abstract class IoSessionManagerFilterChain extends AbstractIoFilterChain {
36
37 private final IoSessionManager manager;
38
39 protected IoSessionManagerFilterChain( IoSessionManager manager )
40 {
41 this.manager = manager;
42 }
43
44 public IoSessionManager getManager()
45 {
46 return manager;
47 }
48
49 protected IoFilter createTailFilter()
50 {
51 return new IoFilter()
52 {
53 public void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception
54 {
55 ( ( IoSessionFilterChain ) session.getFilterChain() ).sessionOpened( session );
56 }
57
58 public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
59 {
60 ( ( IoSessionFilterChain ) session.getFilterChain() ).sessionClosed( session );
61 }
62
63 public void sessionIdle( NextFilter nextFilter, IoSession session,
64 IdleStatus status ) throws Exception
65 {
66 ( ( IoSessionFilterChain ) session.getFilterChain() ).sessionIdle( session, status );
67 }
68
69 public void exceptionCaught( NextFilter nextFilter,
70 IoSession session, Throwable cause ) throws Exception
71 {
72 ( ( IoSessionFilterChain ) session.getFilterChain() ).exceptionCaught( session, cause );
73 }
74
75 public void dataRead( NextFilter nextFilter, IoSession session,
76 ByteBuffer buf ) throws Exception
77 {
78 ( ( IoSessionFilterChain ) session.getFilterChain() ).dataRead( session, buf );
79 }
80
81 public void dataWritten( NextFilter nextFilter, IoSession session,
82 Object marker ) throws Exception
83 {
84 ( ( IoSessionFilterChain ) session.getFilterChain() ).dataWritten( session, marker );
85 }
86
87 public void filterWrite( NextFilter nextFilter,
88 IoSession session, ByteBuffer buf, Object marker ) throws Exception
89 {
90 nextFilter.filterWrite( session, buf, marker );
91 }
92 };
93 }
94 }