google wave pune_gtug

37
Programming on Google Wave By Rohit Ghatol From Pune Google Technology User Group http://pune-gtug.blogspot.com http://blog.punegtug.org

Upload: rohit-ghatol

Post on 06-May-2015

626 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Google wave pune_gtug

Programming on Google Wave

By Rohit GhatolFrom

Pune Google Technology User Grouphttp://pune-gtug.blogspot.com

http://blog.punegtug.org

Page 2: Google wave pune_gtug

What is Pune-GTUG?

GTUG stands for Google Technology User Group

http://blog.punegtug.org

Page 3: Google wave pune_gtug

Google Wave

http://blog.punegtug.org

Page 4: Google wave pune_gtug

Topics

• What is Wave?• Anatomy of a Wave• What can be done on GoogleWave?• Extending Google Wave• Writing Gadgets• Writing Robots

http://blog.punegtug.org

Page 5: Google wave pune_gtug

http://blog.punegtug.org

What is Wave?A wave is equal parts conversation and document.

People can communicate and work together with richly formatted text, photos, videos, maps, and more.

A wave is shared. Any participant can reply anywhere in the message, edit the content and add participants at any point in the process. Then playback lets anyone rewind the wave to see who said what and when.

A wave is live. 

With live transmission as you type, participants on a wave can have faster conversations, see edits and interact with extensions in real-time.

Page 6: Google wave pune_gtug

http://blog.punegtug.org

What is Wave?

Lets see Wave in action!

Page 7: Google wave pune_gtug

Topics

• What is Wave?• Anatomy of a Wave• What can be done on GoogleWave?• Extending Google Wave• Writing Gadgets• Writing Robots

http://blog.punegtug.org

Page 8: Google wave pune_gtug

http://blog.punegtug.org

Anatomy of a Wave

WaveA wave is a threaded conversation, consisting of one or more participants (which may include both human participants and robots). The wave is a dynamic entity which contains state and stores historical information. A wave is a living thing, with participants communicating and modifying the wave in real time. A wave serves as a container for one or more wavelets defined below.

Page 9: Google wave pune_gtug

http://blog.punegtug.org

Anatomy of a Wave

WaveletA wavelet is a threaded conversation that is spawned from a wave (including the initial conversation). Wavelets serve as the container for one or more messages, known as blips. The wavelet is the basic unit of access control for data in the wave. All participants on a wavelet have full read/write access to all of the content within the wavelet.

Page 10: Google wave pune_gtug

http://blog.punegtug.org

Anatomy of a Wave

BlipA blip is the basic unit of conversation and consists of a single messages which appears on a wavelet. Blips may either be drafts or published (by clicking "Done" within the Wave client). Blips manage their content through their document, defined below. Blips may also contain other blips as children, forming a blip hierarchy. Each wavelet always consists of at least one root blip.

Page 11: Google wave pune_gtug

http://blog.punegtug.org

Anatomy of a Wave

DocumentA document is the content attached to a blip. This document consists of XML which can be retrieved, modified or added by the API. Generally, you manage the document through convenience methods rather than through direct manipulation of the XML data structure.

Page 12: Google wave pune_gtug

Topics

• What is Wave?• Anatomy of a Wave• What can be done on GoogleWave?• Extending Google Wave• Writing Gadgets• Writing Robots

http://blog.punegtug.org

Page 13: Google wave pune_gtug

http://blog.punegtug.org

What can be done on Google Wave?

• Real time Chat

• Editing as a Document

• Real time collaboration

• Robots participating

Page 14: Google wave pune_gtug

Topics

• What is Wave?• Anatomy of a Wave• What can be done on GoogleWave?• Extending Google Wave• Writing Gadgets• Writing Robots

http://blog.punegtug.org

Page 15: Google wave pune_gtug

http://blog.punegtug.org

Extending Google Wave?

• Gadgets– Runs on the client.

– Multiple instances per wave.

– Not able to modify the wave, and has limited visibility into the wave. Is only able to detect changes in the wave's participants.

– Not only can't modify a robot, has no way to know that the robot exists.

