KickJava   Java API By Example, From Geeks To Geeks.

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


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-2006 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 Packet {
19
20     /**
21      * Implementor must make sure this ID is unique over the process.
22      */

23     String JavaDoc getID();
24
25     /**
26      * Implementing class have to make sure this ID has not been assigned to any parallel packet in the same process
27      */

28     void assignID();
29
30     /**
31      * Sets current packet ID as specified
32      */

33     void assignID(String JavaDoc id);
34
35     /**
36      * Channel through which this packet is being initiated.
37      */

38     void setChannelID(String JavaDoc id);
39
40     /**
41      * Channel through which this packet is being initiated.
42      */

43     String JavaDoc getChannelID();
44
45     /**
46      * hash (key - Header String , value - Value)
47      * @return empty initialized header if none exist.
48      */

49     PacketHeader getHeaders();
50
51     /**
52      * initialize empty PacketHeader if none specified
53      * @param header
54      */

55     void setHeaders(PacketHeader header);
56
57     /**
58      * @param body , packet data
59      */

60     void setBody(PacketBody body);
61
62     /**
63      * @return packet body if any
64      */

65     PacketBody getBody();
66 }
67
Popular Tags