KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > nl > justobjects > pushlet > core > Protocol


1 // Copyright (c) 2004 Just Objects B.V. <just@justobjects.nl>
2
// Distributable under LGPL license. See terms of license at gnu.org.
3

4 package nl.justobjects.pushlet.core;
5
6
7 /**
8  * Constants for Pushlet protocols.
9  *
10  * @version $Id: Protocol.java,v 1.12 2005/02/28 13:05:59 justb Exp $
11  * @author Just van den Broecke - Just Objects &copy;
12  **/

13 public interface Protocol {
14     /** Default URI . */
15     public static final String JavaDoc DEFAULT_SERVLET_URI = "/pushlet/pushlet.srv";
16
17     //
18
// Common protocol header/parameter names
19
//
20

21     /** Event type (join, leave, data, subscribe etc) . */
22     public static final String JavaDoc P_EVENT = "p_event";
23
24     /** Time in seconds since 1970 */
25     public static final String JavaDoc P_TIME = "p_time";
26
27     /** Event sequence number, numbers per-client. */
28     public static final String JavaDoc P_SEQ = "p_seq";
29
30     /** Subject (topic) of data event. */
31     public static final String JavaDoc P_SUBJECT = "p_subject";
32
33     /** Originator of Event. */
34     public static final String JavaDoc P_FROM = "p_from";
35
36     /** Addressee of Event, subject or client p_id. */
37     public static final String JavaDoc P_TO = "p_to";
38
39     /** Identifier for client instance within server. */
40     public static final String JavaDoc P_ID = "p_id";
41
42     /** Subscription id, identifies single subscription. */
43     public static final String JavaDoc P_SUBSCRIPTION_ID = "p_sid";
44
45     /** Format to receive events */
46     public static final String JavaDoc P_FORMAT = "p_format";
47
48     /** Protocol mode. */
49     public static final String JavaDoc P_MODE = "p_mode";
50
51     /** Reason for errors. */
52     public static final String JavaDoc P_REASON = "p_reason";
53
54     /** URL attribute. */
55     public static final String JavaDoc P_URL = "p_url";
56
57     /** Wait attribute. */
58     public static final String JavaDoc P_WAIT = "p_wait";
59
60     /**
61      * Subscription label, may be used to return user-specific
62      * token with a data event, e.g. the name of a function for a callback.
63      */

64     public static final String JavaDoc P_SUBSCRIPTION_LABEL = "p_label";
65
66     //
67
// Event values with direction for P_EVENT (C=client, S=server)
68
//
69

70     /** C-->S Request to join server. */
71     public static final String JavaDoc E_JOIN = "join";
72
73     /** S-->C Acknowledgement of join. */
74     public static final String JavaDoc E_JOIN_ACK = "join-ack";
75
76     /** C-->S Request to join server. */
77     public static final String JavaDoc E_JOIN_LISTEN = "join-listen";
78
79     /** S-->C Acknowledgement of join. */
80     public static final String JavaDoc E_JOIN_LISTEN_ACK = "join-listen-ack";
81
82     /** C-->S Client starts listening. */
83     public static final String JavaDoc E_LISTEN = "listen";
84
85     /** S-->C Ack of listen. */
86     public static final String JavaDoc E_LISTEN_ACK = "listen-ack";
87
88     /** C-->S Client leaves server. */
89     public static final String JavaDoc E_LEAVE = "leave";
90
91     /** S-->C Ack of leave. */
92     public static final String JavaDoc E_LEAVE_ACK = "leave-ack";
93
94     /** C-->S Publish to subject. */
95     public static final String JavaDoc E_PUBLISH = "publish";
96
97     /** S-->C Publish to subject acknowledge. */
98     public static final String JavaDoc E_PUBLISH_ACK = "publish-ack";
99
100     /** C-->S Subscribe to subject request. */
101     public static final String JavaDoc E_SUBSCRIBE = "subscribe";
102
103     /** S-->C Subscribe to subject acknowledge. */
104     public static final String JavaDoc E_SUBSCRIBE_ACK = "subscribe-ack";
105
106     /** C-->S Unsubscribe from subject request. */
107     public static final String JavaDoc E_UNSUBSCRIBE = "unsubscribe";
108
109     /** S--C Unsubscribe from subject acknowledge. */
110     public static final String JavaDoc E_UNSUBSCRIBE_ACK = "unsubscribe-ack";
111
112     /** S-->C Client error response, transitional error. */
113     public static final String JavaDoc E_NACK = "nack";
114
115     /** S-->C Client should abort, permanent error. */
116     public static final String JavaDoc E_ABORT = "abort";
117
118     /** S-->C Data. */
119     public static final String JavaDoc E_DATA = "data";
120
121     /** S-->C or C-->S Heartbeat. */
122     public static final String JavaDoc E_HEARTBEAT = "hb";
123
124     /** S-->C S-->C or C-->S Heartbeat confirmed. */
125     public static final String JavaDoc E_HEARTBEAT_ACK = "hb-ack";
126
127     /** S-->C or C-->S client refresh of data channel. */
128     public static final String JavaDoc E_REFRESH = "refresh";
129
130     /** S-->C client should refresh data channel. */
131     public static final String JavaDoc E_REFRESH_ACK = "refresh-ack";
132
133     //
134
// Values for P_FORMAT parameter
135
//
136
public static String JavaDoc FORMAT_JAVASCRIPT = "js";
137     public static String JavaDoc FORMAT_SERIALIZED_JAVA_OBJECT = "ser";
138     public static String JavaDoc FORMAT_XML = "xml";
139
140     //
141
// Values for P_MODE parameter
142
//
143
public static final String JavaDoc MODE_STREAM = "stream";
144     public static final String JavaDoc MODE_PULL = "pull";
145     public static final String JavaDoc MODE_POLL = "poll";
146
147 }
148
149 /*
150   * $Log: Protocol.java,v $
151   * Revision 1.12 2005/02/28 13:05:59 justb
152   * introduced join-listen protocol service
153   *
154   * Revision 1.11 2005/02/28 12:45:59 justb
155   * introduced Command class
156   *
157   * Revision 1.10 2005/02/16 12:16:17 justb
158   * added support for "poll" mode
159   *
160   * Revision 1.9 2005/01/24 22:46:02 justb
161   * getting safari to work
162   *
163   * Revision 1.8 2005/01/24 13:42:00 justb
164   * new protocol changes (p_listen)
165   *
166   * Revision 1.7 2005/01/18 16:47:10 justb
167   * protocol changes for v2 and publishing from pushlet client
168   *
169   * Revision 1.6 2005/01/13 14:47:15 justb
170   * control evt: send response on same (control) connection
171   *
172   * Revision 1.5 2004/10/24 13:52:52 justb
173   * small fixes in client lib
174   *
175   * Revision 1.4 2004/10/24 12:58:18 justb
176   * revised client and test classes for new protocol
177   *
178   * Revision 1.3 2004/09/20 22:01:38 justb
179   * more changes for new protocol
180   *
181   * Revision 1.2 2004/09/03 22:35:37 justb
182   * Almost complete rewrite, just checking in now
183   *
184   * Revision 1.1 2004/09/03 21:02:20 justb
185   * make more formalized protocol
186   *
187   *
188   */

189
Popular Tags