Prezi

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in the manual

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Google Wave Robots API: Java

Robots, Gadgets, Embed
by Pamela Fox on 5 May 2010

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Google Wave Robots API: Java

Robots "events": [
{
"type": "WAVELET_SELF_ADDED",
"modifiedBy": "pamela.fox@wavesandbox.com",
"timestamp": 1269400482868,
"properties": {
"blipId": "b+FYYeTpCXJ"
}
}
],
"wavelet": {
"creationTime": 1269400451853,
"lastModifiedTime": 1269400482868,
"version": 14,
"participants": [
"pamela.fox@wavesandbox.com",
"wave-skimmy@appspot.com"
],
"creator": "pamela.fox@wavesandbox.com",
"rootBlipId": "b+FYYeTpCXJ",
"title": "Dear Diary,",
"waveId": "wavesandbox.com!w+FYYeTpCXI",
"waveletId": "wavesandbox.com!conv+root"
}, {"params": {
"blipId": "b+FYYeTpCXJ",
"waveletId": "wavesandbox.com!conv+root",
"waveId": "wavesandbox.com!w+FYYeTpCXI",
"modifyAction": {
"modifyHow": "REPLACE",
"elements": [
{
"type": "IMAGE",
"properties": {
"url": "http://wave-skimmy.appspot.com/smile.gif"
}
}
]
},
"modifyQuery": {
"textMatch": ":)",
"maxRes": -1
}
},
"method": "document.modify",
"id": "op2"
} Events Operations Robot Wave Wave http://geo-bot.appspot.com/_wave/robot/jsonrpc WAVELET_BLIP_CREATED
WAVELET_BLIP_REMOVED
WAVELET_PARTICIPANTS_CHANGED
WAVELET_SELF_ADDED
WAVELET_SELF_REMOVED
WAVELET_TITLE_CHANGED
BLIP_CONTRIBUTORS_CHANGED
BLIP_SUBMITTED
DOCUMENT_CHANGED
FORM_BUTTON_CLICKED
GADGET_STATE_CHANGED
ANNOTATED_TEXT_CHANGED
wavelet.appendBlip
wavelet.setTitle
wavelet.participant.add
wavelet.datadoc.set
wavelet.modifyTag
blip.createChild
blip.delete
document.appendMarkup
document.inlineBlip.insert
document.modify
robot.createWavelet
robot.fetchWave
robot.notifyCapabilitiesHash Google Wave Context Filters Events Operations Proxying-For Active @Capability(contexts = {Context.ALL})
@Override
public void onWaveletSelfAdded(WaveletSelfAddedEvent event) {
// ...
} ROOT
SELF
PARENT
CHILDREN

SIBLINGS
ALL @Capability(filter = "\\[\\[.*\\]\\]")

@Override
public void onDocumentChanged(DocumentChangedEvent event) {
...
} public MyRobot() {
myRobot.setupOAuth(CONSUMER_KEY, CONSUMER_SECRET, "http://sandbox.gmodules.com/api/rpc");
}


Wavelet wave = robot.newWave("wavesandbox.com",
Arrays.asList("someguy@wavesandbox.com"));



wave = robot.fetchWave("wavesandbox.com!w+QjPzTWBUI",
"wavesandbox.com!conv+root");
wave.getRootBlip().append("New data"); wavelet.proxyFor("douwe").reply("Taking the Ferry.."); package skimmy;

import com.google.wave.api.*;
import com.google.wave.api.event.*;
import java.util.*;

public class SkimmyServlet extends AbstractRobot {
public static String animBase = "http://wave-skimmy.appspot.com/";
public static String animExt = ".gif";
public static HashMap<String, String> replacements = new HashMap();

public static void main() {
replacements.put(":)", new String("smile"));
replacements.put(":(", "frown");
replacements.put("<3", "heart");
}

@Override
protected String getRobotName() {
return "Parroty";
}

@Override
protected String getRobotAvatarUrl() {
return "http://code.google.com/apis/wave/extensions/robots/images/robot_avatar.png";
}

@Override
protected String getRobotProfilePageUrl() {
return "http://code.google.com/apis/wave/extensions/robots/java-tutorial.html";
}

@Override
public void onWaveletSelfAdded(WaveletSelfAddedEvent event) {
processBlip(event.getBlip());
}

@Override
public void onBlipSubmitted(BlipSubmittedEvent event) {
processBlip(event.getBlip());
}

public void processBlip(Blip blip) {
Set set = replacements.entrySet();
Iterator i = set.iterator();
while(i.hasNext()) {
Map.Entry me = (Map.Entry)i.next();
String ascii = (String) me.getKey();
String filename = (String)me.getValue();
String url = animBase + filename + animExt;
blip.all(ascii).replace(new Image(url, filename));
}
}
} @Override
protected ParticipantProfile getCustomProfile(String name) {
if (name.equals("douwe")) {
return new ParticipantProfile("Douwe",
"http://a1.twimg.com/77215846/square.png",
"http://twitter.com/dosinga");
}
} Forum Botty Buggy
See the full transcript