View Javadoc

1   /*
2    *   @(#) $Id: DelegatedIoAcceptor.java 355016 2005-12-08 07:00:30Z trustin $
3    *
4    *   Copyright 2004 The Apache Software Foundation
5    *
6    *   Licensed under the Apache License, Version 2.0 (the "License");
7    *   you may not use this file except in compliance with the License.
8    *   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, software
13   *   distributed under the License is distributed on an "AS IS" BASIS,
14   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *   See the License for the specific language governing permissions and
16   *   limitations under the License.
17   *
18   */
19  package org.apache.mina.common.support;
20  
21  import java.io.IOException;
22  import java.net.SocketAddress;
23  
24  import org.apache.mina.common.DefaultIoFilterChainBuilder;
25  import org.apache.mina.common.IoAcceptor;
26  import org.apache.mina.common.IoFilterChainBuilder;
27  import org.apache.mina.common.IoHandler;
28  import org.apache.mina.common.IoSession;
29  
30  /***
31   * A delegated {@link IoAcceptor} that wraps the other {@link IoAcceptor}.
32   * 
33   * @author The Apache Directory Project (dev@directory.apache.org)
34   * @version $Rev: 355016 $, $Date: 2005-12-08 16:00:30 +0900 (Thu, 08 Dec 2005) $
35   */
36  public class DelegatedIoAcceptor implements IoAcceptor
37  {
38      protected IoAcceptor delegate;
39      
40      /***
41       * Creates a new instance.
42       */
43      protected DelegatedIoAcceptor()
44      {
45      }
46      
47      /***
48       * Sets the delegate.  This method should be invoked before any operations
49       * is requested.
50       */
51      protected void init( IoAcceptor delegate )
52      {
53          this.delegate = delegate;
54      }
55      
56      public void bind( SocketAddress address, IoHandler handler ) throws IOException
57      {
58          delegate.bind( address, handler );
59      }
60  
61      public void bind( SocketAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder ) throws IOException
62      {
63          delegate.bind( address, handler, filterChainBuilder );
64      }
65  
66      public void unbind( SocketAddress address )
67      {
68          delegate.unbind( address );
69      }
70  
71      public IoSession newSession( SocketAddress remoteAddress, SocketAddress localAddress )
72      {
73          return delegate.newSession( remoteAddress, localAddress );
74      }
75  
76      public IoFilterChainBuilder getFilterChainBuilder()
77      {
78          return delegate.getFilterChainBuilder();
79      }
80  
81      public void setFilterChainBuilder( IoFilterChainBuilder builder )
82      {
83          delegate.setFilterChainBuilder( builder );
84      }
85      
86      public DefaultIoFilterChainBuilder getFilterChain()
87      {
88          return delegate.getFilterChain();
89      }
90  
91      /* TODO: DIRMINA-93
92      public boolean isDisconnectClientsOnUnbind()
93      {
94          return delegate.isDisconnectClientsOnUnbind();
95      }
96  
97      public void setDisconnectClientsOnUnbind( boolean disconnectClientsOnUnbind )
98      {
99          delegate.setDisconnectClientsOnUnbind( disconnectClientsOnUnbind );
100     }
101     */
102 }