KickJava   Java API By Example, From Geeks To Geeks.

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


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.net.SocketAddress JavaDoc;
23 import java.util.Set JavaDoc;
24
25 import org.apache.mina.common.ConnectFuture;
26 import org.apache.mina.common.DefaultIoFilterChainBuilder;
27 import org.apache.mina.common.IoConnector;
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 IoConnector} that wraps the other {@link IoConnector}.
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 DelegatedIoConnector implements IoConnector {
41     protected IoConnector delegate;
42
43     /**
44      * Creates a new instance.
45      */

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

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