Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Refactor the workspace

  • Loading branch information...
commit fb753b2b22be413118919113062ba5c8990a72fb 1 parent 6840a95
Jeanfrancois Arcand jfarcand authored

Showing 111 changed files with 106 additions and 20,301 deletions. Show diff stats Hide diff stats

  1. +17 0 .gitignore
  2. +0 22 api/pom.xml
  3. +0 251 api/src/main/java/org/cometd/Bayeux.java
  4. +0 26 api/src/main/java/org/cometd/BayeuxListener.java
  5. +0 72 api/src/main/java/org/cometd/Channel.java
  6. +0 27 api/src/main/java/org/cometd/ChannelBayeuxListener.java
  7. +0 25 api/src/main/java/org/cometd/ChannelListener.java
  8. +0 163 api/src/main/java/org/cometd/Client.java
  9. +0 27 api/src/main/java/org/cometd/ClientBayeuxListener.java
  10. +0 27 api/src/main/java/org/cometd/ClientListener.java
  11. +0 107 api/src/main/java/org/cometd/ConfigurableChannel.java
  12. +0 33 api/src/main/java/org/cometd/DataFilter.java
  13. +0 36 api/src/main/java/org/cometd/DeliverListener.java
  14. +0 57 api/src/main/java/org/cometd/Extension.java
  15. +0 25 api/src/main/java/org/cometd/Listener.java
  16. +0 75 api/src/main/java/org/cometd/Message.java
  17. +0 54 api/src/main/java/org/cometd/MessageListener.java
  18. +0 41 api/src/main/java/org/cometd/QueueListener.java
  19. +0 33 api/src/main/java/org/cometd/RemoveListener.java
  20. +0 67 api/src/main/java/org/cometd/SecurityPolicy.java
  21. +0 28 api/src/main/java/org/cometd/SubscriptionListener.java
  22. +0 1,938 bayeux/bayeux.html
  23. +0 539 bayeux/bayeux.json
  24. BIN  bayeux/bayeux.png
  25. +0 54 bayeux/bayeux_error_codes.json
  26. +0 20 bayeux/dojo.js
  27. BIN  bayeux/intermittent-polling.pdf
  28. BIN  bayeux/long-polling.pdf
  29. +0 484 bayeux/protocol.txt
  30. BIN  bayeux/streaming.pdf
  31. +0 98 client/pom.xml
  32. +0 136 client/src/main/java/org/cometd/client/Advice.java
  33. +0 1,846 client/src/main/java/org/cometd/client/BayeuxClient.java
  34. +0 103 client/src/main/java/org/cometd/client/ext/AckExtension.java
  35. +0 76 client/src/main/java/org/cometd/client/ext/TimesyncClientExtension.java
  36. +0 273 client/src/test/java/org/cometd/client/AckExtensionTest.java
  37. +0 653 client/src/test/java/org/cometd/client/BayeuxClientTest.java
  38. +0 611 client/src/test/java/org/cometd/client/BayeuxLoadGenerator.java
  39. +0 112 client/src/test/java/org/cometd/client/BayeuxLoadServer.java
  40. +0 384 client/src/test/java/org/cometd/client/ChatRoomClient.java
  41. +0 88 client/src/test/java/org/cometd/client/ChatService.java
  42. +0 239 client/src/test/java/org/cometd/client/MessageDeepCopyTest.java
  43. +0 216 client/src/test/java/org/cometd/client/SimpleEchoBayeuxClient.java
  44. +0 201 client/src/test/java/org/cometd/client/StatisticsHelper.java
  45. +0 15 examples/README.txt
  46. +0 25 examples/bin/run.sh
  47. +0 33 examples/pom.xml
  48. +0 95 examples/src/main/java/org/cometd/examples/ChatService.java
  49. +0 201 examples/src/main/java/org/cometd/examples/CometdDemo.java
  50. +0 121 examples/src/main/java/org/cometd/examples/CometdDemoServlet.java
  51. +0 23 examples/src/main/webapp/WEB-INF/filters.json
  52. +0 65 examples/src/main/webapp/WEB-INF/web.xml
  53. +0 43 examples/src/main/webapp/examples/timesync/index.html
  54. +0 14 examples/src/main/webapp/index.html
  55. BIN  examples/src/test/resources/keystore
  56. +0 33 oort/pom.xml
  57. +0 385 oort/src/main/java/org/cometd/oort/Oort.java
  58. +0 176 oort/src/main/java/org/cometd/oort/OortComet.java
  59. +0 124 oort/src/main/java/org/cometd/oort/OortServlet.java
  60. +0 398 oort/src/main/java/org/cometd/oort/Seti.java
  61. +0 95 oort/src/main/java/org/cometd/oort/SetiServlet.java
  62. +0 145 oort/src/test/java/org/cometd/oort/OortChatService.java
  63. +0 117 oort/src/test/java/org/cometd/oort/OortDemo.java
  64. +0 67 oort/src/test/java/org/cometd/oort/OortDemoServlet.java
  65. +89 33 pom.xml
  66. +0 59 server/pom.xml
  67. +0 1,552 server/src/main/java/org/cometd/server/AbstractBayeux.java
  68. +0 359 server/src/main/java/org/cometd/server/AbstractCometdServlet.java
  69. +0 46 server/src/main/java/org/cometd/server/AbstractTransport.java
  70. +0 452 server/src/main/java/org/cometd/server/BayeuxService.java
  71. +0 163 server/src/main/java/org/cometd/server/ChannelId.java
  72. +0 560 server/src/main/java/org/cometd/server/ChannelImpl.java
  73. +0 710 server/src/main/java/org/cometd/server/ClientImpl.java
  74. +0 102 server/src/main/java/org/cometd/server/JSONPTransport.java
  75. +0 93 server/src/main/java/org/cometd/server/JSONTransport.java
  76. +0 376 server/src/main/java/org/cometd/server/MessageImpl.java
  77. +0 287 server/src/main/java/org/cometd/server/MessagePool.java
  78. +0 36 server/src/main/java/org/cometd/server/Transport.java
  79. +0 118 server/src/main/java/org/cometd/server/continuation/ContinuationBayeux.java
  80. +0 223 server/src/main/java/org/cometd/server/continuation/ContinuationClient.java
  81. +0 322 server/src/main/java/org/cometd/server/continuation/ContinuationCometdServlet.java
  82. +0 138 server/src/main/java/org/cometd/server/ext/AcknowledgedMessagesClientExtension.java
  83. +0 68 server/src/main/java/org/cometd/server/ext/AcknowledgedMessagesExtension.java
  84. +0 228 server/src/main/java/org/cometd/server/ext/ArrayIdQueue.java
  85. +0 69 server/src/main/java/org/cometd/server/ext/TimestampExtension.java
  86. +0 171 server/src/main/java/org/cometd/server/ext/TimesyncExtension.java
  87. +0 135 server/src/main/java/org/cometd/server/filter/JSONDataFilter.java
  88. +0 31 server/src/main/java/org/cometd/server/filter/NoMarkupFilter.java
  89. +0 34 server/src/main/java/org/cometd/server/filter/NoScriptsFilter.java
  90. +0 84 server/src/main/java/org/cometd/server/filter/RegexFilter.java
  91. +0 9 server/src/main/resources/org/cometd/server/jmx/AbstractBayeux-mbean.properties
  92. +0 53 server/src/test/java/org/cometd/server/AbstractBayeuxClientServerTest.java
  93. +0 84 server/src/test/java/org/cometd/server/AbstractBayeuxServerTest.java
  94. +0 120 server/src/test/java/org/cometd/server/BayeuxServiceMetaNotificationsTest.java
  95. +0 125 server/src/test/java/org/cometd/server/BayeuxServiceWithThreadPoolTest.java
  96. +0 43 server/src/test/java/org/cometd/server/BrowserMappingTest.java
  97. +0 116 server/src/test/java/org/cometd/server/ChannelIdTest.java
  98. +0 251 server/src/test/java/org/cometd/server/ChannelImplTest.java
  99. +0 443 server/src/test/java/org/cometd/server/ClientImplTest.java
  100. +0 294 server/src/test/java/org/cometd/server/ConcurrentDisconnectSubscribePublishTest.java
  101. +0 18 server/src/test/java/org/cometd/server/MessagePoolTest.java
  102. +0 54 server/src/test/java/org/cometd/server/ServerRedeployTest.java
  103. +0 54 server/src/test/java/org/cometd/server/ServerShutdownTest.java
  104. +0 67 server/src/test/java/org/cometd/server/ext/ArrayIdQueueTest.java
  105. +0 94 server/src/test/java/org/cometd/server/ext/ExtensionConnectTest.java
  106. +0 93 server/src/test/java/org/cometd/server/ext/ExtensionDisconnectTest.java
  107. +0 83 server/src/test/java/org/cometd/server/ext/ExtensionHandshakeTest.java
  108. +0 116 server/src/test/java/org/cometd/server/ext/ExtensionPublishReceivedTest.java
  109. +0 94 server/src/test/java/org/cometd/server/ext/ExtensionPublishSentTest.java
  110. +0 95 server/src/test/java/org/cometd/server/ext/ExtensionSubscribeTest.java
  111. +0 104 server/src/test/java/org/cometd/server/ext/ExtensionUnsubscribeTest.java
