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.handler.multiton;
21
22 import org.apache.mina.core.session.IdleStatus;
23 import org.apache.mina.core.session.IoSession;
24 import org.apache.mina.filter.FilterEvent;
25
26 /**
27 * Adapter class for implementors of the {@link SingleSessionIoHandler}
28 * interface. The session to which the handler is assigned is accessible
29 * through the getSession() method.
30 *
31 * @deprecated This class is deprecated
32 *
33 * @author <a href="http://mina.apache.org">Apache MINA Project</a>
34 */
35 @Deprecated
36 public class SingleSessionIoHandlerAdapter implements SingleSessionIoHandler {
37
38 /**
39 * The session to which the handler is assigned.
40 */
41 private final IoSession session;
42
43 /**
44 * Creates a new instance that is assigned to the passed in session.
45 *
46 * @param session the session to which the handler is assigned
47 */
48 public SingleSessionIoHandlerAdapter(IoSession session) {
49 if (session == null) {
50 throw new IllegalArgumentException("session");
51 }
52
53 this.session = session;
54 }
55
56 /**
57 * Retrieves the session to which this handler is assigned.
58 *
59 * @return the session
60 */
61 protected IoSession getSession() {
62 return session;
63 }
64
65 /**
66 * {@inheritDoc}
67 */
68 @Override
69 public void exceptionCaught(Throwable th) throws Exception {
70 // Do nothing
71 }
72
73 /**
74 * {@inheritDoc}
75 */
76 @Override
77 public void inputClosed(IoSession session) {
78 // Do nothing
79 }
80
81 /**
82 * {@inheritDoc}
83 */
84 @Override
85 public void messageReceived(Object message) throws Exception {
86 // Do nothing
87 }
88
89 /**
90 * {@inheritDoc}
91 */
92 @Override
93 public void messageSent(Object message) throws Exception {
94 // Do nothing
95 }
96
97 /**
98 * {@inheritDoc}
99 */
100 @Override
101 public void sessionClosed() throws Exception {
102 // Do nothing
103 }
104
105 /**
106 * {@inheritDoc}
107 */
108 @Override
109 public void sessionCreated() throws Exception {
110 // Do nothing
111 }
112
113 /**
114 * {@inheritDoc}
115 */
116 @Override
117 public void sessionIdle(IdleStatus status) throws Exception {
118 // Do nothing
119 }
120
121 /**
122 * {@inheritDoc}
123 */
124 @Override
125 public void sessionOpened() throws Exception {
126 // Do nothing
127 }
128
129 /**
130 * {@inheritDoc}
131 */
132 @Override
133 public void event(FilterEvent event) throws Exception {
134 // Do nothing
135 }
136 }