Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: mobile/bearer/http/Protocol.java


1   /**
2    *
3    */
4   package mobile.bearer.http;
5   
6   import java.util.*;
7   
8   /**
9    * <p>
10   * This is set of constants used to determine kind of message. While message body
11   * is "serialized" into bytes stream, there must be a mechanism to determine how to
12   * understand what is the message.
13  
14   * @author Pawel Kozioł
15   * </p>
16   */
17  public interface Protocol {
18  
19    ///////////////////////////////////////
20    //attributes
21  
22  
23  /**
24   * <p>
25   * Represents Queue.
26   * </p>
27   */
28      public static final int QUEUE = 0;
29      /**
30       * <p>
31       * Represents Topic.
32       * </p>
33       */
34  
35      public static final int TOPIC = 1; // we assume that this bit is significant
36                                         // thus all constants below
37                                         // should be even
38  
39    /**
40     * <p>
41     * Represents Lookup.
42     * </p>
43     */
44    public static final int LOOKUP = 2;
45  
46  
47      public static final int CREATE_CONNECTION = 4;
48      public static final int CREATE_QUEUE_CONNECTION = CREATE_CONNECTION & ~QUEUE;
49      public static final int CREATE_TOPIC_CONNECTION = CREATE_CONNECTION | TOPIC;
50  
51  
52      public static final int CREATE_SESSION = 6;
53      public static final int CREATE_QUEUE_SESSION = CREATE_SESSION & ~QUEUE;
54      public static final int CREATE_TOPIC_SESSION = CREATE_SESSION | TOPIC;
55  
56  
57      public static final int CREATE_SENDER = 8;
58      public static final int CREATE_QUEUE_SENDER = CREATE_SENDER & ~QUEUE;
59      public static final int CREATE_TOPIC_PUBLISHER = CREATE_SENDER | TOPIC;
60  
61  
62      public static final int CREATE_RECEIVER = 10;
63      public static final int CREATE_QUEUE_RECEIVER = CREATE_RECEIVER & ~QUEUE;
64     // public static final int CREATE_TOPIC_CONSUMER = CREATE_RECEIVER | TOPIC;
65      public static final int CREATE_TOPIC_SUBSCRIBER =CREATE_RECEIVER | TOPIC;
66  
67  
68      public static final int SEND_BYTES_MESSAGE = 12;
69  
70      public static final int SEND_TEXT_MESSAGE = 14;
71  
72  
73      public static final int RECEIVE_MESSAGE = 16;
74      public static final int RECEIVE_MESSAGE_FROM_QUEUE = RECEIVE_MESSAGE & ~QUEUE;
75      public static final int RECEIVE_MESSAGE_FROM_TOPIC = RECEIVE_MESSAGE | TOPIC;
76  
77  
78      public static final int STOP_CONNECTION = 18;
79  
80      public static final int START_CONNECTION = 20;
81  
82  
83      public static final int CLOSE_CONNECTION = 22;
84  
85  
86      public static final int COMMIT = 24;
87  
88      public static final int ROLLBACK = 26;
89  
90  
91      public static final int CLOSE_MESSAGE_PRODUCER = 28;
92  
93      public static final int CLOSE_MESSAGE_CONSUMER = 30;
94  
95      public static final int ACKNOWLEDGE_MESSAGE = 32;
96  
97      public static final int PUBLISH_BYTES_MESSAGE = 34;
98  
99      public static final int PUBLISH_TEXT_MESSAGE = 36;
100 
101 
102     public static final int CREATE_DURABLE_CONSUMER = 38;
103     //public static final int CREATE_DURABLE_QUEUE_CONSUMER = CREATE_DURABLE_CONSUMER & ~QUEUE;
104     public static final int CREATE_DURABLE_TOPIC_SUBSCRIBER = CREATE_DURABLE_CONSUMER |TOPIC;
105 
106     public static final int CREATE_TEMPORARY_DESTINATION = 40;
107     public static final int CREATE_TEMPORARY_QUEUE = CREATE_TEMPORARY_DESTINATION & ~QUEUE;
108     public static final int CREATE_TEMPORARY_TOPIC = CREATE_TEMPORARY_DESTINATION | TOPIC;
109 
110     public static final int RECEIVE_MESSAGE_TIMEOUT = 42;
111 
112     public static final int TEMPRORARY = 64;
113     public static final int DELETE_TEMPORARY_DESTINATION = 66;
114     public static final int DELETE_TEMPORARY_QUEUE = DELETE_TEMPORARY_DESTINATION & ~QUEUE;
115     public static final int DELETE_TEMPORARY_TOPIC = DELETE_TEMPORARY_DESTINATION | TOPIC;
116 
117 
118 
119 
120     public static final int REP_CONNECTION_FACTORY = 100;
121     public static final int REP_QUEUE_CONNECTION_FACTORY = REP_CONNECTION_FACTORY & ~QUEUE;
122     public static final int REP_TOPIC_CONNECTION_FACTORY = REP_CONNECTION_FACTORY | TOPIC;
123 
124 
125     public static final int REP_QUEUE = 102;
126     public static final int REP_TOPIC = REP_QUEUE | TOPIC;
127 
128 
129 
130     public static final int REP_CONNECTION = 104;
131     public static final int REP_QUEUE_CONNECTION = REP_CONNECTION & ~QUEUE;
132     public static final int REP_TOPIC_CONNECTION = REP_CONNECTION | TOPIC;
133 
134 
135 
136     public static final int REP_SESSION = 106;
137     public static final int REP_QUEUE_SESSION = REP_SESSION & ~QUEUE;
138     public static final int REP_TOPIC_SESSION = REP_SESSION | TOPIC;
139 
140 
141     public static final int REP_SENDER = 108;
142     public static final int REP_QUEUE_SENDER = REP_SENDER & ~QUEUE;
143     public static final int REP_TOPIC_PUBLISHER = REP_SENDER | TOPIC;
144 
145     public static final int REP_RECEIVER = 110;
146     public static final int REP_QUEUE_RECEIVER = REP_RECEIVER & ~ QUEUE;
147     public static final int REP_TOPIC_SUBSCRIBER = REP_RECEIVER | TOPIC;
148 
149     public static final int REP_BYTES_MESSAGE = 112;
150     public static final int REP_BYTES_MESSAGE_FROM_QUEUE = REP_BYTES_MESSAGE & ~QUEUE;
151     public static final int REP_BYTES_MESSAGE_FROM_TOPIC = REP_BYTES_MESSAGE | TOPIC;
152 
153     public static final int REP_TEXT_MESSAGE = 114;
154     public static final int REP_TEXT_MESSAGE_FROM_QUEUE = REP_TEXT_MESSAGE & ~QUEUE;
155     public static final int REP_TEXT_MESSAGE_FROM_TOPIC = REP_TEXT_MESSAGE | TOPIC;
156 
157 
158 
159     public static final int REP_DURABLE_TOPIC_SUBSCRIBER = 116;
160 
161     public static final int REP_TEMPORARY_DESTINATION = 128;
162     public static final int REP_TEMPORARY_QUEUE = REP_TEMPORARY_DESTINATION & ~QUEUE;
163     public static final int REP_TEMPORARY_TOPIC = REP_TEMPORARY_DESTINATION | TOPIC;
164 
165 
166 
167     public static final int EXC_INVALID_DESTINATION  =200;
168 
169     public static final int EXC_RESOURCE_ALLOCATION =    201;
170 
171 /**
172  * <p>
173  * Represents ...
174  * </p>
175  */
176     public static final int EXC_OTHER = 202;
177 
178     /**
179      * <p>
180      * Represents a NamingException (JNDI)
181      * </p>
182      */
183         public static final int EXC_NAMING = 203;
184 
185 
186 
187  /* some constants used for serialization */
188     public static final int INT_LEN = 4;
189     public static final int LONG_LEN = 8;
190 
191     /**
192      * <p>
193      * The maximum lentgth of the bytes message stream in the BytesMessage
194      * </p>
195      */
196 
197     public static final int MAX_BYTES_LEN = 10000;
198 
199 } // end Protocol
200 
201 
202 
203 
204 
205 
206