Getting Started With Google Wave Developlement

816 views

Published on

Introduction to Google Wave Gadget and and Robot APIs. Presentation given May 26, 2010 at the National Extension Technology Conference in Auburn, Alabama. War Eagle!

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
816
On SlideShare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Getting Started With Google Wave Developlement

  1. 1. Getting Started With Google Wave Development James E. Robinson, III NC State University james.robinson@extension.org NETC 2010
  2. 2. Google Wave v/s Google wave Wave - the Wave protocol wave - The Google wave web app
  3. 3. Wave Anatomy
  4. 4. Wavelet Anatomy
  5. 5. Wavelet Anatomy (cont.) Blips Participants Tags Data Documents metadata creator creation_time last_modified_time robot title
  6. 6. Blip Anatomy
  7. 7. Blip Anatomy (cont.) Document Annotations Children Parent (if not already) metadata creator contributors last_modified version
  8. 8. Gadgets: n, dynamic web content that can be placed on any page on the web. Gadgets can be games, mini applications, news feeds, maps or any content. See also: JavaScript on steroids.
  9. 9. <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="Hello, World"> <Require feature="wave" /> </ModulePrefs> <Content type="html"> Hello, World! </Content> </Module>
  10. 10. Wave Gadget API setStateCallback getState setPrivateStateCallback getPrivateState submitDelta setParticipantCallback
  11. 11. Gadget API Example <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="Counter/State Example" height="120"> <Require feature="wave" /> </ModulePrefs>
  12. 12. <Content type="html"> <![CDATA[ <div id="content_div" style="height: 50px;"></div> <input type=button value="Click Me!" id="butCount" onClick="buttonClicked()" > <input type=button value="Reset" id=" butReset" onClick="resetCounter()">
  13. 13. <script type="text/javascript"> var div = $('content_div'); function init() { if (wave && wave.isInWaveContainer()) { wave.setStateCallback(stateUpdated); } } gadgets.util.registerOnLoadHandler(init);
  14. 14. function buttonClicked() { var val = wave.getState().get('count', '0'); wave.getState().submitDelta( {'count': val + 1}); } function stateUpdated() { if (!wave.getState().get('count')) { div.innerHTML = "The count is 0." } else { div.innerHTML = "The count is " + wave.getState().get('count'); } }
  15. 15. // Reset value of "count" to 0 function resetCounter(){ wave.getState().submitDelta({'count': '0'}); } </script> ]]> </Content> </Module>
  16. 16. Gadget Hosting?
  17. 17. What To Do? if __name__ == '__main__': myRobot = robot.Robot('robot name', image_url='http://path.to/icon.png') myRobot.register_handler( events.WaveletSelfAdded, OnSelfAdded) myRobot.Run()
  18. 18. Add us a Gadget... def OnSelfAdded(event, wavelet): blip = event.blip gadget = element.Gadget(GADGET_URL) blip.append(gadget)
  19. 19. Wave Happenings wavelet_blip_created wavelet_blip_removed wavelet_participants_change wavelet_self_added wavelet_self_removed wavelet_title_changed wavelet_timestamp_changed wavelet_version_changed
  20. 20. Blip Happenings blip_contributors_changed blip_deleted blip_submitted - only fires once blip_timestamp_changed blip_version_changed document_changed - various intervals form_button_clicked
  21. 21. code.google.com/appengine/ downloads.html
  22. 22. Register your new application...
  23. 23. Complex mapping structure AppName: jerobins-test Application URL: jerobins-test.appspot.com Wave Address: jerobins-test@appspot.com
  24. 24. Now What? def OnBlipSubmitted(event, wavelet): blip = event.blip gadget = blip.first(element.Gadget, url=GADGET_URL) if gadget: count = gadget.get('count', '0') gadget.update_element({'count', '0'}) blip.append("nCount before blip" + " changed: " + count)
  25. 25. Danger, Will Robinson! Your robot or gadget may not be the only gadget or robot on the wave.
  26. 26. Annotations
  27. 27. Robot Annotations def OnWaveletSelfAdded(event, wavelet): blip = event.blip blip.Annotation("my-robot/tag") def OnButtonClicked(event, wavelet): blip = event.blip annots = blip.annotations if annots.include("my-robot/tag"): """ do MY robot stuff """
  28. 28. Active Robot API Performing scheduled tasks (e.g. cron jobs) at specified intervals Creating new waves within Google Wave in response to actions within Google Wave itself Responding to outside events or services by updating waves or creating new ones
  29. 29. Keep on Wavin' ...

×