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.common;
21:
22: import org.slf4j.Logger;
23: import org.slf4j.LoggerFactory;
24:
25: /**
26: * An abstract adapter class for {@link IoHandler}. You can extend this
27: * class and selectively override required event handler methods only. All
28: * methods do nothing by default.
29: *
30: * @author The Apache MINA Project (dev@mina.apache.org)
31: * @version $Rev: 616100 $, $Date: 2008-01-28 15:58:32 -0700 (Mon, 28 Jan 2008) $
32: */
33: public class IoHandlerAdapter implements IoHandler {
34:
35: private final Logger logger = LoggerFactory.getLogger(getClass());
36:
37: public void sessionCreated(IoSession session) throws Exception {
38: }
39:
40: public void sessionOpened(IoSession session) throws Exception {
41: }
42:
43: public void sessionClosed(IoSession session) throws Exception {
44: }
45:
46: public void sessionIdle(IoSession session, IdleStatus status)
47: throws Exception {
48: }
49:
50: public void exceptionCaught(IoSession session, Throwable cause)
51: throws Exception {
52: if (logger.isWarnEnabled()) {
53: logger.warn("EXCEPTION, please implement "
54: + getClass().getName()
55: + ".exceptionCaught() for proper handling:", cause);
56: }
57: }
58:
59: public void messageReceived(IoSession session, Object message)
60: throws Exception {
61: }
62:
63: public void messageSent(IoSession session, Object message)
64: throws Exception {
65: }
66: }
|