1 /***
2 *
3 * Copyright 2004 Hiram Chirino
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.activeio;
18
19 import java.net.URI;
20
21 /***
22 * A ChannelServer is used to accept incoming requests to establish new Channel sessions.
23 *
24 * Like a normal {@see org.activeio.channel.Channel}, A ChannelServer comes in two falvors, either:
25 * {@see org.activeio.AsynchChannelServer} or
26 * {@see org.activeio.SynchChannelServer}.
27 *
28 * @version $Revision$
29 */
30 public interface ChannelServer extends Channel {
31
32 /***
33 * The URI that was used when the channel was bound. This could be different
34 * than what is used by a client to connect to the ChannelServer. For example,
35 * the bind URI might be tcp://localhost:0 which means the channel should bind to
36 * an anonymous port.
37 *
38 * @return The URI that was used when the channel was bound
39 */
40 public URI getBindURI();
41
42 /***
43 * Once bound, the channel may be able to construct a URI that is more sutible for when
44 * a client needs to connect to the server. For examle the port of the URI may be
45 * updated to reflect the actual local port that the channel server is listening on.
46 *
47 * @return a URI that a client can use to connect to the server or null if the channel cannot construct the URI.
48 */
49 public URI getConnectURI();
50
51 }