17 .gitignore
... ... @@ -0,0 +1,17 @@
  1 +*.class
  2 +*~
  3 +.*.swp
  4 +.*.swo
  5 +.loadpath
  6 +.buildpath
  7 +.classpath
  8 +.project
  9 +.settings
  10 +.idea
  11 +*.iml
  12 +*.ipr
  13 +*.iws
  14 +nbproject
  15 +.DS_Store
  16 +target
  17 +test-output
22 api/pom.xml
... ... @@ -1,22 +0,0 @@
1   -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2   -
3   - <parent>
4   - <groupId>org.cometd.java</groupId>
5   - <artifactId>cometd-java-project</artifactId>
6   - <version>1.1.2 </version>
7   - </parent>
8   -
9   - <modelVersion>4.0.0</modelVersion>
10   - <artifactId>cometd-api</artifactId>
11   - <packaging>jar</packaging>
12   - <name>CometD :: Java :: API</name>
13   -
14   - <dependencies>
15   - <dependency>
16   - <groupId>javax.servlet</groupId>
17   - <artifactId>servlet-api</artifactId>
18   - <scope>provided</scope>
19   - </dependency>
20   - </dependencies>
21   -
22   -</project>
251 api/src/main/java/org/cometd/Bayeux.java
... ... @@ -1,251 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007-2008 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -
15   -package org.cometd;
16   -
17   -import java.util.Collection;
18   -import javax.servlet.http.HttpServletRequest;
19   -
20   -/* ------------------------------------------------------------ */
21   -/** Bayeux Server Interface.
22   - * <p>
23   - * This interface represents the server side API for the Bayeux messaging protocol.
24   - * <p>
25   - * The implementation of Bayeux will be registered as a {@link javax.servlet.ServletContext} attribute
26   - * with the name "org.cometd.bayeux". This may be set prior to the context being initialized
27   - * (if the instance is shared between contexts) or during context initialization.
28   - * <p>
29   - * Bayeux implementations must be thread safe and multiple threads may simultaneously
30   - * call Bayeux methods.
31   - *
32   - */
33   -public interface Bayeux
34   -{
35   -
36   - /** ServletContext attribute name used to obtain the Bayeux object */
37   - /* was DOJOX_COMETD_BAYEUX */
38   - public static final String ATTRIBUTE ="org.cometd.bayeux";
39   -
40   - /**Meta definitions for channels*/
41   - public static final String META="/meta";
42   - /**Meta definitions for channels*/
43   - public static final String META_SLASH="/meta/";
44   - /**Meta definitions for channels - connect message*/
45   - public static final String META_CONNECT="/meta/connect";
46   - /**Meta definitions for channels - client messsage*/
47   - public static final String META_CLIENT="/meta/client";
48   - /**Meta definitions for channels - disconnect messsage*/
49   - public static final String META_DISCONNECT="/meta/disconnect";
50   - /**Meta definitions for channels - handshake messsage*/
51   - public static final String META_HANDSHAKE="/meta/handshake";
52   - /**Meta definitions for channels - ping messsage*/
53   - public static final String META_PING="/meta/ping";
54   - /**Meta definitions for channels - status messsage*/
55   - public static final String META_STATUS="/meta/status";
56   - /**Meta definitions for channels - subscribe messsage*/
57   - public static final String META_SUBSCRIBE="/meta/subscribe";
58   - /**Meta definitions for channels - unsubscribe messsage*/
59   - public static final String META_UNSUBSCRIBE="/meta/unsubscribe";
60   - /*Field names inside Bayeux messages*/
61   - /**Field names inside Bayeux messages - clientId field*/
62   - public static final String CLIENT_FIELD="clientId";
63   - /**Field names inside Bayeux messages - data field*/
64   - public static final String DATA_FIELD="data";
65   - /**Field names inside Bayeux messages - channel field*/
66   - public static final String CHANNEL_FIELD="channel";
67   - /**Field names inside Bayeux messages - id field*/
68   - public static final String ID_FIELD="id";
69   - /**Field names inside Bayeux messages - error field*/
70   - public static final String ERROR_FIELD="error";
71   - /**Field names inside Bayeux messages - timestamp field*/
72   - public static final String TIMESTAMP_FIELD="timestamp";
73   - /**Field names inside Bayeux messages - transport field*/
74   - public static final String TRANSPORT_FIELD="transport";
75   - /**Field names inside Bayeux messages - advice field*/
76   - public static final String ADVICE_FIELD="advice";
77   - /**Field names inside Bayeux messages - successful field*/
78   - public static final String SUCCESSFUL_FIELD="successful";
79   - /**Field names inside Bayeux messages - subscription field*/
80   - public static final String SUBSCRIPTION_FIELD="subscription";
81   - /**Field names inside Bayeux messages - ext field*/
82   - public static final String EXT_FIELD="ext";
83   - /**Field names inside Bayeux messages - connectionType field*/
84   - public static final String CONNECTION_TYPE_FIELD="connectionType";
85   - /**Field names inside Bayeux messages - version field*/
86   - public static final String VERSION_FIELD="version";
87   - /**Field names inside Bayeux messages - minimumVersion field*/
88   - public static final String MIN_VERSION_FIELD="minimumVersion";
89   - /**Field names inside Bayeux messages - supportedConnectionTypes field*/
90   - public static final String SUPPORTED_CONNECTION_TYPES_FIELD ="supportedConnectionTypes";
91   - /**Field names inside Bayeux messages - json-comment-filtered field*/
92   - public static final String JSON_COMMENT_FILTERED_FIELD="json-comment-filtered";
93   - /**Field names inside Bayeux messages - reconnect field*/
94   - public static final String RECONNECT_FIELD = "reconnect";
95   - /**Field names inside Bayeux messages - interval field*/
96   - public static final String INTERVAL_FIELD = "interval";
97   - /**Field values inside Bayeux messages - retry response*/
98   - public static final String RETRY_RESPONSE = "retry";
99   - /**Field values inside Bayeux messages - handshake response*/
100   - public static final String HANDSHAKE_RESPONSE = "handshake";
101   - /**Field values inside Bayeux messages - none response*/
102   - public static final String NONE_RESPONSE = "none";
103   - /**Service channel names-starts with*/
104   - public static final String SERVICE="/service";
105   - /**Service channel names-trailing slash*/
106   - public static final String SERVICE_SLASH="/service/";
107   - /*Transport types*/
108   - /**Transport types - long polling*/
109   - public static final String TRANSPORT_LONG_POLL="long-polling";
110   - /**Transport types - callback polling*/
111   - public static final String TRANSPORT_CALLBACK_POLL="callback-polling";
112   - /**Transport types - iframe*/
113   - public static final String TRANSPORT_IFRAME="iframe";
114   - /**Transport types - flash*/
115   - public static final String TRANSPORT_FLASH="flash";
116   -
117   - /*http field names*/
118   - /**http helpers - application/json content type*/
119   - public static final String JSON_CONTENT_TYPE="application/json;charset=UTF-8";
120   - /**http helpers - parameter name for json message*/
121   - public static final String MESSAGE_PARAMETER="message";
122   - /**http helpers - name of the jsonp parameter*/
123   - public static final String JSONP_PARAMETER="jsonp";
124   - /**http helpers - default name of the jsonp callback function*/
125   - public static final String JSONP_DEFAULT_NAME="jsonpcallback";
126   -
127   - /* ------------------------------------------------------------ */
128   - /** Get a Channel instance by ID.
129   - * @param channelId The Channel ID
130   - * @param create If true, a channel will be created if it does not exist.
131   - * @return A Channel instance or null if it does not exist and create is false.
132   - */
133   - public Channel getChannel(String channelId, boolean create);
134   -
135   - /* ------------------------------------------------------------ */
136   - /** Check if channel exists.
137   - * @param channel
138   - * @return True if Bayeux has a channel with the channel name.
139   - */
140   - public boolean hasChannel(String channel);
141   -
142   - /* ------------------------------------------------------------ */
143   - public Channel removeChannel(String channel);
144   -
145   - /* ------------------------------------------------------------ */
146   - /** Get all known channels.
147   - * @return A collection of all known channel instances.
148   - */
149   - public Collection<Channel> getChannels();
150   -
151   - /* ------------------------------------------------------------ */
152   - /** Get {@link Client} by ID.
153   - * @param clientId
154   - * @return A Client instance or null if the ID is not known
155   - */
156   - public Client getClient(String clientId);
157   -
158   - /* ------------------------------------------------------------ */
159   - public boolean hasClient(String clientId);
160   -
161   - /* ------------------------------------------------------------ */
162   - /** Create a new server side Client.
163   - * Server side clients can be used to interact with Bayeux with
164   - * publish and subscribe messaging.
165   - * @param idprefix An identifier to prefix to the client ID.
166   - * @return A {@link Client} instance with {@link Client#isLocal()} returning true.
167   - */
168   - public Client newClient(String idprefix);
169   -
170   - /* ------------------------------------------------------------ */
171   - public Client removeClient(String clientId);
172   -
173   - /* ------------------------------------------------------------ */
174   - /** Get a collection of all Clients.
175   - * The collection is copy of the underlying collection.
176   - * @return Collection of clients.
177   - */
178   - public Collection<Client> getClients();
179   -
180   - /* ------------------------------------------------------------ */
181   - /** Get the {@link SecurityPolicy} instance.
182   - * @return The current {@link SecurityPolicy} instance.
183   - */
184   - public SecurityPolicy getSecurityPolicy();
185   -
186   - /* ------------------------------------------------------------ */
187   - /** Set the security policy for the Bayeux instance.
188   - * <p>
189   - * The Security Policy will be called to check access for all handshakes,
190   - * subscriptions and publishing.
191   - *
192   - * @param securityPolicy The security policy instance.
193   - */
194   - public void setSecurityPolicy(SecurityPolicy securityPolicy);
195   -
196   - /* ------------------------------------------------------------ */
197   - /** Adds a bayeux extension.
198   - * A bayeux extension may modify a message or return a new message.
199   - * @param ext the extension to add
200   - * @see #removeExtension(Extension)
201   - */
202   - public void addExtension(Extension ext);
203   -
204   - /**
205   - * Removes a bayeux extension.
206   - * @param ext the extension to remove
207   - * @see #addExtension(Extension)
208   - */
209   - public void removeExtension(Extension ext);
210   -
211   - /* ------------------------------------------------------------ */
212   - /**
213   - * Adds a bayeux listener,
214   - * @param listener the listener to add
215   - * @see #removeListener(BayeuxListener)
216   - */
217   - public void addListener(BayeuxListener listener);
218   -
219   - /**
220   - * Removes a bayeux listener
221   - * @param listener the listener to remove
222   - * @see #addListener(BayeuxListener)
223   - */
224   - public void removeListener(BayeuxListener listener);
225   -
226   - /* ------------------------------------------------------------ */
227   - /**
228   - * @return the max client queue size
229   - * @see #setMaxClientQueue(int)
230   - */
231   - public int getMaxClientQueue();
232   -
233   - /* ------------------------------------------------------------ */
234   - /**
235   - * @param size The size which if a client queue exceeds, forces a call to
236   - * {@link QueueListener#queueMaxed(Client, Message)} to check if the message should be
237   - * added. If set to -1, there is no queue limit. If set to zero, messages are
238   - * not queued unless a {@link QueueListener} is applied that returns true.
239   - * @see #getMaxClientQueue()
240   - */
241   - public void setMaxClientQueue(int size);
242   -
243   - /* ------------------------------------------------------------ */
244   - /** Get the current Servlet Request.
245   - * If the calling thread is in the context of a servlet call, then
246   - * return the request object. This can be used to authenticate users and/or
247   - * perform other validation of the caller.
248   - * @return A servlet request or null if none in scope.
249   - */
250   - public HttpServletRequest getCurrentRequest();
251   -}
26 api/src/main/java/org/cometd/BayeuxListener.java
... ... @@ -1,26 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2008 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -package org.cometd;
15   -
16   -import java.util.EventListener;
17   -
18   -
19   -/**
20   - * A marker interface for all interfaces that listen for Bayeux events
21   - *
22   - */
23   -public interface BayeuxListener extends EventListener
24   -{
25   -
26   -}
72 api/src/main/java/org/cometd/Channel.java
... ... @@ -1,72 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007-2008 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -
15   -package org.cometd;
16   -
17   -import java.util.Collection;
18   -
19   -/**
20   - * <p>A Bayeux channel.</p>
21   - * <p>A Channel represents a routing path for messages to {@link Client}s, and
22   - * looks like a directory path:
23   - * <pre>
24   - * /some/channel
25   - * </pre>
26   - * Clients may subscribe to a channel and will be delivered all messages
27   - * published to the channel.</p>
28   - * <p>Channels may be <em>lazy</em>, which means that all messages published to that channel
29   - * will be marked as lazy. Lazy messages are queued but do not wake up waiting clients.</p>
30   - *
31   - * @version $Revision: 686 $ $Date: 2009-07-03 11:07:24 +0200 (Fri, 03 Jul 2009) $
32   - */
33   -public interface Channel extends ConfigurableChannel
34   -{
35   - /**
36   - * @return true if the channel has been removed, false if it was not possible to remove the channel
37   - */
38   - public boolean remove();
39   -
40   - /**
41   - * Publishes a message.
42   - * @param fromClient the client source of the message, or null
43   - * @param data the message data
44   - * @param msgId the message ID or null
45   - */
46   - public void publish(Client fromClient, Object data, String msgId);
47   -
48   - /**
49   - * Subscribes the given {@link Client} to this channel.
50   - * @param subscriber the client to subscribe
51   - * @see #unsubscribe(Client)
52   - */
53   - public void subscribe(Client subscriber);
54   -
55   - /**
56   - * Unsubscribes the given {@link Client} from this channel.
57   - * @param subscriber the client to unsubscribe
58   - * @see #subscribe(Client)
59   - */
60   - public void unsubscribe(Client subscriber);
61   -
62   - /**
63   - * Returns a collection that is a copy of clients subscribed to this channel.
64   - * @return the clients subscribed to this channel
65   - */
66   - public Collection<Client> getSubscribers();
67   -
68   - /**
69   - * @return the number of clients subscribed to this channel
70   - */
71   - public int getSubscriberCount();
72   -}
27 api/src/main/java/org/cometd/ChannelBayeuxListener.java
... ... @@ -1,27 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2008 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -package org.cometd;
15   -
16   -/**
17   - * A {@link BayeuxListener} with call backs for channel life cycle events
18   - *
19   - */
20   -public interface ChannelBayeuxListener extends BayeuxListener
21   -{
22   - /* ------------------------------------------------------------ */
23   - public void channelAdded(Channel channel);
24   -
25   - /* ------------------------------------------------------------ */
26   - public void channelRemoved(Channel channel);
27   -}
25 api/src/main/java/org/cometd/ChannelListener.java
... ... @@ -1,25 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2008 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -package org.cometd;
15   -
16   -import java.util.EventListener;
17   -
18   -/**
19   - * A marker interface for all interfaces that listen for Channel events
20   - *
21   - */
22   -public interface ChannelListener extends EventListener
23   -{
24   -
25   -}
163 api/src/main/java/org/cometd/Client.java
... ... @@ -1,163 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -
15   -package org.cometd;
16   -
17   -import java.util.List;
18   -import java.util.Queue;
19   -
20   -/* ------------------------------------------------------------ */
21   -/**
22   - * <p>A Bayeux Client.</p>
23   - * <p>A Client instance represents a consumer/producer of messages in bayeux.
24   - * A Client may subscribe to channels and publish messages to channels.</p>
25   - * <p>Client instances should not be directly created by uses, but should
26   - * be obtained via the {@link Bayeux#getClient(String)} or {@link Bayeux#newClient(String)}
27   - * methods.</p>
28   - * <p>Two types of client may be represented by this interface:</p>
29   - * <ul>
30   - * <li>The server representation of a remote client connected via HTTP</li>
31   - * <li>A remote client</li>
32   - * </ul>
33   - *
34   - * @version $Revision: 1453 $ $Date: 2009-02-25 12:57:20 +0100 (Wed, 25 Feb 2009) $
35   - */
36   -public interface Client
37   -{
38   - /* ------------------------------------------------------------ */
39   - /**
40   - * @return the unique ID representing this client
41   - */
42   - public abstract String getId();
43   -
44   - /* ------------------------------------------------------------ */
45   - /**
46   - * @return whether or not this client has messages to send
47   - */
48   - public abstract boolean hasMessages();
49   -
50   - /* ------------------------------------------------------------ */
51   - /**
52   - * Takes any messages queued for a client.
53   - *
54   - * @deprecated use {@link #addListener(ClientListener)} to be notified of messages
55   - */
56   - public abstract List<Message> takeMessages();
57   -
58   - /* ------------------------------------------------------------ */
59   - /**
60   - * Delivers a message to the remote client represented by this object.
61   - *
62   - * @param from the Client that sends the message
63   - * @param toChannel the channel onto which the message is sent
64   - * @param data the data of the message
65   - * @param id the message ID
66   - */
67   - public void deliver(Client from, String toChannel, Object data, String id);
68   -
69   - /* ------------------------------------------------------------ */
70   - /**
71   - * Adds a bayeux client extension.
72   - * A bayeux client extension may examine a message or return a new message.
73   - * A bayeux client extension should not modify a message as it may be sent to
74   - * multiple clients, instead it should deep copy the passed message.
75   - *
76   - * @param ext the extension to add
77   - * @see #removeExtension(Extension)
78   - */
79   - public void addExtension(Extension ext);
80   -
81   - /**
82   - * Removes a bayeux client extension.
83   - *
84   - * @param ext the extension to removeù
85   - * @see #addExtension(Extension)
86   - */
87   - public void removeExtension(Extension ext);
88   -
89   - /* ------------------------------------------------------------ */
90   - /**
91   - * Adds a listener.
92   - *
93   - * @param listener the listener to add
94   - * @see #removeListener(ClientListener)
95   - */
96   - public void addListener(ClientListener listener);
97   -
98   - /* ------------------------------------------------------------ */
99   - /**
100   - * Removes a listener
101   - *
102   - * @param listener the listener to remove
103   - * @see #addListener(ClientListener)
104   - */
105   - public void removeListener(ClientListener listener);
106   -
107   - /* ------------------------------------------------------------ */
108   - /**
109   - * @return true if the client is local, false if this client is either
110   - * a remote HTTP client or a java client to a remote server.
111   - */
112   - public boolean isLocal();
113   -
114   - /* ------------------------------------------------------------ */
115   - /**
116   - * Starts a batch of messages.
117   - * Messages will not be delivered remotely until the corresponding
118   - * {@link #endBatch()} is called.
119   - * Batches may be nested and messages are only sent once all batches are ended.
120   - *
121   - * @see #endBatch()
122   - */
123   - public void startBatch();
124   -
125   - /* ------------------------------------------------------------ */
126   - /**
127   - * Ends a batch of messages.
128   - * Messages will not be delivered that have been queued since the previous
129   - * {@link #startBatch()} is called.
130   - * Batches may be nested and messages are only sent once all batches are ended.
131   - *
132   - * @see #startBatch()
133   - */
134   - public void endBatch();
135   -
136   - /* ------------------------------------------------------------ */
137   - /**
138   - * Disconnects this Client from the server.
139   - */
140   - public void disconnect();
141   -
142   - /* ------------------------------------------------------------ */
143   - /**
144   - * @return the message queue (its usage must synchronize on this Client instance).
145   - */
146   - public Queue<Message> getQueue();
147   -
148   - /* ------------------------------------------------------------ */
149   - /**
150   - * @param max The size which if a client queue exceeds, forces a call to
151   - * {@link QueueListener#queueMaxed(Client, Client, Message)} to check if the message should be added.
152   - * If set to -1, there is no queue limit. If set to zero, messages are not queued.
153   - * @see #getMaxQueue()
154   - */
155   - public void setMaxQueue(int max);
156   -
157   - /* ------------------------------------------------------------ */
158   - /**
159   - * @return the max queue size
160   - * @see #setMaxQueue(int)
161   - */
162   - public int getMaxQueue();
163   -}
27 api/src/main/java/org/cometd/ClientBayeuxListener.java
... ... @@ -1,27 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2008 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -package org.cometd;
15   -
16   -/**
17   - * A {@link BayeuxListener} with call backs for client life cycle events
18   - *
19   - */
20   -public interface ClientBayeuxListener extends BayeuxListener
21   -{
22   - /* ------------------------------------------------------------ */
23   - public void clientAdded(Client client);
24   -
25   - /* ------------------------------------------------------------ */
26   - public void clientRemoved(Client client);
27   -}
27 api/src/main/java/org/cometd/ClientListener.java
... ... @@ -1,27 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007-2008 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -
15   -package org.cometd;
16   -
17   -import java.util.EventListener;
18   -
19   -/**
20   - * A marker interface for all interfaces that listen for Client events.
21   - * See subinterfaces for specific behavior.
22   - *
23   - * @version $Revision: 1453 $ $Date: 2009-02-25 12:57:20 +0100 (Wed, 25 Feb 2009) $
24   - */
25   -public interface ClientListener extends EventListener
26   -{
27   -}
107 api/src/main/java/org/cometd/ConfigurableChannel.java
... ... @@ -1,107 +0,0 @@
1   -package org.cometd;
2   -
3   -import java.util.Collection;
4   -
5   -/**
6   - * <p>Represents a the configurable API of a channel.</p>
7   - * <p>Channels can be configured by registering a listener that implements
8   - * {@link Initializer} on the Bayeux object. </p>
9   - * <p>Method {@link Initializer#configureChannel(ConfigurableChannel)} will be
10   - * called to allow user code to configure the channel, and it is guaranteed
11   - * that the creation and configuration of a channel is atomic: other threads
12   - * that may want to create the same channel concurrently will wait until the
13   - * current thread has completed the creation and configuration of the channel.</p>
14   - *
15   - * @version $Revision: 1167 $ $Date: 2010-05-13 11:10:15 -0400 (Thu, 13 May 2010) $
16   - */
17   -public interface ConfigurableChannel
18   -{
19   - /**
20   - * @return the channel's name
21   - */
22   - String getId();
23   -
24   - /**
25   - * Indicates whether the channel is persistent or not.
26   - * Non persistent channels are removed when the last subscription is
27   - * removed.
28   - * @return true if the Channel will persist even when all subscriptions are gone.
29   - * @see #setPersistent(boolean)
30   - */
31   - boolean isPersistent();
32   -
33   - /**
34   - * Sets the persistency of this channel.
35   - * @param persistent true if the channel is persistent, false otherwise
36   - * @see #isPersistent()
37   - */
38   - void setPersistent(boolean persistent);
39   -
40   - /**
41   - * Adds the given {@link DataFilter} to this channel.
42   - * @param filter the data filter to add
43   - * @see #removeDataFilter(DataFilter)
44   - * @see #getDataFilters()
45   - */
46   - void addDataFilter(DataFilter filter);
47   -
48   - /**
49   - * Removes the given {@link DataFilter} from this channel.
50   - * @param filter the data filter to remove
51   - * @return the removed data filter
52   - * @see #addDataFilter(DataFilter)
53   - */
54   - DataFilter removeDataFilter(DataFilter filter);
55   -
56   - /**
57   - * Returns a collection copy of the data filters for this channel.
58   - * @return the data filters for this channel
59   - */
60   - Collection<DataFilter> getDataFilters();
61   -
62   - /**
63   - * Adds a channel listener to this channel.
64   - * @param listener the listener to add
65   - * @see #removeListener(ChannelListener)
66   - */
67   - void addListener(ChannelListener listener);
68   -
69   - /**
70   - * Removes the channel listener from this channel.
71   - * @param listener the listener to remove
72   - * @see #addListener(ChannelListener)
73   - */
74   - void removeListener(ChannelListener listener);
75   -
76   - /**
77   - * @return whether the channel is lazy.
78   - * @see #setLazy(boolean)
79   - */
80   - boolean isLazy();
81   -
82   - /**
83   - * Sets the lazyness of the channel
84   - * @param lazy true if channel is lazy
85   - * @see #isLazy()
86   - */
87   - void setLazy(boolean lazy);
88   -
89   - /**
90   - * <p>Listener interface invoked during creation of the channel, to allow
91   - * configuration of the channel to be atomic with its creation.</p>
92   - */
93   - interface Initializer extends BayeuxListener
94   - {
95   - /**
96   - * <p>Callback invoked to configure the channel during its creation.</p>
97   - * <p>It is illegal to try to obtain the same channel within this method
98   - * via, for example, {@link Bayeux#getChannel(String, boolean)}, because
99   - * the channel is not fully constructed yet.<br/>
100   - * Attempting to do so will throw an {@link IllegalStateException} after
101   - * the {@code maxInterval} timeout configured in the Bayeux object.</p>
102   - *
103   - * @param channel the channel to configure
104   - */
105   - void configureChannel(ConfigurableChannel channel);
106   - }
107   -}
33 api/src/main/java/org/cometd/DataFilter.java
... ... @@ -1,33 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -
15   -package org.cometd;
16   -
17   -
18   -/**
19   - * Data filters are used to transform data as it is sent to a {@link Channel}.
20   - *
21   - * @version $Revision: 686 $ $Date: 2009-07-03 11:07:24 +0200 (Fri, 03 Jul 2009) $
22   - */
23   -public interface DataFilter
24   -{
25   - /**
26   - * @param from the {@link Client} that sends the data
27   - * @param channel the channel the data is being sent to
28   - * @param data the data being sent
29   - * @return the transformed data
30   - * @throws IllegalStateException If the message should be aborted
31   - */
32   - public Object filter(Client from, Channel channel, Object data) throws IllegalStateException;
33   -}
36 api/src/main/java/org/cometd/DeliverListener.java
... ... @@ -1,36 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2008 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -
15   -package org.cometd;
16   -
17   -import java.util.Queue;
18   -
19   -import org.cometd.Client;
20   -import org.cometd.ClientListener;
21   -import org.cometd.Message;
22   -
23   -/**
24   - * @author athena
25   - *
26   - */
27   -public interface DeliverListener extends ClientListener
28   -{
29   - /* ------------------------------------------------------------ */
30   - /**
31   - * callback to notify that the queue is about to be sent to the
32   - * client. This is the last chance to process the queue and remove
33   - * duplicates or merge messages.
34   - */
35   - public void deliver(Client client, Queue<Message> queue);
36   -}
57 api/src/main/java/org/cometd/Extension.java
... ... @@ -1,57 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -//========================================================================
14   -//
15   -package org.cometd;
16   -
17   -
18   -/**
19   - * Cometd extension interface.
20   - * <p>
21   - * This interface is used both for server extensions and for client
22   - * extensions.
23   - *
24   - * @see Bayeux#addExtension(Extension)
25   - * @see Client#addExtension(Extension)
26   - *
27   - */
28   -public interface Extension
29   -{
30   - /**
31   - * @param from
32   - * @param message
33   - * @return modified message or null to discard message
34   - */
35   - Message rcv(Client from, Message message);
36   -
37   - /**
38   - * @param from
39   - * @param message
40   - * @return modified message
41   - */
42   - Message rcvMeta(Client from, Message message);
43   -
44   - /**
45   - * @param from
46   - * @param message
47   - * @return modified message or null to discard message
48   - */
49   - Message send(Client from, Message message);
50   -
51   - /**
52   - * @param from
53   - * @param message
54   - * @return modified message
55   - */
56   - Message sendMeta(Client from, Message message);
57   -}
25 api/src/main/java/org/cometd/Listener.java
... ... @@ -1,25 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -// ========================================================================
14   -
15   -package org.cometd;
16   -
17   -
18   -
19   -/* ------------------------------------------------------------ */
20   -/**
21   - * @deprecated. Use {@link MessageListener} or {@link RemoveListener}
22   - */
23   -public interface Listener extends MessageListener, RemoveListener
24   -{
25   -}
75 api/src/main/java/org/cometd/Message.java
... ... @@ -1,75 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007 Dojo Foundation
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   -// http://www.apache.org/licenses/LICENSE-2.0
8   -// Unless required by applicable law or agreed to in writing, software
9   -// distributed under the License is distributed on an "AS IS" BASIS,
10   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   -// See the License for the specific language governing permissions and
12   -// limitations under the License.
13   -// ========================================================================
14   -
15   -package org.cometd;
16   -
17   -import java.util.Map;
18   -
19   -/**
20   - * A Bayeux Message.
21   - * A Map of String to Object that has been optimized for conversion to JSON messages.
22   - * Even if this class implements {@link Cloneable}, it is not supported to deep clone
23   - * a message (mostly due to the fact that {@link Object#clone()} is broken in Java).
24   - */
25   -public interface Message extends Map<String,Object>, Cloneable
26   -{
27   - /**
28   - * Convenience method for <code>message.get(Bayeux.CLIENT_FIELD)</code>.
29   - * @return The clientId field of this message
30   - */
31   - public String getClientId();
32   -
33   - /**
34   - * Convenience method for <code>message.get(Bayeux.CHANNEL_FIELD)</code>.
35   - * @return The channel field of this message
36   - */
37   - public String getChannel();
38   -
39   - /**
40   - * Convenience method for <code>message.get(Bayeux.ID_FIELD)</code>.
41   - * @return The id field of this message
42   - */
43   - public String getId();
44   -
45   - /**
46   - * Convenience method for <code>message.get(Bayeux.DATA_FIELD)</code>.
47   - * @return The data field of this message
48   - */
49   - public Object getData();
50   -
51   - /**
52   - * Returns the <code>ext</code> field of this message, optionally creating it.
53   - * @param create whether the ext field should be created if it is absent.
54   - * @return The ext field of this message
55   - */
56   - public Map<String,Object> getExt(boolean create);
57   -
58   - /**
59   - * When this message represent a response to a request message, this method
60   - * returns the request message.
61   - * @return The message associated with this message
62   - */
63   - public Message getAssociated();
64   -
65   - /**
66   - * @return A shallow copy of this message.
67   - * @deprecated If you want a deep copy of a message, consider instantiating a new
68   - * message object and populating it with deep copies of the fields of this message.
69   - * A quicker alternative in case the fields of the messages are not known a priori
70   - * or not easily deep copyable, is to convert this message to JSON and then back to
71   - * a Message, functionality that is present in the Bayeux implementation.
72   - */
73   - @Deprecated
74   - public Object clone();
75   -}
54 api/src/main/java/org/cometd/MessageListener.java
... ... @@ -1,54 +0,0 @@
1   -// ========================================================================
2   -// Copyright 2007 Dojo Foundation
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