View Javadoc

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  
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 <a href="http://mina.apache.org">Apache MINA Project</a>
31   */
32  @Deprecated
33  public class SingleSessionIoHandlerAdapter implements SingleSessionIoHandler {
34  
35      /**
36       * The session to which the handler is assigned.
37       */
38      private final IoSession session;
39  
40      /**
41       * Creates a new instance that is assigned to the passed in session.
42       *
43       * @param session the session to which the handler is assigned
44       */
45      public SingleSessionIoHandlerAdapter(IoSession session) {
46          if (session == null) {
47              throw new IllegalArgumentException("session");
48          }
49          this.session = session;
50      }
51  
52      /**
53       * Retrieves the session to which this handler is assigned.
54       *
55       * @return the session
56       */
57      protected IoSession getSession() {
58          return session;
59      }
60  
61      public void exceptionCaught(Throwable th) throws Exception {
62          // Do nothing
63      }
64  
65      public void messageReceived(Object message) throws Exception {
66          // Do nothing
67      }
68  
69      public void messageSent(Object message) throws Exception {
70          // Do nothing
71      }
72  
73      public void sessionClosed() throws Exception {
74          // Do nothing
75      }
76  
77      public void sessionCreated() throws Exception {
78          // Do nothing
79      }
80  
81      public void sessionIdle(IdleStatus status) throws Exception {
82          // Do nothing
83      }
84  
85      public void sessionOpened() throws Exception {
86          // Do nothing
87      }
88  }