Permalink
Browse files

update to version 0.5.0

  • Loading branch information...
1 parent 64f02e6 commit 7be9aaa820e3093960bb2016d459207a0ef958b9 @kensiprell committed Jun 16, 2013
Showing with 768 additions and 650 deletions.
  1. +24 −7 .gitignore
  2. +4 −2 AtmosphereMeteorGrailsPlugin.groovy
  3. +41 −74 README.md
  4. +3 −2 grails-app/conf/BuildConfig.groovy
  5. +17 −6 scripts/_Install.groovy
  6. +679 −559 web-app/js/jquery.atmosphere.js
View
@@ -1,8 +1,25 @@
-*.log
-/target
-/docs
-/grails-*.zip
-/plugin.xml
-.settings
-.idea
*.iml
+/.idea
+vcs.xml
+workspace.xml
+.classpath
+.project
+*.iws
+*Db.properties
+*Db.script
+.settings
+stacktrace.log
+/*.zip
+/plugin.xml
+/*.log
+/*DB.*
+/cobertura.ser
+.DS_Store
+/target/
+/out/
+/web-app/plugins
+/web-app/WEB-INF/classes
+/.link_to_grails_plugins/
+/target-eclipse/
+/grails-*.zip
+/grails-*.zip.sha1
@@ -5,6 +5,7 @@ import org.grails.plugins.atmosphere_meteor.MeteorHandlerArtefactHandler
import org.grails.plugins.atmosphere_meteor.MeteorServletArtefactHandler
class AtmosphereMeteorGrailsPlugin {
+ // TODO update version
def version = "0.5.0"
def grailsVersion = "2.0 > *"
def pluginExcludes = [
@@ -16,9 +17,10 @@ class AtmosphereMeteorGrailsPlugin {
def title = "Atmosphere Meteor Plugin"
def author = "Ken Siprell"
def authorEmail = "ken.siprell@gmail.com"
- // TODO mention sample app
+
def description = '''
-This plugin incorporates the Atmosphere Framework (https://github.com/Atmosphere/atmosphere/wiki). It can form the basis for a traditional XMPP server with a browser-based client without the limitations of BOSH.
+This plugin incorporates the Atmosphere Framework (https://github.com/Atmosphere/atmosphere/wiki). An associated sample application is located at https://github.com/kensiprell/grails-atmosphere-meteor-sample. Click the Documentation button above for the details.
+
'''
def documentation = "https://github.com/kensiprell/grails-atmosphere-meteor/blob/master/README.md"
View
115 README.md
@@ -2,6 +2,8 @@
[Atmosphere Wiki](https://github.com/Atmosphere/atmosphere/wiki)
+The plugin has been tested on Grails versions 2.0.0 through 2.2.2. I use the [grails-atmosphere-meteor-sample](https://github.com/kensiprell/grails-atmosphere-meteor-sample) application and [grails-plugin-test-script](https://github.com/kensiprell/grails-plugin-test-script) for testing.
+
If you have a question, problem, suggestion, or want to report a bug, please submit an [issue](https://github.com/kensiprell/grails-atmosphere-meteor/issues?state=open). I will reply as soon as I can.
[Planned Changes](https://github.com/kensiprell/grails-atmosphere-meteor/wiki/Planned-Changes)
@@ -10,12 +12,10 @@ If you have a question, problem, suggestion, or want to report a bug, please sub
The plugin uses the following pieces of the Atmosphere Framework:
-* [jquery.atmosphere.js](https://github.com/Atmosphere/atmosphere/wiki/jQuery.atmosphere.js-API)
-
+* [jquery.atmosphere.js](https://github.com/Atmosphere/atmosphere/wiki/jQuery.atmosphere.js-API)
* [MeteorServlet](http://atmosphere.github.com/atmosphere/apidocs/org/atmosphere/cpr/MeteorServlet.html)
-
* [ReflectorServletProcessor](http://atmosphere.github.com/atmosphere/apidocs/org/atmosphere/handler/ReflectorServletProcessor.html)
* [DefaultBroadcaster](http://atmosphere.github.com/atmosphere/apidocs/org/atmosphere/cpr/DefaultBroadcaster.html)
@@ -26,7 +26,7 @@ The plugin uses the following pieces of the Atmosphere Framework:
### Java Servlet
-The plugin is designed to create and use a servlet for each main or significant URL pattern. For example, if you install the plugin as a standalone application, you will see that a servlet is created for each URL pattern below:
+The plugin is designed to create and use a servlet for each main or significant URL pattern. For example, if you download the [sample application](https://github.com/kensiprell/grails-atmosphere-meteor-sample), you will see that a servlet is created for each URL pattern below:
/jabber/chat/*
@@ -44,108 +44,75 @@ The configuration file, grails-app/conf/AtmosphereMeteorConfig.groovy, is used t
The create-meteor-servlet script creates a class in grails-app/atmosphere that extends Atmosphere's MeteorServlet. You could probably use a single class throughout your application.
-Although the example application uses the same MeteorServlet class for each URL, you can easily use a different class. Of course, each of the URL patterns above can be further divided using a combination of request headers, Broadcaster, etc. For example, a chat room could be established under /jabber/chat/private-room that is serviced by the same servlet, MeteorServlet, and MeteorHandler classes as /jabber/chat/*.
+Although the [sample application](https://github.com/kensiprell/grails-atmosphere-meteor-sample) uses the same MeteorServlet class for each URL, you can easily use a different class. Of course, each of the URL patterns above can be further divided using a combination of request headers, Broadcaster, etc. For example, a chat room could be established under /jabber/chat/private-room that is serviced by the same servlet, MeteorServlet, and MeteorHandler classes as /jabber/chat/*.
### MeteorHandler Class
The create-meteor-handler script creates a class in grails-app/atmosphere that extends HttpServlet. This is where you customize how the incoming and outgoing HTTP requests (including Atmosphere Broadcaster) are handled.
-## Standalone Application Installation
-
-The plugin source can be downloaded and used as a standalone Grails application. I suggest running it first before installing the plugin. The application was tested with Grails 2.2 and Tomcat 7.0.30 and Chrome 25, Firefox 19, and Safari 6 on Mountain Lion.
+## Plugin Installation
-```
-git clone git://github.com/kensiprell/grails-atmosphere-meteor.git
+The instructions assume you are using Tomcat as the servlet container. The plugin was tested with Grails 2.2 and Tomcat 7.0.30 in a new application using Chrome 25, Firefox 19, and Safari 6 on Mountain Lion.
-cd grails-atmosphere-meteor
+Edit your BuildConfig.groovy:
-grails run-app
+```
+plugins {
+ // other plugins
+ compile ":atmosphere-meteor:0.5.0"
+ // other plugins
+}
```
-You will have a simple application that performs the following tasks out of the box. Please note that this sample is not production ready. It merely incorporates some of the lessons I have learned and provides a point of departure for your own application.
-
-* Chat (open two different browsers on your computer and start chatting)
-
-* Sends a one-time, client-triggered notification to subscribers
-
-* Automatically updates the web page at predefined intervals
-
-You can review the files below to understand how it all works. Note that many of the files are not packaged into the finished plugin.
-
-* grails-app/atmosphere/org/grails/plugins/atmosphere_meteor/DefaultMeteorHandler.groovy
-
-* grails-app/atmosphere/org/grails/plugins/atmosphere_meteor/SimpleMeteorHandler.groovy
-
-* grails-app/atmosphere/org/grails/plugins/atmosphere_meteor/DefaultMeteorServlet.groovy
-
-* grails-app/conf/AtmosphereMeteorConfig.groovy
-
-* grails-app/controllers/org/grails/plugins/atmosphere_meteor/AtmosphereTestController.groovy
-
-* grails-app/services/org/grails/plugins/atmosphere_meteor/AtmosphereTestService.groovy
+ or use the deprecated:
+
+```
+grails install-plugin atmosphere-meteor
+```
-* grails-app/views/AtmosphereTest/index.gsp: This file contains all internal JavaScript.
+Create a MeteorServlet. Changes to these classes are reloaded automatically.
-* src/groovy/org/grails/plugins/atmosphere_meteor/ApplicationContextHolder (Burt Beckwith)
+```
+grails create-meteor-servlet com.example.Default
+```
-## Plugin Installation
+Create a handler. Changes to these classes are reloaded automatically.
-The instructions assume you are using Tomcat as the servlet container. The plugin was tested with Grails 2.2 and Tomcat 7.0.30 in a new application using Chrome 25, Firefox 19, and Safari 6 on Mountain Lion.
-
-1. Edit your BuildConfig.groovy:
-```groovy
- plugins {
- // other plugins
- compile ":atmosphere-meteor:0.4.5"
- // other plugins
- }
```
-
- or use the deprecated:
-```groovy
- grails install-plugin atmosphere-meteor
+grails create-meteor-handler com.example.Default
```
-2. Create a MeteorServlet. Changes to these classes are reloaded automatically.
-```groovy
- grails create-meteor-servlet com.example.Default
-```
+Edit grails-app/conf/AtmosphereMeteorConfig.groovy. Changes to this file will be implemented when the application is restarted.
-3. Create a handler. Changes to these classes are reloaded automatically.
-```groovy
- grails create-meteor-handler com.example.Default
```
+import com.example.DefaultMeteorHandler
-4. Edit grails-app/conf/AtmosphereMeteorConfig.groovy. Changes to this file will be implemented when the application is restarted.
-```groovy
- import com.example.DefaultMeteorHandler
+defaultMapping = "/jabber/*"
- defaultMapping = "/jabber/*"
-
- servlets = [
- MeteorServlet: [
+servlets = [
+ MeteorServlet: [
description: "MeteorServlet Default",
className: "com.example.DefaultMeteorServlet",
mapping: "/jabber/*",
handler: DefaultMeteorHandler
- ]
]
+]
```
-5. Note the changes the plugin installation made to grails-app/conf/BuildConfig.groovy
-```groovy
- grails.servlet.version = "3.0"
- grails.tomcat.nio = true
+Note the changes the plugin installation made to grails-app/conf/BuildConfig.groovy.
+
+```
+grails.servlet.version = "3.0"
+grails.tomcat.nio = true
- grails.project.dependency.resolution = {
- dependencies {
- compile('org.atmosphere:atmosphere-runtime:1.0.13') {
- excludes 'slf4j-api', 'atmosphere-ping'
- }
+grails.project.dependency.resolution = {
+ dependencies {
+ compile('org.atmosphere:atmosphere-runtime:1.1.RC4') {
+ excludes 'slf4j-api', 'atmosphere-ping'
}
}
+}
```
-6. Use the JavaScript code in grails-app/views/atmosphereTest/index.gsp to get you started with your own client implementation.
@@ -6,7 +6,7 @@ grails.project.dependency.resolution = {
inherits "global"
log "warn"
- legacyResolve true
+ //legacyResolve true // causes failure Grails 2.0.x
repositories {
grailsCentral()
@@ -15,7 +15,8 @@ grails.project.dependency.resolution = {
}
dependencies {
- compile("org.atmosphere:atmosphere-runtime:1.1.0.RC3") {
+ // TODO update version
+ compile("org.atmosphere:atmosphere-runtime:1.1.0.RC4") {
excludes "slf4j-api", "atmosphere-ping"
}
}
View
@@ -4,19 +4,19 @@ def processFileInplace(file, Closure processText) {
file.write(processText(text))
}
+def now = new Date()
def buildConfigFile = new File(basedir, "grails-app/conf/BuildConfig.groovy")
def atmosphereMeteorConfigFile = new File(basedir, "grails-app/conf/AtmosphereMeteorConfig.groovy")
def atmosphereMeteorResourcesFile = new File(basedir, "grails-app/conf/AtmosphereMeteorResources.groovy")
def grailsServletVersion = buildConfig.grails.servlet.version
def grailsTomcatNio = buildConfig.grails.tomcat.nio
boolean isTomcat = buildConfigFile.text.readLines().any { it =~ /tomcat/ && !(it =~ /\/\/.*tomcat/) }
boolean isAtmosphere = buildConfigFile.text.readLines().any { it =~ /org.atmosphere:atmosphere-runtime/ && !(it =~ /\/\/.*org.atmosphere:atmosphere-runtime/) }
+boolean isJackson = buildConfigFile.text.readLines().any { it =~ /org.codehaus.jackson:jackson-core-asl/ && !(it =~ /\/\/.*org.codehaus.jackson:jackson-core-asl/) }
// Create the directory for Atmosphere artefacts
ant.mkdir(dir: "${basedir}/grails-app/atmosphere")
-println "pluginBasedir: " + pluginBasedir
-
// Copy the default plugin configuration file
if (!atmosphereMeteorConfigFile.exists()) {
ant.copy(file: "${pluginBasedir}/src/templates/conf/AtmosphereMeteorConfig.groovy", todir: "${basedir}/grails-app/conf")
@@ -33,35 +33,46 @@ ant.copy(file: "${basedir}/grails-app/conf/BuildConfig.groovy", tofile: "${based
// Change grails.servlet.version to 3.0 in BuildConfig.groovy if necessary
if (grailsServletVersion != "3.0") {
processFileInplace(buildConfigFile) { text ->
- text.replaceAll(/(?m)^grails\.servlet\.version.*"(.*)".*$/, """grails.servlet.version = "3.0" // Modified by atmosphere-meteor plugin on ${new Date()}. Previous version was ${grailsServletVersion}.""")
+ text.replaceAll(/(?m)^grails\.servlet\.version.*"(.*)".*$/, """grails.servlet.version = "3.0" // Modified by atmosphere-meteor plugin on ${now}. Previous version was ${grailsServletVersion}.""")
}
}
// Change grails.tomcat.nio to true in BuildConfig.groovy if necessary
if (isTomcat) {
if (grailsTomcatNio != true && grailsTomcatNio.size() != 0) {
processFileInplace(buildConfigFile) { text ->
- text.replaceAll(/(?m)^grails\.tomcat\.nio.*=(.*)$/, """grails.tomcat.nio = true // Modified by atmosphere-meteor plugin on ${new Date()}. Previous value was ${grailsTomcatNio}.""")
+ text.replaceAll(/(?m)^grails\.tomcat\.nio.*=(.*)$/, """grails.tomcat.nio = true // Modified by atmosphere-meteor plugin on ${now}. Previous value was ${grailsTomcatNio}.""")
}
}
if (grailsTomcatNio.size() == 0) {
processFileInplace(buildConfigFile) { text ->
- text.replaceAll(/(?m)(^grails\.servlet\.version.*$)/, """\$1\ngrails.tomcat.nio = true // Added by atmosphere-meteor plugin on ${new Date()}.""")
+ text.replaceAll(/(?m)(^grails\.servlet\.version.*$)/, """\$1\ngrails.tomcat.nio = true // Added by atmosphere-meteor plugin on ${now}.""")
}
}
}
// Add atmosphere-runtime dependency in BuildConfig.groovy
+// TODO update version here and in README.md
if (!isAtmosphere) {
processFileInplace(buildConfigFile) { text ->
text.replaceAll(/(?m)(^\s*dependencies\s*\{.*$)/, """\$1
- compile('org.atmosphere:atmosphere-runtime:1.0.13') { // Added by atmosphere-meteor plugin on ${new Date()}.
+ compile('org.atmosphere:atmosphere-runtime:1.1.0.RC4') { // Added by atmosphere-meteor plugin on ${now}.
excludes 'slf4j-api', 'atmosphere-ping'
}
""")
}
}
+// Add jackson-core-asl dependency in BuildConfig.groovy
+// TODO update version
+if (!isJackson) {
+ processFileInplace(buildConfigFile) { text ->
+ text.replaceAll(/(?m)(^\s*dependencies\s*\{.*$)/, """\$1
+ compile "org.codehaus.jackson:jackson-core-asl:1.1.1" // Added by atmosphere-meteor plugin on ${now}.
+""")
+ }
+}
+
// Create context.xml in META-INF and WEB-INF
def contextDotXml = """\
<?xml version="1.0" encoding="UTF-8"?>
Oops, something went wrong.

0 comments on commit 7be9aaa

Please sign in to comment.