Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Write Your First Google Wave Robot in Java

Creating useful content and services is expensive and time consuming. Why not amortize your efforts by publishing those creations to multiple platforms? The Google Wave platform enables you to do just that.


advertisement
hy learn Google Wave? If you have tried it or at least watched the videos introducing it, you might dismiss it as just another rich client web application like Gmail. That is partially correct, but Wave is also a cross-platform development and publishing platform.

Knowing how expensive and time consuming it is to create useful content and services, we developers naturally want to amortize our efforts by publishing those creations to multiple platforms. The Wave platform enables you to do just that (see Figure 1).

Figure 1. The Big Picture: Reuse data and web services for multiple client platforms (hosted entirely on App Engine).



Google Wave is a collaboration platform that solves some of the problems with using email for collaboration. By allowing multiple collaborators to edit the same document in one place, it is simpler to keep the whole document (or "wave") intact and the document is easier to read. If you need to see what changes other people have made, the Wave viewer has a slider control to roll the document (wave) back in time and undo changes. As shown in the demo Wave video, if two or more people are editing a wave at the same time, you can see other people's edits in near real time.

When you create a wave, you can invite other people to read and edit it. This article explains how you can also invite software agents known as Wave Robots to read and edit waves. Depending on how you configure your Wave Robots, they receive different types of event notifications for the waves that they are invited to join. As examples, you can configure a robot to see every few key strokes while someone is editing a document or blocks of changes triggered when an editor does a save operation.

If you are working on a project that needs to support multiple user-facing platforms, putting in the extra effort to support Wave makes perfect sense. (If that's not reason enough to learn the Wave APIs and practice writing some Wave robots of your own, Google reportedly will open an app store for Google Waves and Gadgets sometime in the near future.) Feeling motivated now? This article will get you started.

Through the development of a demo Wave robot, this article demonstrates how to:

  • Set up Wave robots for Java development
  • Write a Wave robot application
  • Use a Wave robot as a proxy for web services deployed on other platforms
  • Add a Wave robot to an existing web application hosted on Google App Engine (the platform on which you deploy Wave robots)

Robot as Proxy for Services

If you are not currently developing for Google App Engine and have existing web services and web applications hosted on your own servers (or Amazon, RackSpace, a VPS, Engine Yard, Heroku, etc.), you might want to try the architecture shown in Figure 2. It uses App Engine as a proxy for web services hosted on alternative (to App Engine) deployment platforms.

Figure 2. Developing for App Engine with Existing Web Services/Apps: Use App Engine robot as a proxy to web services deployed on alternative platforms.

Figure 2 reflects the use case for the demo Wave robot in this article, as it uses an existing web application hosted on a conventional server. When the demo robot is invited to join a Wave, it uses the Wave title as a search string to the cookingspace.com web service, a portal I host on my own server. CookingSpace provides one web service API: given a query string, it returns a list of recipes, each of which is annotated with nutritional information. The robot processes the JSON data returned from the web service and inserts zero or more recipes into the wave. (Note: in this article, I capitalize Wave when I refer to the Wave platform and use lower case wave when referring to a single document.)

Author's Note: Google Gadget (HTML and JavaScript Wave UI components) development is beyond the scope of this article.

Because the demo robot acts as a proxy for another web service, it does not require a data store. Refer to my previous App Engine article, "Implement Document Storage and Search on Google Java App Engine," for an example using the App Engine data store. If you implement a robot entirely on AppEngine, which is the most likely scenario, you may want to keep some persistent data for Waves - unlikely, but it is possible that you may need to maintain some state information on the server side. That said, robots are usually stateless, receiving all information that they need to operate in the event notification messages that they receive from the Wave platform.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap