KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > exchange > Channel


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.exchange;
14
15 /**
16  * @author Sameer Charles
17  */

18 public interface Channel {
19
20     /**
21      * <p>
22      * opens the cahnnel for communication NOTE : every channel has to be open for 2-way communication
23      * </p>
24      * @throws ChannelInitializationException
25      */

26     void open() throws ChannelInitializationException;
27
28     /**
29      * <p>
30      * Push packet to the FIFO Channel. adds ID to check list if packet needs confirmation.
31      * </p>
32      * @param packet
33      * @throws ChannelOverflowException
34      * @throws ChannelException
35      */

36     void send(Packet packet) throws ChannelOverflowException, ChannelException;
37
38     /**
39      * <p>
40      * pushes packet to the receiving FIFO channel pigns back the same packet without body for confirmation
41      * </p>
42      * @param packet
43      * @throws ChannelOverflowException
44      * @throws ChannelException
45      */

46     void receive(Packet packet) throws ChannelOverflowException, ChannelException;
47
48     /**
49      * removes any packet reference for the specified ID.This could be used once packet confirmation is received
50      * @param id
51      * @throws ChannelException
52      */

53     void removePacketReference(String JavaDoc id) throws ChannelException;
54
55     /**
56      * flush all resources referenced through this channel.
57      * @throws ChannelException
58      */

59     void flush() throws ChannelException;
60
61     /**
62      * Closes the channel if nothing left in the queue.
63      */

64     void close();
65
66     /**
67      * @return channel ID as specified on challen creation
68      */

69     String JavaDoc getID();
70 }
71
Popular Tags