01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
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.common.IdleStatus;
23: import org.apache.mina.common.IoSession;
24:
25: /**
26: * Adapter class for implementors of the {@link SingleSessionIoHandler}
27: * interface. The session to which the handler is assigned is accessible
28: * through the {@link #getSession()} method.
29: *
30: * @author The Apache MINA Project (dev@mina.apache.org)
31: * @version $Rev: 576217 $, $Date: 2007-09-16 17:55:27 -0600 (Sun, 16 Sep 2007) $
32: */
33: public class SingleSessionIoHandlerAdapter implements
34: SingleSessionIoHandler {
35:
36: /**
37: * The session to which the handler is assigned.
38: */
39: private final IoSession session;
40:
41: /**
42: * Creates a new instance that is assigned to the passed in session.
43: *
44: * @param session the session to which the handler is assigned
45: */
46: public SingleSessionIoHandlerAdapter(IoSession session) {
47: if (session == null) {
48: throw new NullPointerException("session");
49: }
50: this .session = session;
51: }
52:
53: /**
54: * Retrieves the session to which this handler is assigned.
55: *
56: * @return the session
57: */
58: protected IoSession getSession() {
59: return session;
60: }
61:
62: public void exceptionCaught(Throwable th) throws Exception {
63: }
64:
65: public void messageReceived(Object message) throws Exception {
66: }
67:
68: public void messageSent(Object message) throws Exception {
69: }
70:
71: public void sessionClosed() throws Exception {
72: }
73:
74: public void sessionCreated() throws Exception {
75: }
76:
77: public void sessionIdle(IdleStatus status) throws Exception {
78: }
79:
80: public void sessionOpened() throws Exception {
81: }
82: }
|