• Robots– Runs in the cloud.

– One instance of a given robot per wave. Remember that a robot is like a participant on a wave, so each participant/robot is a unique instance, but a wave can have many participants/robots.

– Able to modify a wave and perform the same operations as a human participant.

– Can modify a gadget.

Page 16: Google wave pune_gtug

Topics

• What is Wave?• Anatomy of a Wave• What can be done on GoogleWave?• Extending Google Wave• Writing Gadgets• Writing Robots

http://blog.punegtug.org

Page 17: Google wave pune_gtug

Writing Gadgets

• Polling Gadget– Allows the host to set the title– All the participants can add Options– Everyone can vote on the Options

Page 18: Google wave pune_gtug
Page 19: Google wave pune_gtug

Writing Gadgets

Polling Gadget

function renderPoll(){…….}

EventsEvent Callback

State Event

ParticipantEvent

Page 20: Google wave pune_gtug

Writing Gadgets

Polling Gadget Polling Gadget

Central State

Update State

Polling GadgetPolling Gadget

Notify via callbacks

Page 21: Google wave pune_gtug

Interacting with wave participants and state

Page 22: Google wave pune_gtug

Writing Robots

• Steps– Get Google App Engine Account– Get Google App Engine Eclipse plugin– Get Web Application Project

Page 23: Google wave pune_gtug

Robot Architecture

Page 24: Google wave pune_gtug

Writing Robots

• Robot is a Java Web Application deployed on GAE

• Contains– A Servlet

– capabilities.xml

– web.xml

– appengine-web.xml

Page 25: Google wave pune_gtug

Robot Servletpublic class IterationServlet extends AbstractRobotServlet {

public void processEvents(RobotMessageBundle context) {TextView textView = context.getWavelet().getRootBlip().getDocument();//Condition to check if Robot was recently addedif(context.wasSelfAdded()){

//Example of adding a TexttextView.append("Robot: I have been just added to this wave");

//Example of adding a FormtextView.appendElement(new FormElement(ElementType.LABEL,

"NAME_LABEL", "What is your name? :"));textView.appendElement(new FormElement(ElementType.INPUT,

"NAME_INPUT"));textView.appendElement(new FormElement(ElementType.BUTTON,

"SUBMIT_BUTTON", "Submit"));

//Example of adding a GadgetGadget gadget = new Gadget("http://xyz.com/Iteration.gadget.xml");gadget.setField("country", "India");

textView.appendElement(gadget);}

}}

Page 26: Google wave pune_gtug

capabilities.xml

<?xml version="1.0"?><w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">

<w:capabilities> <w:capability name="wavelet_participants_changed"/> <w:capability name="document_changed"/> <w:capability name="form_button_clicked" content="true" /> </w:capabilities>

<w:crons> <w:cron path="/_wave/robot/fetchupdate" timerinseconds="3600" /> </w:crons>

<w:profile name="waveiteration" imageurl="/images/icon.png" profileurl="/_wave/profile.xml" /></w:robot>

Page 27: Google wave pune_gtug

Robot API Overview

Page 28: Google wave pune_gtug

Robots + Gadget

• Further we will talk about how to use Robots and Gadgets in conjunction with each other

• Here is a Product Idea

Page 29: Google wave pune_gtug

Account of [email protected]

Page 30: Google wave pune_gtug

Account of [email protected]

Page 31: Google wave pune_gtug

Account of [email protected]

Page 32: Google wave pune_gtug

Account of [email protected]

Page 33: Google wave pune_gtug

Account of [email protected]

Page 34: Google wave pune_gtug

Account of [email protected]

Page 35: Google wave pune_gtug

Robot wrote the updates from the Gadget to a Google Spreadsheet

Page 36: Google wave pune_gtug

Robots + Gadget

Create Wave

Add Robot

Present a Form

Submit Form

Create New Wave

Add Participants

Add Gadget

Add State toGadget

Interacts with Gadget

Get Gadget State

Store data on

Spreadsheet

User Action

Robot kicks in

Page 37: Google wave pune_gtug

Questions?

?

http://blog.punegtug.org