Skip to content
Browse files

First drop

  • Loading branch information...
0 parents commit c02c6f8b44945ee806a430356a4a2fa2cacb99eb @jfarcand jfarcand committed
Showing with 15,055 additions and 0 deletions.
  1. +13 −0 LICENSES/README.txt
  2. +153 −0 LICENSES/academic-2.1.txt
  3. +202 −0 LICENSES/apache-2.0.txt
  4. +50 −0 LICENSES/artistic.txt
  5. +20 −0 LICENSES/mit.txt
  6. +29 −0 LICENSES/new_bsd.txt
  7. +1 −0 README
  8. +32 −0 README.TXT
  9. +22 −0 api/pom.xml
  10. +251 −0 api/src/main/java/org/cometd/Bayeux.java
  11. +26 −0 api/src/main/java/org/cometd/BayeuxListener.java
  12. +72 −0 api/src/main/java/org/cometd/Channel.java
  13. +27 −0 api/src/main/java/org/cometd/ChannelBayeuxListener.java
  14. +25 −0 api/src/main/java/org/cometd/ChannelListener.java
  15. +163 −0 api/src/main/java/org/cometd/Client.java
  16. +27 −0 api/src/main/java/org/cometd/ClientBayeuxListener.java
  17. +27 −0 api/src/main/java/org/cometd/ClientListener.java
  18. +107 −0 api/src/main/java/org/cometd/ConfigurableChannel.java
  19. +33 −0 api/src/main/java/org/cometd/DataFilter.java
  20. +36 −0 api/src/main/java/org/cometd/DeliverListener.java
  21. +57 −0 api/src/main/java/org/cometd/Extension.java
  22. +25 −0 api/src/main/java/org/cometd/Listener.java
  23. +75 −0 api/src/main/java/org/cometd/Message.java
  24. +54 −0 api/src/main/java/org/cometd/MessageListener.java
  25. +41 −0 api/src/main/java/org/cometd/QueueListener.java
  26. +33 −0 api/src/main/java/org/cometd/RemoveListener.java
  27. +67 −0 api/src/main/java/org/cometd/SecurityPolicy.java
  28. +28 −0 api/src/main/java/org/cometd/SubscriptionListener.java
  29. +1,938 −0 bayeux/bayeux.html
  30. +539 −0 bayeux/bayeux.json
  31. BIN bayeux/bayeux.png
  32. +54 −0 bayeux/bayeux_error_codes.json
  33. +20 −0 bayeux/dojo.js
  34. BIN bayeux/intermittent-polling.pdf
  35. BIN bayeux/long-polling.pdf
  36. +484 −0 bayeux/protocol.txt
  37. BIN bayeux/streaming.pdf
  38. +93 −0 client/pom.xml
  39. +136 −0 client/src/main/java/org/cometd/client/Advice.java
  40. +1,683 −0 client/src/main/java/org/cometd/client/BayeuxClient.java
  41. +103 −0 client/src/main/java/org/cometd/client/ext/AckExtension.java
  42. +76 −0 client/src/main/java/org/cometd/client/ext/TimesyncClientExtension.java
  43. +273 −0 client/src/test/java/org/cometd/client/AckExtensionTest.java
  44. +652 −0 client/src/test/java/org/cometd/client/BayeuxClientTest.java
  45. +614 −0 client/src/test/java/org/cometd/client/BayeuxLoadGenerator.java
  46. +112 −0 client/src/test/java/org/cometd/client/BayeuxLoadServer.java
  47. +385 −0 client/src/test/java/org/cometd/client/ChatRoomClient.java
  48. +88 −0 client/src/test/java/org/cometd/client/ChatService.java
  49. +277 −0 client/src/test/java/org/cometd/client/MessageDeepCopyTest.java
  50. +222 −0 client/src/test/java/org/cometd/client/SimpleEchoBayeuxClient.java
  51. +201 −0 client/src/test/java/org/cometd/client/StatisticsHelper.java
  52. +15 −0 examples/README.txt
  53. +25 −0 examples/bin/run.sh
  54. +33 −0 examples/pom.xml
  55. +95 −0 examples/src/main/java/org/cometd/examples/ChatService.java
  56. +201 −0 examples/src/main/java/org/cometd/examples/CometdDemo.java
  57. +121 −0 examples/src/main/java/org/cometd/examples/CometdDemoServlet.java
  58. +23 −0 examples/src/main/webapp/WEB-INF/filters.json
  59. +65 −0 examples/src/main/webapp/WEB-INF/web.xml
  60. +43 −0 examples/src/main/webapp/examples/timesync/index.html
  61. +14 −0 examples/src/main/webapp/index.html
  62. BIN examples/src/test/resources/keystore
  63. +33 −0 oort/pom.xml
  64. +385 −0 oort/src/main/java/org/cometd/oort/Oort.java
  65. +176 −0 oort/src/main/java/org/cometd/oort/OortComet.java
  66. +124 −0 oort/src/main/java/org/cometd/oort/OortServlet.java
  67. +398 −0 oort/src/main/java/org/cometd/oort/Seti.java
  68. +95 −0 oort/src/main/java/org/cometd/oort/SetiServlet.java
  69. +145 −0 oort/src/test/java/org/cometd/oort/OortChatService.java
  70. +117 −0 oort/src/test/java/org/cometd/oort/OortDemo.java
  71. +67 −0 oort/src/test/java/org/cometd/oort/OortDemoServlet.java
  72. +43 −0 pom.xml
  73. +59 −0 server/pom.xml
  74. +1,552 −0 server/src/main/java/org/cometd/server/AbstractBayeux.java
  75. +359 −0 server/src/main/java/org/cometd/server/AbstractCometdServlet.java
  76. +46 −0 server/src/main/java/org/cometd/server/AbstractTransport.java
  77. +452 −0 server/src/main/java/org/cometd/server/BayeuxService.java
  78. +163 −0 server/src/main/java/org/cometd/server/ChannelId.java
  79. +560 −0 server/src/main/java/org/cometd/server/ChannelImpl.java
