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