KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > mina > common > support > DelegatedIoAcceptor


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.common.support;
21
22 import java.io.IOException JavaDoc;
23 import java.net.SocketAddress JavaDoc;
24 import java.util.Set JavaDoc;
25
26 import org.apache.mina.common.DefaultIoFilterChainBuilder;
27 import org.apache.mina.common.IoAcceptor;
28 import org.apache.mina.common.IoFilterChainBuilder;
29 import org.apache.mina.common.IoHandler;
30 import org.apache.mina.common.IoServiceConfig;
31 import org.apache.mina.common.IoServiceListener;
32 import org.apache.mina.common.IoSession;
33
34 /**
35  * A delegated {@link IoAcceptor} that wraps the other {@link IoAcceptor}.
36  *
37  * @author The Apache Directory Project (mina-dev@directory.apache.org)
38  * @version $Rev: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (금, 13 7월 2007) $
39  */

40 public class DelegatedIoAcceptor implements IoAcceptor {
41     protected IoAcceptor delegate;
42
43     /**
44      * Creates a new instance.
45      */

46     protected DelegatedIoAcceptor() {
47     }
48
49     /**
50      * Sets the delegate. This method should be invoked before any operations
51      * is requested.
52      */

53     protected void init(IoAcceptor delegate) {
54         this.delegate = delegate;
55     }
56
57     public void bind(SocketAddress JavaDoc address, IoHandler handler)
58             throws IOException JavaDoc {
59         delegate.bind(address, handler);
60     }
61
62     public void bind(SocketAddress JavaDoc address, IoHandler handler,
63             IoServiceConfig config) throws IOException JavaDoc {
64         delegate.bind(address, handler, config);
65     }
66
67     public void unbind(SocketAddress JavaDoc address) {
68         delegate.unbind(address);
69     }
70
71     public void unbindAll() {
72         delegate.unbindAll();
73     }
74
75     public boolean isManaged(SocketAddress JavaDoc address) {
76         return delegate.isManaged(address);
77     }
78
79     public Set JavaDoc<SocketAddress JavaDoc> getManagedServiceAddresses() {
80         return delegate.getManagedServiceAddresses();
81     }
82
83     public Set JavaDoc<IoSession> getManagedSessions(SocketAddress JavaDoc serviceAddress) {
84         return delegate.getManagedSessions(serviceAddress);
85     }
86
87     public IoSession newSession(SocketAddress JavaDoc remoteAddress,
88             SocketAddress JavaDoc localAddress) {
89         return delegate.newSession(remoteAddress, localAddress);
90     }
91
92     public IoServiceConfig getDefaultConfig() {
93         return delegate.getDefaultConfig();
94     }
95
96     public IoFilterChainBuilder getFilterChainBuilder() {
97         return delegate.getFilterChainBuilder();
98     }
99
100     public void setFilterChainBuilder(IoFilterChainBuilder builder) {
101         delegate.setFilterChainBuilder(builder);
102     }
103
104     public DefaultIoFilterChainBuilder getFilterChain() {
105         return delegate.getFilterChain();
106     }
107
108     public void addListener(IoServiceListener listener) {
109         delegate.addListener(listener);
110     }
111
112     public void removeListener(IoServiceListener listener) {
113         delegate.removeListener(listener);
114     }
115 }
116
Popular Tags