Sorry, we could not display the entire diff because it was too big.
13 LICENSES/README.txt
@@ -0,0 +1,13 @@
+
+The cometd project is open source software that is distributed
+under a mix of licenses that reflect the diverse heritage and
+communities of the the various components.
+
+Unless otherwise noted, the artistic license applies.
+
+The cometd-java modules is made available under the apache-2.0 license.
+
+The cometd-jquery module is dual licensed with the apache-2.0 or MIT license.
+
+The cometd-dojox module is dual licensed with the academic free license 1.2 or new BSD license.
+
153 LICENSES/academic-2.1.txt
@@ -0,0 +1,153 @@
+The Academic Free License, v. 2.1:
+**********************************
+
+This Academic Free License (the "License") applies to any original work of
+authorship (the "Original Work") whose owner (the "Licensor") has placed the
+following notice immediately following the copyright notice for the Original
+Work:
+
+Licensed under the Academic Free License version 2.1
+
+1) Grant of Copyright License. Licensor hereby grants You a world-wide,
+royalty-free, non-exclusive, perpetual, sublicenseable license to do the
+following:
+
+a) to reproduce the Original Work in copies;
+
+b) to prepare derivative works ("Derivative Works") based upon the Original
+Work;
+
+c) to distribute copies of the Original Work and Derivative Works to the
+public;
+
+d) to perform the Original Work publicly; and
+
+e) to display the Original Work publicly.
+
+2) Grant of Patent License. Licensor hereby grants You a world-wide,
+royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
+claims owned or controlled by the Licensor that are embodied in the Original
+Work as furnished by the Licensor, to make, use, sell and offer for sale the
+Original Work and Derivative Works.
+
+3) Grant of Source Code License. The term "Source Code" means the preferred
+form of the Original Work for making modifications to it and all available
+documentation describing how to modify the Original Work. Licensor hereby
+agrees to provide a machine-readable copy of the Source Code of the Original
+Work along with each copy of the Original Work that Licensor distributes.
+Licensor reserves the right to satisfy this obligation by placing a
+machine-readable copy of the Source Code in an information repository
+reasonably calculated to permit inexpensive and convenient access by You for as
+long as Licensor continues to distribute the Original Work, and by publishing
+the address of that information repository in a notice immediately following
+the copyright notice that applies to the Original Work.
+
+4) Exclusions From License Grant. Neither the names of Licensor, nor the names
+of any contributors to the Original Work, nor any of their trademarks or
+service marks, may be used to endorse or promote products derived from this
+Original Work without express prior written permission of the Licensor. Nothing
+in this License shall be deemed to grant any rights to trademarks, copyrights,
+patents, trade secrets or any other intellectual property of Licensor except as
+expressly stated herein. No patent license is granted to make, use, sell or
+offer to sell embodiments of any patent claims other than the licensed claims
+defined in Section 2. No right is granted to the trademarks of Licensor even if
+such marks are included in the Original Work. Nothing in this License shall be
+interpreted to prohibit Licensor from licensing under different terms from this
+License any Original Work that Licensor otherwise would have a right to
+license.
+
+5) This section intentionally omitted.
+
+6) Attribution Rights. You must retain, in the Source Code of any Derivative
+Works that You create, all copyright, patent or trademark notices from the
+Source Code of the Original Work, as well as any notices of licensing and any
+descriptive text identified therein as an "Attribution Notice." You must cause
+the Source Code for any Derivative Works that You create to carry a prominent
+Attribution Notice reasonably calculated to inform recipients that You have
+modified the Original Work.
+
+7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
+the copyright in and to the Original Work and the patent rights granted herein
+by Licensor are owned by the Licensor or are sublicensed to You under the terms
+of this License with the permission of the contributor(s) of those copyrights
+and patent rights. Except as expressly stated in the immediately proceeding
+sentence, the Original Work is provided under this License on an "AS IS" BASIS
+and WITHOUT WARRANTY, either express or implied, including, without limitation,
+the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
+This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
+license to Original Work is granted hereunder except under this disclaimer.
+
+8) Limitation of Liability. Under no circumstances and under no legal theory,
+whether in tort (including negligence), contract, or otherwise, shall the
+Licensor be liable to any person for any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License
+or the use of the Original Work including, without limitation, damages for loss
+of goodwill, work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses. This limitation of liability shall not
+apply to liability for death or personal injury resulting from Licensor's
+negligence to the extent applicable law prohibits such limitation. Some
+jurisdictions do not allow the exclusion or limitation of incidental or
+consequential damages, so this exclusion and limitation may not apply to You.
+
+9) Acceptance and Termination. If You distribute copies of the Original Work or
+a Derivative Work, You must make a reasonable effort under the circumstances to
+obtain the express assent of recipients to the terms of this License. Nothing
+else but this License (or another written agreement between Licensor and You)
+grants You permission to create Derivative Works based upon the Original Work
+or to exercise any of the rights granted in Section 1 herein, and any attempt
+to do so except under the terms of this License (or another written agreement
+between Licensor and You) is expressly prohibited by U.S. copyright law, the
+equivalent laws of other countries, and by international treaty. Therefore, by
+exercising any of the rights granted to You in Section 1 herein, You indicate
+Your acceptance of this License and all of its terms and conditions.
+
+10) Termination for Patent Action. This License shall terminate automatically
+and You may no longer exercise any of the rights granted to You by this License
+as of the date You commence an action, including a cross-claim or counterclaim,
+against Licensor or any licensee alleging that the Original Work infringes a
+patent. This termination provision shall not apply for an action alleging
+patent infringement by combinations of the Original Work with other software or
+hardware.
+
+11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
+License may be brought only in the courts of a jurisdiction wherein the
+Licensor resides or in which Licensor conducts its primary business, and under
+the laws of that jurisdiction excluding its conflict-of-law provisions. The
+application of the United Nations Convention on Contracts for the International
+Sale of Goods is expressly excluded. Any use of the Original Work outside the
+scope of this License or after its termination shall be subject to the
+requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et
+seq., the equivalent laws of other countries, and international treaty. This
+section shall survive the termination of this License.
+
+12) Attorneys Fees. In any action to enforce the terms of this License or
+seeking damages relating thereto, the prevailing party shall be entitled to
+recover its costs and expenses, including, without limitation, reasonable
+attorneys' fees and costs incurred in connection with such action, including
+any appeal of such action. This section shall survive the termination of this
+License.
+
+13) Miscellaneous. This License represents the complete agreement concerning
+the subject matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent necessary to
+make it enforceable.
+
+14) Definition of "You" in This License. "You" throughout this License, whether
+in upper or lower case, means an individual or a legal entity exercising rights
+under, and complying with all of the terms of, this License. For legal
+entities, "You" includes any entity that controls, is controlled by, or is
+under common control with you. For purposes of this definition, "control" means
+(i) the power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty percent
+(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
+entity.
+
+15) Right to Use. You may use the Original Work in all ways not otherwise
+restricted or conditioned by this License or by law, and Licensor promises not
+to interfere with or be responsible for such uses by You.
+
+This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
+Permission is hereby granted to copy and distribute this license without
+modification. This license may not be modified without the express written
+permission of its copyright owner.
202 LICENSES/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
50 LICENSES/artistic.txt
@@ -0,0 +1,50 @@
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+ * "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification.
+ * "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder.
+ * "Copyright Holder" is whoever is named in the copyright or copyrights for the package.
+ * "You" is you, if you're thinking about copying or distributing this Package.
+ * "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.)
+ * "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or organization.
+
+ c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of the Package with your modifications.
+
+ c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
20 LICENSES/mit.txt
@@ -0,0 +1,20 @@
+ * Licensed under the MIT license;
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
29 LICENSES/new_bsd.txt
@@ -0,0 +1,29 @@
+The "New" BSD License:
+**********************
+
+Copyright (c) 2005-2009, The Dojo Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the Dojo Foundation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
1 README
@@ -0,0 +1 @@
+The Cometd Client library powered by the AsyncHttpClient.
32 README.TXT
@@ -0,0 +1,32 @@
+This is the CometD project home.
+
+bayeux - The Bayeux Specification
+cometd-archetypes - The Maven2 archetypes for quick application development
+cometd-demo - Demo of the Java server and of the Dojo/jQuery clients
+cometd-java - The Java server and java client libraries
+cometd-javascript - The JavaScript (Dojo/jQuery) client libraries
+cometd-perl - The Perl server (ALPHA)
+cometd-twisted - The Python server (ALPHA)
+
+
+If you have checked out the source release, follow the instructions at
+http://cometd.org/documentation/building
+
+If you have downloaded the release bundle, then the CometD is already built for you.
+
+To run the demonstration with Maven:
+
+ $ cd cometd-demo
+ $ mvn jetty:deploy-war
+
+then point your browser at http://localhost:8080
+
+Alternately you can deploy the CometD demo war into
+any servlet 2.5 or 3.0 server (eg jetty, tomcat, glassfish)
+with commands like
+
+ $ cp cometd-demo/target/cometd-demo/target/cometd-demo-*.war $MY_SERVER/webapps/cometd.war
+ cd $MY_SERVER
+ <command to run my server>
+
+Then point your browser at http://localhost:8080/cometd
22 api/pom.xml
@@ -0,0 +1,22 @@
+<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">
+
+ <parent>
+ <groupId>org.cometd.java</groupId>
+ <artifactId>cometd-java-project</artifactId>
+ <version>1.1.2 </version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>cometd-api</artifactId>
+ <packaging>jar</packaging>
+ <name>CometD :: Java :: API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
251 api/src/main/java/org/cometd/Bayeux.java
@@ -0,0 +1,251 @@
+// ========================================================================
+// Copyright 2007-2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+
+package org.cometd;
+
+import java.util.Collection;
+import javax.servlet.http.HttpServletRequest;
+
+/* ------------------------------------------------------------ */
+/** Bayeux Server Interface.
+ * <p>
+ * This interface represents the server side API for the Bayeux messaging protocol.
+ * <p>
+ * The implementation of Bayeux will be registered as a {@link javax.servlet.ServletContext} attribute
+ * with the name "org.cometd.bayeux". This may be set prior to the context being initialized
+ * (if the instance is shared between contexts) or during context initialization.
+ * <p>
+ * Bayeux implementations must be thread safe and multiple threads may simultaneously
+ * call Bayeux methods.
+ *
+ */
+public interface Bayeux
+{
+
+ /** ServletContext attribute name used to obtain the Bayeux object */
+ /* was DOJOX_COMETD_BAYEUX */
+ public static final String ATTRIBUTE ="org.cometd.bayeux";
+
+ /**Meta definitions for channels*/
+ public static final String META="/meta";
+ /**Meta definitions for channels*/
+ public static final String META_SLASH="/meta/";
+ /**Meta definitions for channels - connect message*/
+ public static final String META_CONNECT="/meta/connect";
+ /**Meta definitions for channels - client messsage*/
+ public static final String META_CLIENT="/meta/client";
+ /**Meta definitions for channels - disconnect messsage*/
+ public static final String META_DISCONNECT="/meta/disconnect";
+ /**Meta definitions for channels - handshake messsage*/
+ public static final String META_HANDSHAKE="/meta/handshake";
+ /**Meta definitions for channels - ping messsage*/
+ public static final String META_PING="/meta/ping";
+ /**Meta definitions for channels - status messsage*/
+ public static final String META_STATUS="/meta/status";
+ /**Meta definitions for channels - subscribe messsage*/
+ public static final String META_SUBSCRIBE="/meta/subscribe";
+ /**Meta definitions for channels - unsubscribe messsage*/
+ public static final String META_UNSUBSCRIBE="/meta/unsubscribe";
+ /*Field names inside Bayeux messages*/
+ /**Field names inside Bayeux messages - clientId field*/
+ public static final String CLIENT_FIELD="clientId";
+ /**Field names inside Bayeux messages - data field*/
+ public static final String DATA_FIELD="data";
+ /**Field names inside Bayeux messages - channel field*/
+ public static final String CHANNEL_FIELD="channel";
+ /**Field names inside Bayeux messages - id field*/
+ public static final String ID_FIELD="id";
+ /**Field names inside Bayeux messages - error field*/
+ public static final String ERROR_FIELD="error";
+ /**Field names inside Bayeux messages - timestamp field*/
+ public static final String TIMESTAMP_FIELD="timestamp";
+ /**Field names inside Bayeux messages - transport field*/
+ public static final String TRANSPORT_FIELD="transport";
+ /**Field names inside Bayeux messages - advice field*/
+ public static final String ADVICE_FIELD="advice";
+ /**Field names inside Bayeux messages - successful field*/
+ public static final String SUCCESSFUL_FIELD="successful";
+ /**Field names inside Bayeux messages - subscription field*/
+ public static final String SUBSCRIPTION_FIELD="subscription";
+ /**Field names inside Bayeux messages - ext field*/
+ public static final String EXT_FIELD="ext";
+ /**Field names inside Bayeux messages - connectionType field*/
+ public static final String CONNECTION_TYPE_FIELD="connectionType";
+ /**Field names inside Bayeux messages - version field*/
+ public static final String VERSION_FIELD="version";
+ /**Field names inside Bayeux messages - minimumVersion field*/
+ public static final String MIN_VERSION_FIELD="minimumVersion";
+ /**Field names inside Bayeux messages - supportedConnectionTypes field*/
+ public static final String SUPPORTED_CONNECTION_TYPES_FIELD ="supportedConnectionTypes";
+ /**Field names inside Bayeux messages - json-comment-filtered field*/
+ public static final String JSON_COMMENT_FILTERED_FIELD="json-comment-filtered";
+ /**Field names inside Bayeux messages - reconnect field*/
+ public static final String RECONNECT_FIELD = "reconnect";
+ /**Field names inside Bayeux messages - interval field*/
+ public static final String INTERVAL_FIELD = "interval";
+ /**Field values inside Bayeux messages - retry response*/
+ public static final String RETRY_RESPONSE = "retry";
+ /**Field values inside Bayeux messages - handshake response*/
+ public static final String HANDSHAKE_RESPONSE = "handshake";
+ /**Field values inside Bayeux messages - none response*/
+ public static final String NONE_RESPONSE = "none";
+ /**Service channel names-starts with*/
+ public static final String SERVICE="/service";
+ /**Service channel names-trailing slash*/
+ public static final String SERVICE_SLASH="/service/";
+ /*Transport types*/
+ /**Transport types - long polling*/
+ public static final String TRANSPORT_LONG_POLL="long-polling";
+ /**Transport types - callback polling*/
+ public static final String TRANSPORT_CALLBACK_POLL="callback-polling";
+ /**Transport types - iframe*/
+ public static final String TRANSPORT_IFRAME="iframe";
+ /**Transport types - flash*/
+ public static final String TRANSPORT_FLASH="flash";
+
+ /*http field names*/
+ /**http helpers - application/json content type*/
+ public static final String JSON_CONTENT_TYPE="application/json;charset=UTF-8";
+ /**http helpers - parameter name for json message*/
+ public static final String MESSAGE_PARAMETER="message";
+ /**http helpers - name of the jsonp parameter*/
+ public static final String JSONP_PARAMETER="jsonp";
+ /**http helpers - default name of the jsonp callback function*/
+ public static final String JSONP_DEFAULT_NAME="jsonpcallback";
+
+ /* ------------------------------------------------------------ */
+ /** Get a Channel instance by ID.
+ * @param channelId The Channel ID
+ * @param create If true, a channel will be created if it does not exist.
+ * @return A Channel instance or null if it does not exist and create is false.
+ */
+ public Channel getChannel(String channelId, boolean create);
+
+ /* ------------------------------------------------------------ */
+ /** Check if channel exists.
+ * @param channel
+ * @return True if Bayeux has a channel with the channel name.
+ */
+ public boolean hasChannel(String channel);
+
+ /* ------------------------------------------------------------ */
+ public Channel removeChannel(String channel);
+
+ /* ------------------------------------------------------------ */
+ /** Get all known channels.
+ * @return A collection of all known channel instances.
+ */
+ public Collection<Channel> getChannels();
+
+ /* ------------------------------------------------------------ */
+ /** Get {@link Client} by ID.
+ * @param clientId
+ * @return A Client instance or null if the ID is not known
+ */
+ public Client getClient(String clientId);
+
+ /* ------------------------------------------------------------ */
+ public boolean hasClient(String clientId);
+
+ /* ------------------------------------------------------------ */
+ /** Create a new server side Client.
+ * Server side clients can be used to interact with Bayeux with
+ * publish and subscribe messaging.
+ * @param idprefix An identifier to prefix to the client ID.
+ * @return A {@link Client} instance with {@link Client#isLocal()} returning true.
+ */
+ public Client newClient(String idprefix);
+
+ /* ------------------------------------------------------------ */
+ public Client removeClient(String clientId);
+
+ /* ------------------------------------------------------------ */
+ /** Get a collection of all Clients.
+ * The collection is copy of the underlying collection.
+ * @return Collection of clients.
+ */
+ public Collection<Client> getClients();
+
+ /* ------------------------------------------------------------ */
+ /** Get the {@link SecurityPolicy} instance.
+ * @return The current {@link SecurityPolicy} instance.
+ */
+ public SecurityPolicy getSecurityPolicy();
+
+ /* ------------------------------------------------------------ */
+ /** Set the security policy for the Bayeux instance.
+ * <p>
+ * The Security Policy will be called to check access for all handshakes,
+ * subscriptions and publishing.
+ *
+ * @param securityPolicy The security policy instance.
+ */
+ public void setSecurityPolicy(SecurityPolicy securityPolicy);
+
+ /* ------------------------------------------------------------ */
+ /** Adds a bayeux extension.
+ * A bayeux extension may modify a message or return a new message.
+ * @param ext the extension to add
+ * @see #removeExtension(Extension)
+ */
+ public void addExtension(Extension ext);
+
+ /**
+ * Removes a bayeux extension.
+ * @param ext the extension to remove
+ * @see #addExtension(Extension)
+ */
+ public void removeExtension(Extension ext);
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Adds a bayeux listener,
+ * @param listener the listener to add
+ * @see #removeListener(BayeuxListener)
+ */
+ public void addListener(BayeuxListener listener);
+
+ /**
+ * Removes a bayeux listener
+ * @param listener the listener to remove
+ * @see #addListener(BayeuxListener)
+ */
+ public void removeListener(BayeuxListener listener);
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @return the max client queue size
+ * @see #setMaxClientQueue(int)
+ */
+ public int getMaxClientQueue();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @param size The size which if a client queue exceeds, forces a call to
+ * {@link QueueListener#queueMaxed(Client, Message)} to check if the message should be
+ * added. If set to -1, there is no queue limit. If set to zero, messages are
+ * not queued unless a {@link QueueListener} is applied that returns true.
+ * @see #getMaxClientQueue()
+ */
+ public void setMaxClientQueue(int size);
+
+ /* ------------------------------------------------------------ */
+ /** Get the current Servlet Request.
+ * If the calling thread is in the context of a servlet call, then
+ * return the request object. This can be used to authenticate users and/or
+ * perform other validation of the caller.
+ * @return A servlet request or null if none in scope.
+ */
+ public HttpServletRequest getCurrentRequest();
+}
26 api/src/main/java/org/cometd/BayeuxListener.java
@@ -0,0 +1,26 @@
+// ========================================================================
+// Copyright 2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+package org.cometd;
+
+import java.util.EventListener;
+
+
+/**
+ * A marker interface for all interfaces that listen for Bayeux events
+ *
+ */
+public interface BayeuxListener extends EventListener
+{
+
+}
72 api/src/main/java/org/cometd/Channel.java
@@ -0,0 +1,72 @@
+// ========================================================================
+// Copyright 2007-2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+
+package org.cometd;
+
+import java.util.Collection;
+
+/**
+ * <p>A Bayeux channel.</p>
+ * <p>A Channel represents a routing path for messages to {@link Client}s, and
+ * looks like a directory path:
+ * <pre>
+ * /some/channel
+ * </pre>
+ * Clients may subscribe to a channel and will be delivered all messages
+ * published to the channel.</p>
+ * <p>Channels may be <em>lazy</em>, which means that all messages published to that channel
+ * will be marked as lazy. Lazy messages are queued but do not wake up waiting clients.</p>
+ *
+ * @version $Revision: 686 $ $Date: 2009-07-03 11:07:24 +0200 (Fri, 03 Jul 2009) $
+ */
+public interface Channel extends ConfigurableChannel
+{
+ /**
+ * @return true if the channel has been removed, false if it was not possible to remove the channel
+ */
+ public boolean remove();
+
+ /**
+ * Publishes a message.
+ * @param fromClient the client source of the message, or null
+ * @param data the message data
+ * @param msgId the message ID or null
+ */
+ public void publish(Client fromClient, Object data, String msgId);
+
+ /**
+ * Subscribes the given {@link Client} to this channel.
+ * @param subscriber the client to subscribe
+ * @see #unsubscribe(Client)
+ */
+ public void subscribe(Client subscriber);
+
+ /**
+ * Unsubscribes the given {@link Client} from this channel.
+ * @param subscriber the client to unsubscribe
+ * @see #subscribe(Client)
+ */
+ public void unsubscribe(Client subscriber);
+
+ /**
+ * Returns a collection that is a copy of clients subscribed to this channel.
+ * @return the clients subscribed to this channel
+ */
+ public Collection<Client> getSubscribers();
+
+ /**
+ * @return the number of clients subscribed to this channel
+ */
+ public int getSubscriberCount();
+}
27 api/src/main/java/org/cometd/ChannelBayeuxListener.java
@@ -0,0 +1,27 @@
+// ========================================================================
+// Copyright 2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+package org.cometd;
+
+/**
+ * A {@link BayeuxListener} with call backs for channel life cycle events
+ *
+ */
+public interface ChannelBayeuxListener extends BayeuxListener
+{
+ /* ------------------------------------------------------------ */
+ public void channelAdded(Channel channel);
+
+ /* ------------------------------------------------------------ */
+ public void channelRemoved(Channel channel);
+}
25 api/src/main/java/org/cometd/ChannelListener.java
@@ -0,0 +1,25 @@
+// ========================================================================
+// Copyright 2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+package org.cometd;
+
+import java.util.EventListener;
+
+/**
+ * A marker interface for all interfaces that listen for Channel events
+ *
+ */
+public interface ChannelListener extends EventListener
+{
+
+}
163 api/src/main/java/org/cometd/Client.java
@@ -0,0 +1,163 @@
+// ========================================================================
+// Copyright 2007 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+
+package org.cometd;
+
+import java.util.List;
+import java.util.Queue;
+
+/* ------------------------------------------------------------ */
+/**
+ * <p>A Bayeux Client.</p>
+ * <p>A Client instance represents a consumer/producer of messages in bayeux.
+ * A Client may subscribe to channels and publish messages to channels.</p>
+ * <p>Client instances should not be directly created by uses, but should
+ * be obtained via the {@link Bayeux#getClient(String)} or {@link Bayeux#newClient(String)}
+ * methods.</p>
+ * <p>Two types of client may be represented by this interface:</p>
+ * <ul>
+ * <li>The server representation of a remote client connected via HTTP</li>
+ * <li>A remote client</li>
+ * </ul>
+ *
+ * @version $Revision: 1453 $ $Date: 2009-02-25 12:57:20 +0100 (Wed, 25 Feb 2009) $
+ */
+public interface Client
+{
+ /* ------------------------------------------------------------ */
+ /**
+ * @return the unique ID representing this client
+ */
+ public abstract String getId();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @return whether or not this client has messages to send
+ */
+ public abstract boolean hasMessages();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Takes any messages queued for a client.
+ *
+ * @deprecated use {@link #addListener(ClientListener)} to be notified of messages
+ */
+ public abstract List<Message> takeMessages();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Delivers a message to the remote client represented by this object.
+ *
+ * @param from the Client that sends the message
+ * @param toChannel the channel onto which the message is sent
+ * @param data the data of the message
+ * @param id the message ID
+ */
+ public void deliver(Client from, String toChannel, Object data, String id);
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Adds a bayeux client extension.
+ * A bayeux client extension may examine a message or return a new message.
+ * A bayeux client extension should not modify a message as it may be sent to
+ * multiple clients, instead it should deep copy the passed message.
+ *
+ * @param ext the extension to add
+ * @see #removeExtension(Extension)
+ */
+ public void addExtension(Extension ext);
+
+ /**
+ * Removes a bayeux client extension.
+ *
+ * @param ext the extension to removeù
+ * @see #addExtension(Extension)
+ */
+ public void removeExtension(Extension ext);
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Adds a listener.
+ *
+ * @param listener the listener to add
+ * @see #removeListener(ClientListener)
+ */
+ public void addListener(ClientListener listener);
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Removes a listener
+ *
+ * @param listener the listener to remove
+ * @see #addListener(ClientListener)
+ */
+ public void removeListener(ClientListener listener);
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @return true if the client is local, false if this client is either
+ * a remote HTTP client or a java client to a remote server.
+ */
+ public boolean isLocal();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Starts a batch of messages.
+ * Messages will not be delivered remotely until the corresponding
+ * {@link #endBatch()} is called.
+ * Batches may be nested and messages are only sent once all batches are ended.
+ *
+ * @see #endBatch()
+ */
+ public void startBatch();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Ends a batch of messages.
+ * Messages will not be delivered that have been queued since the previous
+ * {@link #startBatch()} is called.
+ * Batches may be nested and messages are only sent once all batches are ended.
+ *
+ * @see #startBatch()
+ */
+ public void endBatch();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * Disconnects this Client from the server.
+ */
+ public void disconnect();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @return the message queue (its usage must synchronize on this Client instance).
+ */
+ public Queue<Message> getQueue();
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @param max The size which if a client queue exceeds, forces a call to
+ * {@link QueueListener#queueMaxed(Client, Client, Message)} to check if the message should be added.
+ * If set to -1, there is no queue limit. If set to zero, messages are not queued.
+ * @see #getMaxQueue()
+ */
+ public void setMaxQueue(int max);
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @return the max queue size
+ * @see #setMaxQueue(int)
+ */
+ public int getMaxQueue();
+}
27 api/src/main/java/org/cometd/ClientBayeuxListener.java
@@ -0,0 +1,27 @@
+// ========================================================================
+// Copyright 2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+package org.cometd;
+
+/**
+ * A {@link BayeuxListener} with call backs for client life cycle events
+ *
+ */
+public interface ClientBayeuxListener extends BayeuxListener
+{
+ /* ------------------------------------------------------------ */
+ public void clientAdded(Client client);
+
+ /* ------------------------------------------------------------ */
+ public void clientRemoved(Client client);
+}
27 api/src/main/java/org/cometd/ClientListener.java
@@ -0,0 +1,27 @@
+// ========================================================================
+// Copyright 2007-2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+
+package org.cometd;
+
+import java.util.EventListener;
+
+/**
+ * A marker interface for all interfaces that listen for Client events.
+ * See subinterfaces for specific behavior.
+ *
+ * @version $Revision: 1453 $ $Date: 2009-02-25 12:57:20 +0100 (Wed, 25 Feb 2009) $
+ */
+public interface ClientListener extends EventListener
+{
+}
107 api/src/main/java/org/cometd/ConfigurableChannel.java
@@ -0,0 +1,107 @@
+package org.cometd;
+
+import java.util.Collection;
+
+/**
+ * <p>Represents a the configurable API of a channel.</p>
+ * <p>Channels can be configured by registering a listener that implements
+ * {@link Initializer} on the Bayeux object. </p>
+ * <p>Method {@link Initializer#configureChannel(ConfigurableChannel)} will be
+ * called to allow user code to configure the channel, and it is guaranteed
+ * that the creation and configuration of a channel is atomic: other threads
+ * that may want to create the same channel concurrently will wait until the
+ * current thread has completed the creation and configuration of the channel.</p>
+ *
+ * @version $Revision: 1167 $ $Date: 2010-05-13 11:10:15 -0400 (Thu, 13 May 2010) $
+ */
+public interface ConfigurableChannel
+{
+ /**
+ * @return the channel's name
+ */
+ String getId();
+
+ /**
+ * Indicates whether the channel is persistent or not.
+ * Non persistent channels are removed when the last subscription is
+ * removed.
+ * @return true if the Channel will persist even when all subscriptions are gone.
+ * @see #setPersistent(boolean)
+ */
+ boolean isPersistent();
+
+ /**
+ * Sets the persistency of this channel.
+ * @param persistent true if the channel is persistent, false otherwise
+ * @see #isPersistent()
+ */
+ void setPersistent(boolean persistent);
+
+ /**
+ * Adds the given {@link DataFilter} to this channel.
+ * @param filter the data filter to add
+ * @see #removeDataFilter(DataFilter)
+ * @see #getDataFilters()
+ */
+ void addDataFilter(DataFilter filter);
+
+ /**
+ * Removes the given {@link DataFilter} from this channel.
+ * @param filter the data filter to remove
+ * @return the removed data filter
+ * @see #addDataFilter(DataFilter)
+ */
+ DataFilter removeDataFilter(DataFilter filter);
+
+ /**
+ * Returns a collection copy of the data filters for this channel.
+ * @return the data filters for this channel
+ */
+ Collection<DataFilter> getDataFilters();
+
+ /**
+ * Adds a channel listener to this channel.
+ * @param listener the listener to add
+ * @see #removeListener(ChannelListener)
+ */
+ void addListener(ChannelListener listener);
+
+ /**
+ * Removes the channel listener from this channel.
+ * @param listener the listener to remove
+ * @see #addListener(ChannelListener)
+ */
+ void removeListener(ChannelListener listener);
+
+ /**
+ * @return whether the channel is lazy.
+ * @see #setLazy(boolean)
+ */
+ boolean isLazy();
+
+ /**
+ * Sets the lazyness of the channel
+ * @param lazy true if channel is lazy
+ * @see #isLazy()
+ */
+ void setLazy(boolean lazy);
+
+ /**
+ * <p>Listener interface invoked during creation of the channel, to allow
+ * configuration of the channel to be atomic with its creation.</p>
+ */
+ interface Initializer extends BayeuxListener
+ {
+ /**
+ * <p>Callback invoked to configure the channel during its creation.</p>
+ * <p>It is illegal to try to obtain the same channel within this method
+ * via, for example, {@link Bayeux#getChannel(String, boolean)}, because
+ * the channel is not fully constructed yet.<br/>
+ * Attempting to do so will throw an {@link IllegalStateException} after
+ * the {@code maxInterval} timeout configured in the Bayeux object.</p>
+ *
+ * @param channel the channel to configure
+ */
+ void configureChannel(ConfigurableChannel channel);
+ }
+}
33 api/src/main/java/org/cometd/DataFilter.java
@@ -0,0 +1,33 @@
+// ========================================================================
+// Copyright 2007 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+
+package org.cometd;
+
+
+/**
+ * Data filters are used to transform data as it is sent to a {@link Channel}.
+ *
+ * @version $Revision: 686 $ $Date: 2009-07-03 11:07:24 +0200 (Fri, 03 Jul 2009) $
+ */
+public interface DataFilter
+{
+ /**
+ * @param from the {@link Client} that sends the data
+ * @param channel the channel the data is being sent to
+ * @param data the data being sent
+ * @return the transformed data
+ * @throws IllegalStateException If the message should be aborted
+ */
+ public Object filter(Client from, Channel channel, Object data) throws IllegalStateException;
+}
36 api/src/main/java/org/cometd/DeliverListener.java
@@ -0,0 +1,36 @@
+// ========================================================================
+// Copyright 2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+
+package org.cometd;
+
+import java.util.Queue;
+
+import org.cometd.Client;
+import org.cometd.ClientListener;
+import org.cometd.Message;
+
+/**
+ * @author athena
+ *
+ */
+public interface DeliverListener extends ClientListener
+{
+ /* ------------------------------------------------------------ */
+ /**
+ * callback to notify that the queue is about to be sent to the
+ * client. This is the last chance to process the queue and remove
+ * duplicates or merge messages.
+ */
+ public void deliver(Client client, Queue<Message> queue);
+}
57 api/src/main/java/org/cometd/Extension.java
@@ -0,0 +1,57 @@
+// ========================================================================
+// Copyright 2007 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+//
+package org.cometd;
+
+
+/**
+ * Cometd extension interface.
+ * <p>
+ * This interface is used both for server extensions and for client
+ * extensions.
+ *
+ * @see Bayeux#addExtension(Extension)
+ * @see Client#addExtension(Extension)
+ *
+ */
+public interface Extension
+{
+ /**
+ * @param from
+ * @param message
+ * @return modified message or null to discard message
+ */
+ Message rcv(Client from, Message message);
+
+ /**
+ * @param from
+ * @param message
+ * @return modified message
+ */
+ Message rcvMeta(Client from, Message message);
+
+ /**
+ * @param from
+ * @param message
+ * @return modified message or null to discard message
+ */
+ Message send(Client from, Message message);
+
+ /**
+ * @param from
+ * @param message
+ * @return modified message
+ */
+ Message sendMeta(Client from, Message message);
+}
25 api/src/main/java/org/cometd/Listener.java
@@ -0,0 +1,25 @@
+// ========================================================================
+// Copyright 2007 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ========================================================================
+
+package org.cometd;
+
+
+
+/* ------------------------------------------------------------ */
+/**
+ * @deprecated. Use {@link MessageListener} or {@link RemoveListener}
+ */
+public interface Listener extends MessageListener, RemoveListener
+{
+}
75 api/src/main/java/org/cometd/Message.java
@@ -0,0 +1,75 @@
+// ========================================================================
+// Copyright 2007 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ========================================================================
+
+package org.cometd;
+
+import java.util.Map;
+
+/**
+ * A Bayeux Message.
+ * A Map of String to Object that has been optimized for conversion to JSON messages.
+ * Even if this class implements {@link Cloneable}, it is not supported to deep clone
+ * a message (mostly due to the fact that {@link Object#clone()} is broken in Java).
+ */
+public interface Message extends Map<String,Object>, Cloneable
+{
+ /**
+ * Convenience method for <code>message.get(Bayeux.CLIENT_FIELD)</code>.
+ * @return The clientId field of this message
+ */
+ public String getClientId();
+
+ /**
+ * Convenience method for <code>message.get(Bayeux.CHANNEL_FIELD)</code>.
+ * @return The channel field of this message
+ */
+ public String getChannel();
+
+ /**
+ * Convenience method for <code>message.get(Bayeux.ID_FIELD)</code>.
+ * @return The id field of this message
+ */
+ public String getId();
+
+ /**
+ * Convenience method for <code>message.get(Bayeux.DATA_FIELD)</code>.
+ * @return The data field of this message
+ */
+ public Object getData();
+
+ /**
+ * Returns the <code>ext</code> field of this message, optionally creating it.
+ * @param create whether the ext field should be created if it is absent.
+ * @return The ext field of this message
+ */
+ public Map<String,Object> getExt(boolean create);
+
+ /**
+ * When this message represent a response to a request message, this method
+ * returns the request message.
+ * @return The message associated with this message
+ */
+ public Message getAssociated();
+
+ /**
+ * @return A shallow copy of this message.
+ * @deprecated If you want a deep copy of a message, consider instantiating a new
+ * message object and populating it with deep copies of the fields of this message.
+ * A quicker alternative in case the fields of the messages are not known a priori
+ * or not easily deep copyable, is to convert this message to JSON and then back to
+ * a Message, functionality that is present in the Bayeux implementation.
+ */
+ @Deprecated
+ public Object clone();
+}
54 api/src/main/java/org/cometd/MessageListener.java
@@ -0,0 +1,54 @@
+// ========================================================================
+// Copyright 2007 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ========================================================================
+
+package org.cometd;
+
+
+/**
+ * Message Listener Interface.
+ *
+ * Objects implementing this interface may listen for message deliverly events
+ * by calling the {@link Client#addListener(ClientListener)} The {@link Synchronous}
+ * or {@link Asynchronous} nested interfaces may be used as a mixin to specify the style
+ * of delivery required. If neither subtype is specified, then the {@link Bayeux}
+ * implementation may use either method.
+ *
+ * @version $Revision: 1453 $ $Date: 2009-02-25 12:57:20 +0100 (Wed, 25 Feb 2009) $
+ */
+public interface MessageListener extends ClientListener
+{
+ /**
+ * Called when a message is delivered to the client
+ * @param fromClient the client that sent the message
+ * @param toClient the client that received the message
+ * @param msg the message
+ */
+ public void deliver(Client fromClient, Client toClient, Message msg);
+
+ /**
+ * Subtype of MessageListener that requires synchronous message delivery.
+ * The {@link Client} object is locked during the call to
+ * {@link MessageListener#deliver(Client, Client, Message)}, thus
+ * guaranteeing that only a single message will be delivered at once and
+ * in order of receipt.
+ */
+ public interface Synchronous extends MessageListener {}
+
+ /**
+ * Subtype of MesssageListener that requires asynchronous message delivery.
+ * Calls to {@link MessageListener#deliver(Client, Client, Message)} may occur
+ * in parallel and possibly out of order.
+ */
+ public interface Asynchronous extends MessageListener {}
+}
41 api/src/main/java/org/cometd/QueueListener.java
@@ -0,0 +1,41 @@
+// ========================================================================
+// Copyright 2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+
+package org.cometd;
+
+import org.cometd.Client;
+import org.cometd.ClientListener;
+import org.cometd.Message;
+
+/**
+ * @author athena
+ *
+ */
+public interface QueueListener extends ClientListener
+{
+ /* ------------------------------------------------------------ */
+ /**
+ * Call back to notify if a message for a client will result in the
+ * message queue exceeding {@link Client#getMaxQueue()}.
+ * This is called with the client instance locked, so it is safe for the
+ * handler to manipulate the queue returned by {@link Client#getQueue()}, but
+ * action in the callback that may result in another Client instance should be
+ * avoided as that would risk deadlock.
+ * @param from Client message is published from
+ * @param to Client message is being delivered to
+ * @param message
+ * @return true if the message should be added to the client queue
+ */
+ public boolean queueMaxed(Client from, Client to, Message message);
+}
33 api/src/main/java/org/cometd/RemoveListener.java
@@ -0,0 +1,33 @@
+// ========================================================================
+// Copyright 2007 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ========================================================================
+
+package org.cometd;
+
+/**
+ * Remove Listener Interface.
+ *
+ * Objects implementing this interface may listen for client removal events
+ * by calling the {@link Client#addListener(ClientListener)}
+ *
+ * @version $Revision: 1453 $ $Date: 2009-02-25 12:57:20 +0100 (Wed, 25 Feb 2009) $
+ */
+public interface RemoveListener extends ClientListener
+{
+ /**
+ * This method is called after a client is removed.
+ * @param clientId The clientId removed
+ * @param timeout True if the client was removed due to a timeout.
+ */
+ public void removed(String clientId, boolean timeout);
+}
67 api/src/main/java/org/cometd/SecurityPolicy.java
@@ -0,0 +1,67 @@
+// ========================================================================
+// Copyright 2007 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ========================================================================
+
+package org.cometd;
+
+/**
+ * Pluggable security policy for Bayeux
+ *
+ * @version $Revision: 1453 $ $Date: 2009-02-25 12:57:20 +0100 (Wed, 25 Feb 2009) $
+ */
+public interface SecurityPolicy
+{
+ /**
+ * Test if a handshake message should be accepted.
+ *
+ * @param message A handshake message.
+ * @return True if the handshake message should be accepted and a {@link Client} instance created
+ */
+ boolean canHandshake(Message message);
+
+ /**
+ * Test if a message should be allowed to create a new Channel
+ *
+ * @param client The client sending the message. The client may be
+ * null if an anonymous publish is attempted. Server clients are
+ * indicated by {@link Client#isLocal()}
+ * @param channel The channel the message is trying to create
+ * @param message The message
+ * @return true if the channel should be created
+ */
+ boolean canCreate(Client client, String channel, Message message);
+
+ /**
+ * Test if a client is allowed to subscribe to a channel
+ *
+ * @param client The client sending the message. The client may be
+ * null if an anonymous publish is attempted. Server clients are
+ * indicated by {@link Client#isLocal()}
+ * @param channel The channel the message is trying to subscribe to
+ * @param messsage The message to /meta/subscribe
+ * @return true if the client can subscribe to the channel
+ */
+ boolean canSubscribe(Client client, String channel, Message messsage);
+
+ /**
+ * Test if a client can publish a message to a channel
+ *
+ * @param client The client sending the message. The client may be
+ * null if an anonymous publish is attempted. Server clients are
+ * indicated by {@link Client#isLocal()}
+ * @param channel The channel the message is trying to publish to
+ * @param messsage The message to publish
+ * @return true if the client can publish to the channel.
+ */
+ boolean canPublish(Client client, String channel, Message messsage);
+}
28 api/src/main/java/org/cometd/SubscriptionListener.java
@@ -0,0 +1,28 @@
+// ========================================================================
+// Copyright 2008 Dojo Foundation
+// ------------------------------------------------------------------------
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//========================================================================
+package org.cometd;
+
+
+/**
+ * A {@link ChannelListener} with call backs for subscription life cycle events
+ *
+ */
+public interface SubscriptionListener extends ChannelListener
+{
+ /* ------------------------------------------------------------ */
+ public void subscribed(Client client, Channel channel);
+
+ /* ------------------------------------------------------------ */
+ public void unsubscribed(Client client, Channel channel);
+}
1,938 bayeux/bayeux.html
1,938 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
539 bayeux/bayeux.json
@@ -0,0 +1,539 @@
+/**/
+/* Bayeux protocol definition version 1.01, in language- */
+/* independent JSON form. */
+/* */
+/* GloriaJW 2008-01-03 */
+/* */
+/* This is a JSON dictionary of all Bayeux structures and their */
+/* possible values, vtypes and rtypes. */
+/* */
+/* The four value types (vtypes) are: */
+/* (1) Single Value from a Fixed list of values (SVF), */
+/* (2) Single Value which is Variable (SVV), */
+/* (3) Multiple Values from a Fixed list of values (MVF), */
+/* (4) Multiple Values which are Variable (MVV) */
+/* */
+/* These vtype fields begin with 'vtype_' and can be used as */
+/* visual aids, or assert() fixed and single/multiple value */
+/* checking. These fields are "advice" fields, not to be passed */
+/* in the bayeux protocol, but ONLY to be used for either */
+/* automated or manual evaluation of field values. */
+/* */
+/* The seven (optional) restriction types (rtypes) are: */
+/* (1) Sent from Client only (CZ) */
+/* (2) Sent from Server only (SZ) */
+/* (3) Sent from Client only, and only upon failure: (CE) */
+/* (4) Sent from Server only, and only upon failure: (SE) */
+/* (5) Sent from Client only, optional: (CO) */
+/* (6) Sent from Server only, optional: (SO) */
+/* (7) Optional in both directions: (BO) */
+/* */
+/* These rtype fields are optional, and only appear when there */
+/* is an applicable restriction on a field. They begin with */
+/* 'rtype_' and can be used as visual aids, or assert() */
+/* client/server and error checking. These fields are "advice" */
+/* fields, not to be passed in the bayeux protocol, but ONLY to */
+/* be used for either automated or manual evaluation of field */
+/* values. */
+/* */
+/**/
+{
+"handshake":{"channel":"/meta/handshake",
+ "vtype_channel":"SVF",
+
+ "version":"1.0.1",
+ "vtype_version":"SVF",
+
+ "supportedConnectionTypes":["iframe", "flash","callback-polling","long-polling"],
+ "vtype_supportedConnectionTypes":"MVF",
+
+ /* response only */
+ "clientId":"alphanumeric1234",
+ "vtype_clientId":"SVV",
+ "rtype_clientId":"SZ",
+
+ /* response only */
+ "successful":["true","false"],
+ "vtype_successful":"SVF",
+ "rtype_successful":"SZ",
+
+ /* failure only, response only */
+ "error":[000,"optional error arguments","Some Error String"],
+ "vtype_error":"MVV",
+ "rtype_error":"SE",
+
+ /* optional */
+ "minimumVersion":"1.0",
+ "vtype_version":"SVF",
+ "rtype_version":"BO",
+
+ /* optional */
+ "id":"alphanumeric1234",
+ "vtype_id":"SVV",
+ "rtype_id":"BO",
+
+ /* optional, response only */
+ "authSuccessful":["true","false"],
+ "vtype_authSuccessful":"SVF",
+ "rtype_authSuccessful":"SO",
+
+ /* optional, response only */
+ "advice":{"reconnect":["retry","handshake","none"],
+ "vtype_reconect":"SVF",
+ "rtype_reconect":"SO",
+
+ "interval":[1000,-1000],
+ "vtype_interval":"SVV",
+ "rtype_interval":"SO",
+
+ "multipleClients":["true","false"],
+ "vtype_multipleClients":"SVF",
+ "rtype_multipleClients":"SO",
+
+ "hosts":["SomeHostname","192.168.1.1","localhost","127.0.0.1"],
+ "vtype_hosts":"MVV"
+ "rtype_hosts":"SO"
+
+ "authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"MVF",
+ "rtype_authtype":"SO"
+ },
+
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"MVF",
+ "rtype_guaranteedDelivery":"SO"
+
+ }
+
+ /* optional, client (initiator) only */
+ "ext":{"authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"SVF",
+ "rtype_authtype":"CO",
+
+ "user":"some user id",
+ "vtype_user":"SVV",
+ "rtype_user":"CO",
+
+ "password":"youch if clear text!",
+ "vtype_password":"SVV",
+ "rtype_password":"CO"
+ },
+
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"SVF",
+ "rtype_guaranteedDelivery":"CO"
+ }
+ },
+
+"connect":{"channel":"/meta/connect",
+ "vtype_channel":"SVF",
+
+ "connectionType":["iframe", "flash","callback-polling","long-polling"],
+ "vtype_connectionType":"SVF",
+
+ "clientId":"alphanumeric1234",
+ "vtype_clientId":"SVV",
+
+ /* response only */
+ "successful":["true","false"],
+ "vtype_successful":"SVF",
+ "rtype_successful":"SZ",
+
+ /* failure only, response only */
+ "error":[000,"optional error arguments","Some Error String"],
+ "vtype_error":"MVV",
+ "rtype_error":"SE",
+
+ /* optional */
+ "id":"alphanumeric1234",
+ "vtype_id":"SVV",
+ "rtype_id":"BO",
+
+ /* optional, response only */
+ "timestamp":"YYYY-MM-DD\thh:mm:ss.ss",
+ "vtype_timestamp":"SVV",
+ "rtype_timestamp":"SO",
+
+ /* optional, server response only */
+ "advice":{"reconnect":["retry","handshake","none"],
+ "vtype_reconect":"SVF",
+ "rtype_reconect":"SO",
+
+ "interval":[1000,-1000],
+ "vtype_interval":"SVV",
+ "rtype_inderval":"SO",
+
+ "multipleClients":["true","false"],
+ "vtype_multipleClients":"SVF",
+ "rtype_multipleClients":"SO",
+
+ "hosts":["SomeHostname","192.168.1.1","localhost","127.0.0.1"],
+ "vtype_hosts":"MVV",
+ "rtype_hosts":"SO"
+
+ "authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"MVF",
+ "rtype_authtype":"SO"
+ },
+
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"MVF",
+ "rtype_guaranteedDelivery":"SO"
+
+ }
+
+ /* optional, client (initiator) only */
+ "ext":{"authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"SVF",
+ "rtype_authtype":"CO",
+
+ "user":"some user id",
+ "vtype_user":"SVV",
+ "rtype_user":"CO",
+
+ "password":"youch if clear text!",
+ "vtype_password":"SVV",
+ "rtype_password":"CO"
+ }
+ },
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"SVF",
+ "rtype_guaranteedDelivery":"CO"
+ },
+
+"disconnect":{"channel":"/meta/disconnect",
+ "vtype_channel":"SVF",
+
+ "clientId":"alphanumeric1234",
+ "vtype_clientId":"SVV",
+
+ /* response only */
+ "successful":["true","false"],
+ "vtype_successful":"SVF",
+ "rtype_successful":"SZ",
+
+ /* failure only, response only */
+ "error":[000,"optional error arguments","Some Error String"],
+ "vtype_error":"MVV",
+ "rtype_error":"SE",
+
+ /* optional */
+ "id":"alphanumeric1234",
+ "vtype_id":"SVV",
+ "rtype_id":"BO"
+
+ },
+
+"subscribe":{"channel":"/meta/subscribe",
+ "vtype_channel":"SVF",
+
+ "clientId":"alphanumeric1234",
+ "vtype_clientId":"SVV",
+
+ "subscription":["/foo/**","/channel_b","/channel_c/x"],
+ "vtype_subscription":"MVV",
+
+ /* optional, response only */
+ "timestamp":"YYYY-MM-DD\thh:mm:ss.ss",
+ "vtype_timestamp":"SVV",
+ "vtype_timestamp":"SO",
+
+ /* response only */
+ "successful":["true","false"],
+ "vtype_successful":"SVF",
+ "rtype_successful":"SZ",
+
+ /* failure only, response only */
+ "error":[000,"optional error arguments","Some Error String"],
+ "vtype_error":"MVV",
+ "rtype_error":"SE",
+
+ /* optional */
+ "id":"alphanumeric1234",
+ "vtype_id":"SVV",
+ "rtype_id":"BO",
+
+ /* optional, server response only */
+ "advice":{"reconnect":["retry","handshake","none"],
+ "vtype_reconect":"SVF",
+ "rtype_reconect":"SO",
+
+ "interval":[1000,-1000],
+ "vtype_interval":"SVV",
+ "rtype_interval":"SO",
+
+ "multipleClients":["true","false"],
+ "vtype_multipleClients":"SVF",
+ "rtype_multipleClients":"SO",
+
+ "hosts":["SomeHostname","192.168.1.1","localhost","127.0.0.1"],
+ "vtype_hosts":"MVV",
+ "rtype_hosts":"SO",
+
+
+ "authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"MVF"
+ "rtype_authtype":"SO"
+ },
+
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"MVF",
+ "rtype_guaranteedDelivery":"SO"
+ }
+
+ /* optional, client (initiator) only */
+ "ext":{"authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"SVF",
+ "rtype_authtype":"CO",
+
+ "user":"some user id",
+ "vtype_user":"SVV",
+ "rtype_user":"CO",
+
+ "password":"youch if clear text!",
+ "vtype_password":"SVV",
+ "rtype_password":"CO"
+ }
+ },
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"SVF",
+ "rtype_guaranteedDelivery":"CO"
+ },
+
+"unsubscribe":{"channel":"/meta/unsubscribe",
+ "vtype_channel":"SVF",
+
+ "clientId":"alphanumeric1234",
+ "vtype_clientId":"SVV",
+
+ "subscription":["/foo/**","/channel_b","/channel_c/x"],
+ "vtype_subscription":"MVV"
+
+ /* response only */
+ "successful":["true","false"],
+ "vtype_successful":"SVF",
+ "rtype_successful":"SZ",
+
+ /* failure only, response only */
+ "error":[000,"optional error arguments","Some Error String"],
+ "vtype_error":"MVV",
+ "rtype_error":"SE",
+
+ /* optional */
+ "id":"alphanumeric1234",
+ "vtype_id":"SVV",
+ "rtype_id":"BO",
+
+ /* optional, server response only */
+ "advice":{"reconnect":["retry","handshake","none"],
+ "vtype_reconect":"SVF",
+ "rtype_reconect":"SO",
+
+ "interval":[1000,-1000],
+ "vtype_interval":"SVV",
+ "rtype_interval":"SO",
+
+ "multipleClients":["true","false"],
+ "vtype_multipleClients":"SVF",
+ "rtype_multipleClients":"SO",
+
+ "hosts":["SomeHostname","192.168.1.1","localhost","127.0.0.1"],
+ "vtype_hosts":"MVV",
+ "rtype_hosts":"SO",
+
+ "authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"MVF",
+ "rtype_authtype":"SO"
+ },
+
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"MVF",
+ "rtype_guaranteedDelivery":"SO"
+
+ }
+
+ /* optional, client (initiator) only */
+ "ext":{"authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"SVF",
+ "rtype_authtype":"CO",
+
+ "user":"some user id",
+ "vtype_user":"SVV",
+ "rtype_user":"CO",
+
+ "password":"youch if clear text!",
+ "vtype_password":"SVV",
+ "rtype_password":"CO"
+ }
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"SVF",
+ "rtype_guaranteedDelivery":"CO"
+ }
+ },
+
+"publish":{"channel":"/some/channel",
+ "vtype_channel":"SVV",
+
+ "data":"some JSON dict or raw string",
+ "vtype_data":"SVV",
+
+ /* optional */
+ "clientId":"alphanumeric1234",
+ "vtype_clientId":"SVV",
+ "rtype_clientId":"BO",
+
+ /* optional */
+ "id":"alphanumeric1234",
+ "vtype_id":"SVV",
+ "rtype_id":"BO",
+
+ /* optional */
+ "ext":{"authenticate":{"authtype":["htpasswd","OpenId"],
+ "vtype_authtype":"SVF",
+ "rtype_authtype":"BO",
+
+ "user":"some user id",
+ "vtype_user":"SVV",
+ "rtype_user":"BO",
+
+ "password":"youch if clear text!",
+ "vtype_password":"SVV",
+ "rtype_password":"BO"
+ }
+
+ "guaranteedDelivery":["true","false"],
+ "vtype_guaranteedDelivery":"SVF",
+ "rtype_guaranteedDelivery":"BO"
+ }
+
+ /* response only */
+ "successful":["true","false"],
+ "vtype_successful":"SVF",
+ "rtype_successful":"SZ",
+
+ /* failure only, response only */
+ "error":[000,"optional error arguments","Some Error String"],
+ "vtype_error":"MVV",
+ "rtype_error":"SE"
+ },
+
+"deliver":{"channel":"/some/channel",
+ "vtype_channel":"SVV",
+
+ "data":"some JSON dict or raw string",
+ "vtype_data":"SVV",
+
+ /* optional */
+ "clientId":"alphanumeric1234",
+ "vtype_clientId":"SVV",
+ "rtype_clientId":"BO",
+
+ /* optional */
+ "id":"alphanumeric1234",
+ "vtype_id":"SVV",
+ "rtype_id":"BO",
+
+ /* optional */
+ "advice":{"reconnect":["retry","handshake","none"],
+ "vtype_reconect":"SVF",
+ "rtype_reconect":"BO",
+
+