1 /*
2 * Copyright 2006 Simon Raess
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.beep4j.internal;
17
18 import net.sf.beep4j.Channel;
19 import net.sf.beep4j.ChannelHandler;
20
21 /**
22 * Interface implemented by channels that contains methods only visible
23 * to the internal implementation.
24 *
25 * @author Simon Raess
26 */
27 public interface InternalChannel extends Channel {
28
29 /**
30 * Initializes the channel and passes the channel handler in.
31 * The method can wrap the passed in channel handler to add
32 * additional responsibilities (Decorator pattern).
33 *
34 * @param channelHandler the ChannelHandler from the application
35 * @return the ChannelHandler to be used for that channel
36 */
37 ChannelHandler initChannel(ChannelHandler channelHandler);
38
39 /**
40 * Tests whether this channel is in the Alive state.
41 *
42 * @return true iff the channel is in the Alive state
43 */
44 boolean isAlive();
45
46 /**
47 * Tests whether this channel is shutting down. This can be either
48 * caused by the application or the remote peer.
49 *
50 * @return true iff the channel is nor Alive nor Dead
51 */
52 boolean isShuttingDown();
53
54 /**
55 * Tests whether this channel is in the Dead state.
56 *
57 * @return true iff the channel is in the Dead state
58 */
59 boolean isDead();
60
61 }