001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 *
019 */
020package org.apache.mina.handler.multiton;
021
022import org.apache.mina.core.session.IdleStatus;
023import org.apache.mina.core.session.IoSession;
024
025/**
026 * Adapter class for implementors of the {@link SingleSessionIoHandler}
027 * interface. The session to which the handler is assigned is accessible
028 * through the {@link #getSession()} method.
029 *
030 * @author <a href="http://mina.apache.org">Apache MINA Project</a>
031 */
032@Deprecated
033public class SingleSessionIoHandlerAdapter implements SingleSessionIoHandler {
034
035    /**
036     * The session to which the handler is assigned.
037     */
038    private final IoSession session;
039
040    /**
041     * Creates a new instance that is assigned to the passed in session.
042     *
043     * @param session the session to which the handler is assigned
044     */
045    public SingleSessionIoHandlerAdapter(IoSession session) {
046        if (session == null) {
047            throw new IllegalArgumentException("session");
048        }
049        this.session = session;
050    }
051
052    /**
053     * Retrieves the session to which this handler is assigned.
054     *
055     * @return the session
056     */
057    protected IoSession getSession() {
058        return session;
059    }
060
061    public void exceptionCaught(Throwable th) throws Exception {
062        // Do nothing
063    }
064
065    public void inputClosed(IoSession session) {
066        // Do nothing
067    }
068
069    public void messageReceived(Object message) throws Exception {
070        // Do nothing
071    }
072
073    public void messageSent(Object message) throws Exception {
074        // Do nothing
075    }
076
077    public void sessionClosed() throws Exception {
078        // Do nothing
079    }
080
081    public void sessionCreated() throws Exception {
082        // Do nothing
083    }
084
085    public void sessionIdle(IdleStatus status) throws Exception {
086        // Do nothing
087    }
088
089    public void sessionOpened() throws Exception {
090        // Do nothing
091    }
092}