You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/05/29 12:46:42 UTC
svn commit: r949378 - in /shindig/trunk:
content/samplecontainer/examples/ActivityStreams/ content/sampledata/
extras/src/main/java/org/apache/shindig/extras/as/
extras/src/main/java/org/apache/shindig/extras/as/core/
extras/src/main/java/org/apache/sh...
Author: lindner
Date: Sat May 29 10:46:42 2010
New Revision: 949378
URL: http://svn.apache.org/viewvc?rev=949378&view=rev
Log:
SHINDIG-1329 | Patch from Eric Woods | Reworked patch for ActivityStreams
Added:
shindig/trunk/content/samplecontainer/examples/ActivityStreams/
shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamGadget.xml
shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialAPI.js
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/ActivityStreamsGuiceModule.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityEntryImpl.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityObjectImpl.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityStreamImpl.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityEntry.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityObject.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityStream.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/service/
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/service/ActivityStreamsHandler.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/spi/
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/spi/ActivityStreamService.java
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/sample/
shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/sample/ActivityStreamsJsonDbService.java
Modified:
shindig/trunk/content/sampledata/canonicaldb.json
shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java
Added: shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamGadget.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamGadget.xml?rev=949378&view=auto
==============================================================================
--- shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamGadget.xml (added)
+++ shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamGadget.xml Sat May 29 10:46:42 2010
@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<Module>
+ <ModulePrefs title="ActivityStreams Gadget!">
+ <Require feature="opensocial-0.9"/>
+ <Require feature="osapi"/>
+ <Require feature="dynamic-height"/>
+ </ModulePrefs>
+
+ <Content type="html">
+ <![CDATA[
+ <script type="text/javascript" src="OpenSocialAPI.js"></script>
+
+ <script type="text/javascript">
+ // HTML for rendering
+ var htmlWelcome = "";
+ var htmlActivities = "";
+ var htmlActivityEntries = "";
+ var htmlCreateActivityEntry = "";
+ var htmlDeleteActivityEntry = "";
+ var htmlActivityEntryId = "";
+
+ var viewer = null;
+ var owner = null;
+
+ // ================= PEOPLE =================
+ function displayWelcome() {
+ OpenSocialAPI.loadPeople(function(response) {
+ viewer = response.viewer;
+ owner = response.owner;
+ var viewerFriends = response.viewerFriends;
+ var ownerFriends = response.ownerFriends;
+
+ htmlWelcome = "<h1>Welcome " + viewer.name.formatted + "!</h1>";
+ htmlWelcome += "You are viewing " + owner.name.formatted + "'s data. <br><br>";
+ htmlWelcome += "Here is a list of your friends: <br>";
+ htmlWelcome += "<lu>";
+ for(i = 0; i < viewerFriends.list.length; i++) {
+ htmlWelcome += "<li>" + viewerFriends.list[i].name.formatted + "</li>";
+ }
+ htmlWelcome += "</lu>";
+ refreshHTML();
+ });
+ }
+
+ // ================= ACTIVITIES =================
+ function displayActivities() {
+ OpenSocialAPI.loadActivities(function(response) {
+ var viewerActivities = response.viewerActivities.list;
+ var ownerActivities = response.ownerActivities.list;
+
+ htmlActivities = "<h1>Activities</h1>";
+ htmlActivities += "Demonstrates use of the Activities service in Apache Shindig. The ActivityStreams service does not interfere with this service.<br><br>";
+ htmlActivities += "Activities for you and " + owner.name.formatted + ":<br>";
+ htmlActivities += "<table border='1'>";
+ htmlActivities += "<tr>";
+ htmlActivities += "<td>Name</td>";
+ htmlActivities += "<td>Title</td>";
+ htmlActivities += "<td>Body</td>";
+ htmlActivities += "<td>Images</td>";
+ htmlActivities += "</tr>"
+ processActivities(viewerActivities);
+ processActivities(ownerActivities);
+ htmlActivities += "</table>";
+ refreshHTML();
+ });
+ }
+ function processActivities(activities) {
+ for(idx = 0; idx < activities.length; idx++) {
+ htmlActivities += "<tr>";
+ htmlActivities += "<td>" + activities[idx].userId + "</td>";
+ htmlActivities += "<td>" + activities[idx].title + "</td>";
+ htmlActivities += "<td>" + activities[idx].body + "</td>";
+ var mediaItems = activities[idx].mediaItems;
+ if(mediaItems != null) {
+ for(itemIdx = 0; itemIdx < mediaItems.length; itemIdx++) {
+ if(mediaItems[itemIdx].type == "image") {
+ htmlActivities += "<td><img src='" + mediaItems[itemIdx].url + "' width=150 height=150/></td>";
+ }
+ }
+ }
+ htmlActivities += "</tr>";
+ }
+ }
+
+ // ================= ACTIVITYSTREAMS =================
+ function displayActivityEntries() {
+ OpenSocialAPI.loadActivityEntries(function(response) {
+ viewerEntries = response.viewerEntries.list;
+ ownerEntries = response.ownerEntries.list;
+ htmlActivityEntries = "<h2>ActivityEntries</h2>";
+ processActivityEntries(viewerEntries);
+ processActivityEntries(ownerEntries);
+ if (viewerEntries.length + ownerEntries.length == 0) {
+ htmlActivityEntries += "<tr><td>No entries to show!</td></tr>";
+ }
+ htmlActivityEntries += "</table><br><br>";
+ refreshHTML();
+ });
+ }
+ function processActivityEntries(entries) {
+ for(idx = 0; idx < entries.length; idx++) {
+ if(entries[idx].permalink && entries[idx].permalink != "null") {
+ htmlActivityEntries += "<h3><a href='" + entries[idx].permalink + "'>" + entries[idx].title + "</a></h3>";
+ } else {
+ htmlActivityEntries += "<h3>" + entries[idx].title + "</h3>";
+ }
+ htmlActivityEntries += "ID: " + entries[idx].id + "<br>";
+ htmlActivityEntries += "Actor: " + entries[idx].actor.displayName + "<br>";
+ htmlActivityEntries += "Posted: " + entries[idx].postedTime + "<br>";
+ if(entries[idx].body && entries[idx].body != "null") {
+ htmlActivityEntries += "Body: " + entries[idx].body + "<br>";
+ }
+ }
+ }
+
+ function displayCreateActivityEntry() {
+ htmlCreateActivityEntry = "<h1>ActivityStreams</h1>";
+ htmlCreateActivityEntry += "Demonstrates use of the ActivityStream service in Apache Shindig. This implementation follows the current JSON draft specfication: http://activitystrea.ms/head/json-activity.html<br>";
+ htmlCreateActivityEntry += "<h2>Create an ActivityEntry</h2>";
+ htmlCreateActivityEntry += "<table>";
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td>Title</td>";
+ htmlCreateActivityEntry += "<td><input type='text' size=50 id='activityEntryTitle'></td>"
+ htmlCreateActivityEntry += "</tr>";
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td>Body</td>";
+ htmlCreateActivityEntry += "<td><input type='text' size=50 id='activityEntryBody'></td>"
+ htmlCreateActivityEntry += "</tr>";
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td>Permalink</td>";
+ htmlCreateActivityEntry += "<td><input type='text' size=50 id='activityEntryPermalink'></td>"
+ htmlCreateActivityEntry += "</tr>";
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td>Object Display Name</td>";
+ htmlCreateActivityEntry += "<td><input type='text' size=50 id='activityObjectDisplayName'></td>"
+ htmlCreateActivityEntry += "</tr>";
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td>Object Summary</td>";
+ htmlCreateActivityEntry += "<td><input type='text' size=50 id='activityObjectSummary'></td>"
+ htmlCreateActivityEntry += "</tr>";
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td>Object Image URL</td>";
+ htmlCreateActivityEntry += "<td><input type='text' size=50 id='activityObjectImage'></td>"
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td>Object Permalink</td>";
+ htmlCreateActivityEntry += "<td><input type='text' size=50 id='activityObjectPermalink'></td>"
+ htmlCreateActivityEntry += "</tr>";
+ htmlCreateActivityEntry += "</table>";
+ htmlCreateActivityEntry += "<table>";
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td>Verbs</td>";
+ htmlCreateActivityEntry += "<td>Objects Types</td>";
+ htmlCreateActivityEntry += "</tr>";
+ htmlCreateActivityEntry += "<tr>";
+ htmlCreateActivityEntry += "<td><select MULTIPLE id='selectVerbs' size=10>";
+ htmlCreateActivityEntry += "<option value='markAsFavorite'>Mark as Favorite</option>";
+ htmlCreateActivityEntry += "<option value='startFollowing'>Start Following</option>";
+ htmlCreateActivityEntry += "<option value='markAsLiked'>Mark as Liked</option>";
+ htmlCreateActivityEntry += "<option value='makeFriend'>Make Friend</option>";
+ htmlCreateActivityEntry += "<option value='join'>Join</option>";
+ htmlCreateActivityEntry += "<option value='play'>Play</option>";
+ htmlCreateActivityEntry += "<option value='post'>Post</option>";
+ htmlCreateActivityEntry += "<option value='save'>Save</option>";
+ htmlCreateActivityEntry += "<option value='share'>Share</option>";
+ htmlCreateActivityEntry += "<option value='tag'>Tag</option>";
+ htmlCreateActivityEntry += "<option value='update'>Update</option>";
+ htmlCreateActivityEntry += "</select></td>";
+ htmlCreateActivityEntry += "<td><select MULTIPLE id='selectObjectTypes' size=10>";
+ htmlCreateActivityEntry += "<option value='article'>Article</option>";
+ htmlCreateActivityEntry += "<option value='audio'>Audio</option>";
+ htmlCreateActivityEntry += "<option value='bookmark'>Bookmark</option>";
+ htmlCreateActivityEntry += "<option value='comment'>Comment</option>";
+ htmlCreateActivityEntry += "<option value='file'>File</option>";
+ htmlCreateActivityEntry += "<option value='folder'>Folder</option>";
+ htmlCreateActivityEntry += "<option value='group'>Group</option>";
+ htmlCreateActivityEntry += "<option value='list'>List</option>";
+ htmlCreateActivityEntry += "<option value='note'>Note</option>";
+ htmlCreateActivityEntry += "<option value='person'>Person</option>";
+ htmlCreateActivityEntry += "<option value='photo'>Photo</option>";
+ htmlCreateActivityEntry += "<option value='photoAlbum'>Photo Album</option>";
+ htmlCreateActivityEntry += "<option value='place'>Place</option>";
+ htmlCreateActivityEntry += "<option value='playlist'>Playlist</option>";
+ htmlCreateActivityEntry += "<option value='product'>Product</option>";
+ htmlCreateActivityEntry += "<option value='review'>Review</option>";
+ htmlCreateActivityEntry += "<option value='service'>Service</option>";
+ htmlCreateActivityEntry += "<option value='status'>Status</option>";
+ htmlCreateActivityEntry += "<option value='video'>Video</option>";
+ htmlCreateActivityEntry += "</select></td>";
+ htmlCreateActivityEntry += "</table>";
+ htmlCreateActivityEntry += "<input type='button' value='Submit' onclick='createActivityEntry()'>";
+ htmlCreateActivityEntry += "<br><br>";
+ }
+ function createActivityEntry() {
+ // Gather selected verbs
+ verbOptions = document.getElementById('selectVerbs');
+ selVerbs = [];
+ count = 0;
+ for(i = 0; i < verbOptions.options.length; i++) {
+ if(verbOptions.options[i].selected) {
+ selVerbs[count] = verbOptions.options[i].value;
+ count++;
+ }
+ }
+
+ // Gather selected types
+ typeOptions = document.getElementById('selectObjectTypes');
+ selTypes = [];
+ count = 0;
+ for(i = 0; i < typeOptions.options.length; i++) {
+ if(typeOptions.options[i].selected) {
+ selTypes[count] = typeOptions.options[i].value;
+ count++;
+ }
+ }
+
+ var title = blankToNull(document.getElementById('activityEntryTitle').value);
+ var body = blankToNull(document.getElementById('activityEntryBody').value)
+ var permalink = blankToNull(document.getElementById('activityEntryPermalink').value);
+ var objectDisplayName = blankToNull(document.getElementById('activityObjectDisplayName').value);
+ var objectSummary = blankToNull(document.getElementById('activityObjectSummary').value);
+ var objectImage = blankToNull(document.getElementById('activityObjectImage').value);
+ var objectPermalink = blankToNull(document.getElementById('activityObjectPermalink').value);
+ OpenSocialAPI.postActivityEntry(title, body, permalink, selVerbs, viewer.id, viewer.name.formatted,
+ objectDisplayName, objectSummary, objectImage, objectPermalink, selTypes,
+ function(response) {
+ displayActivityEntries();
+ });
+ }
+ function blankToNull(str) {
+ return (str == '' ? null : str);
+ }
+
+
+ function displayActivityEntryId() {
+ htmlActivityEntryId = "<h2>Work with an ActivityEntry</h2>";
+ htmlActivityEntryId += "ActivityEntry ID: <input type='text' size=40 id='activityEntryId'>";
+ htmlActivityEntryId += "<input type='button' value='Retrieve' onclick='retrieveActivityEntryId()'>";
+ htmlActivityEntryId += "<input type='button' value='Delete' onclick='deleteActivityEntryId()'><br>";
+ htmlActivityEntryId += "Note: you must be the owner of the ActivityEntry to retrieve it.";
+ htmlActivityEntryId += "<textarea id='activityEntryText' cols=75 rows=10>No entry to display...</textarea><br>";
+ }
+ function deleteActivityEntryId() {
+ OpenSocialAPI.deleteActivityEntryById(document.getElementById('activityEntryId').value, function(response) {
+ displayActivityEntries();
+ document.getElementById('activityEntryText').value = 'No entry to display...';
+ });
+ }
+ function retrieveActivityEntryId() {
+ OpenSocialAPI.getActivityEntryById(document.getElementById('activityEntryId').value, function(response) {
+ document.getElementById('activityEntryText').value = JSON.stringify(response);
+ });
+ }
+
+ // ================= SET UP =================
+ // Rewrites the HTML content
+ function refreshHTML() {
+ document.getElementById('message').innerHTML = htmlWelcome + htmlActivities + htmlCreateActivityEntry + htmlActivityEntryId + htmlActivityEntries;
+ gadgets.window.adjustHeight();
+ }
+
+ // Initializes the gadget
+ function init() {
+ displayWelcome();
+ displayActivities();
+ displayCreateActivityEntry();
+ displayActivityEntryId();
+ displayActivityEntries();
+ refreshHTML();
+ }
+
+ gadgets.util.registerOnLoadHandler(init);
+ </script>
+ <div id='message'></div>
+ ]]>
+ </Content>
+</Module>
\ No newline at end of file
Added: shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialAPI.js
URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialAPI.js?rev=949378&view=auto
==============================================================================
--- shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialAPI.js (added)
+++ shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialAPI.js Sat May 29 10:46:42 2010
@@ -0,0 +1,133 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+var OpenSocialAPI = new function() {
+
+ // =============================== PEOPLE ===============================
+
+ /*
+ * Loads the owner, the viewer, the owner's friends, and the viewer's
+ * friends. Response data is put into the variables owner, viewer,
+ * ownerFriends, and viewerFriends, respectively.
+ *
+ * @param callback is the function to return the response to
+ */
+ this.loadPeople = function(callback) {
+ var batch = osapi.newBatch();
+ batch.add('viewer', osapi.people.getViewer());
+ batch.add('owner', osapi.people.getOwner());
+ batch.add('viewerFriends', osapi.people.getViewerFriends());
+ batch.add('ownerFriends', osapi.people.getOwnerFriends());
+ batch.execute(callback);
+ }
+
+ this.loadViewerFriends = function(callback) {
+ osapi.people.getViewerFriends().execute(callback);
+ }
+
+ this.loadOwnerFriends = function(callback) {
+ osapi.people.getOwnerFriends().execute(callback);
+ }
+
+ // ========================= ACTIVITIES =============================
+ this.loadActivities = function(callback) {
+ var batch = osapi.newBatch();
+ batch.add('viewerActivities', osapi.activities.get({userId: '@viewer', groupId: '@self'}));
+ batch.add('ownerActivities', osapi.activities.get({userId: '@owner', groupId: '@self'}));
+ batch.execute(callback);
+ }
+
+ this.loadViewerActivities = function(callback) {
+ var req = osapi.activities.get({userId: '@viewer', groupId: '@self'});
+ req.execute(callback);
+ }
+
+ this.loadViewerFriendsActivities = function(callback) {
+ var req = osapi.activities.get({userId: '@viewer', groupId: '@friends'});
+ req.execute(this.onLoadActivitiesFriends);
+ }
+
+ this.loadOwnerActivities = function(callback) {
+ var req = osapi.activities.get({userId: '@owner', groupId: '@self'});
+ req.execute(callback);
+ }
+
+
+ // ========================= ACTIVITY STREAMS =============================
+ this.loadActivityEntries = function(callback) {
+ var batch = osapi.newBatch();
+ batch.add('viewerEntries', osapi.activitystreams.get({userId: '@viewer', groupId: '@self'}));
+ batch.add('ownerEntries', osapi.activitystreams.get({userId: '@owner', groupId: '@self'}));
+ batch.execute(callback);
+ }
+
+ this.loadViewerActivityEntries = function(callback) {
+ var params = {userId: '@viewer', groupId: '@self'}
+ osapi.activitystreams.get(params).execute(callback);
+ }
+
+ this.loadOwnerActivityEntries = function(callback) {
+ var params = {userId: '@owner', groupId: '@self'}
+ osapi.activitystreams.get(params).execute(callback);
+ }
+
+ this.loadViewerFriendsActivityEntries = function(callback) {
+ var params = {userId: '@owner', groupId: '@self'}
+ osapi.activitystreams.get(params).execute(callback);
+ }
+
+ this.postActivityEntry = function(title, body, permalink, verbs, actorId, actorDisplayName, objectDisplayName, objectSummary,
+ objectImage, objectPermalink, objectTypes, callback) {
+ var params = {
+ userId: '@viewer',
+ groupId: '@self',
+ activityEntry: {
+ permalink: permalink,
+ postedTime: '2010-04-27T06:02:36+0000',
+ title: title,
+ body: body,
+ actor: {
+ id: actorId,
+ displayName: actorDisplayName
+ },
+ verb: verbs,
+ object: {
+ id: 'activityObjectID',
+ displayName: objectDisplayName,
+ permalink: objectPermalink,
+ objectType: objectTypes
+ }
+ }
+ }
+ osapi.activitystreams.create(params).execute(callback);
+ }
+
+ this.deleteActivityEntryById = function(activityEntryId, callback) {
+ var params = {
+ userId: '@viewer',
+ groupId: '@self',
+ activityEntryId: activityEntryId
+ }
+ osapi.activitystreams.delete(params).execute(callback);
+ }
+
+ this.getActivityEntryById = function(activityEntryId, callback) {
+ var params = {activityEntryId: activityEntryId};
+ osapi.activitystreams.get(params).execute(callback);
+ }
+}
\ No newline at end of file
Modified: shindig/trunk/content/sampledata/canonicaldb.json
URL: http://svn.apache.org/viewvc/shindig/trunk/content/sampledata/canonicaldb.json?rev=949378&r1=949377&r2=949378&view=diff
==============================================================================
--- shindig/trunk/content/sampledata/canonicaldb.json (original)
+++ shindig/trunk/content/sampledata/canonicaldb.json Sat May 29 10:46:42 2010
@@ -348,7 +348,26 @@
"title" : "Jane says George likes yoda!",
"userId" : "jane.doe"
}]
-
+},
+"activityEntries" : {
+ "john.doe": [{
+ "id": "myEntryId123",
+ "permalink": "http://www.myactivityentry.com",
+ "postedTime": "2010-04-27T06:02:36+0000",
+ "title": "This is my ActivityEntry!",
+ "body": "ActivityStreams are so much fun!",
+ "actor": {
+ "id": "john.doe",
+ "displayName": "John Doe"
+ },
+ "verb": ["play", "post"],
+ "object": {
+ "id": "myObjectId123",
+ "displayName": "My Object",
+ "permalink": "http://www.myobject.com",
+ "objectType": ["article"]
+ }
+ }]
},
//
// ----------------------------- Data ---------------------------------------
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/ActivityStreamsGuiceModule.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/ActivityStreamsGuiceModule.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/ActivityStreamsGuiceModule.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/ActivityStreamsGuiceModule.java Sat May 29 10:46:42 2010
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.shindig.extras.as;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Names;
+import org.apache.shindig.extras.as.opensocial.service.ActivityStreamsHandler;
+import org.apache.shindig.extras.as.opensocial.spi.ActivityStreamService;
+import org.apache.shindig.extras.as.sample.ActivityStreamsJsonDbService;
+import org.apache.shindig.social.sample.spi.JsonDbOpensocialService;
+
+/**
+ * Configures the Extra modules in shindig-extras.
+ */
+public class ActivityStreamsGuiceModule extends AbstractModule {
+ @Override
+ protected void configure() {
+ bind(ActivityStreamService.class).to(ActivityStreamsJsonDbService.class);
+
+ Multibinder<Object> handlerBinder = Multibinder.newSetBinder(binder(), Object.class, Names.named("org.apache.shindig.handlers"));
+ handlerBinder.addBinding().toInstance(ActivityStreamsHandler.class);
+ }
+}
\ No newline at end of file
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityEntryImpl.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityEntryImpl.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityEntryImpl.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityEntryImpl.java Sat May 29 10:46:42 2010
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.shindig.extras.as.core.model;
+
+import java.util.List;
+
+import org.apache.shindig.extras.as.opensocial.model.ActivityEntry;
+import org.apache.shindig.extras.as.opensocial.model.ActivityObject;
+
+public class ActivityEntryImpl implements ActivityEntry {
+
+ private String id;
+ private String streamFavicon;
+ private String postedTime;
+ private ActivityObject actor;
+ private List<String> verb;
+ private ActivityObject object;
+ private ActivityObject target;
+ private String permalink;
+ private String title;
+ private String body;
+
+ public ActivityEntryImpl() {
+ this.id = null;
+ this.streamFavicon = null;
+ this.postedTime = null;
+ this.actor = null;
+ this.verb = null;
+ this.object = null;
+ this.target = null;
+ this.permalink = null;
+ this.title = null;
+ this.body = null;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setStreamFavicon(String streamFavicon) {
+ this.streamFavicon = streamFavicon;
+ }
+
+ public String getStreamFavicon() {
+ return streamFavicon;
+ }
+
+ public void setPostedTime(String postedTime) {
+ this.postedTime = postedTime;
+ }
+
+ public String getPostedTime() {
+ return postedTime;
+ }
+
+ public void setActor(ActivityObject actor) {
+ this.actor = actor;
+ }
+
+ public ActivityObject getActor() {
+ return actor;
+ }
+
+ public void setVerb(List<String> verb) {
+ this.verb = verb;
+ }
+
+ public List<String> getVerb() {
+ return verb;
+ }
+
+ public void setObject(ActivityObject object) {
+ this.object = object;
+ }
+
+ public ActivityObject getObject() {
+ return object;
+ }
+
+ public void setTarget(ActivityObject target) {
+ this.target = target;
+ }
+
+ public ActivityObject getTarget() {
+ return target;
+ }
+
+ public void setPermalink(String permalink) {
+ this.permalink = permalink;
+ }
+
+ public String getPermalink() {
+ return permalink;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ public String getBody() {
+ return body;
+ }
+}
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityObjectImpl.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityObjectImpl.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityObjectImpl.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityObjectImpl.java Sat May 29 10:46:42 2010
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.shindig.extras.as.core.model;
+
+import java.util.List;
+
+import org.apache.shindig.extras.as.opensocial.model.ActivityObject;
+
+public class ActivityObjectImpl implements ActivityObject {
+
+ private String id;
+ private String displayName;
+ private String summary;
+ private String permalink;
+ private String image;
+ private List<String> objectType;
+ private String content;
+ private String audioStream;
+ private String videoStream;
+ private String playerApplet;
+ private String bookmarkTarget;
+ private String thumbnail;
+ private String subject;
+ private String description;
+ private String rating;
+ private String icon;
+ private ActivityObject inReplyTo;
+
+ public ActivityObjectImpl() {
+ this.id = null;
+ this.displayName = null;
+ this.summary = null;
+ this.permalink = null;
+ this.image = null;
+ this.content = null;
+ this.audioStream = null;
+ this.videoStream = null;
+ this.playerApplet = null;
+ this.bookmarkTarget = null;
+ this.thumbnail = null;
+ this.subject = null;
+ this.description = null;
+ this.rating = null;
+ this.icon = null;
+ this.objectType = null;
+ this.inReplyTo = null;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+
+ public String getPermalink() {
+ return permalink;
+ }
+
+ public void setPermalink(String permalink) {
+ this.permalink = permalink;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getAudioStream() {
+ return audioStream;
+ }
+
+ public void setAudioStream(String audioStream) {
+ this.audioStream = audioStream;
+ }
+
+ public String getVideoStream() {
+ return videoStream;
+ }
+
+ public void setVideoStream(String videoStream) {
+ this.videoStream = videoStream;
+ }
+
+ public String getPlayerApplet() {
+ return playerApplet;
+ }
+
+ public void setPlayerApplet(String playerApplet) {
+ this.playerApplet = playerApplet;
+ }
+
+ public String getBookmarkTarget() {
+ return bookmarkTarget;
+ }
+
+ public void setBookmarkTarget(String bookmarkTarget) {
+ this.bookmarkTarget = bookmarkTarget;
+ }
+
+ public String getThumbnail() {
+ return thumbnail;
+ }
+
+ public void setThumbnail(String thumbnail) {
+ this.thumbnail = thumbnail;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getRating() {
+ return rating;
+ }
+
+ public void setRating(String rating) {
+ this.rating = rating;
+ }
+
+ public String getIcon() {
+ return icon;
+ }
+
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+
+ public List<String> getObjectType() {
+ return objectType;
+ }
+
+ public void setObjectType(List<String> objectType) {
+ this.objectType = objectType;
+ }
+
+ public ActivityObject getInReplyTo() {
+ return inReplyTo;
+ }
+
+ public void setInReplyTo(ActivityObject inReplyTo) {
+ this.inReplyTo = inReplyTo;
+ }
+}
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityStreamImpl.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityStreamImpl.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityStreamImpl.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/core/model/ActivityStreamImpl.java Sat May 29 10:46:42 2010
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.shindig.extras.as.core.model;
+
+import java.util.List;
+
+import org.apache.shindig.extras.as.opensocial.model.ActivityEntry;
+import org.apache.shindig.extras.as.opensocial.model.ActivityStream;
+
+public class ActivityStreamImpl implements ActivityStream {
+
+ private String displayName;
+ private String language;
+ private List<ActivityEntry> entries;
+ private String id;
+ private String subject;
+
+ public ActivityStreamImpl() {
+ this.displayName = null;
+ this.language = null;
+ this.entries = null;
+ this.id = null;
+ this.subject = null;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public List<ActivityEntry> getEntries() {
+ return entries;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public void setEntries(List<ActivityEntry> entries) {
+ this.entries = entries;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+}
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityEntry.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityEntry.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityEntry.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityEntry.java Sat May 29 10:46:42 2010
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.shindig.extras.as.opensocial.model;
+
+import java.util.List;
+
+import org.apache.shindig.protocol.model.Exportablebean;
+import org.apache.shindig.extras.as.core.model.ActivityEntryImpl;
+
+import com.google.inject.ImplementedBy;
+
+@ImplementedBy(ActivityEntryImpl.class)
+@Exportablebean
+public interface ActivityEntry {
+
+ /*
+ * Fields that represent JSON elements for an activity entry.
+ */
+ public static enum Field {
+ ID("id"),
+ STREAM_FAVICON_("streamFavicon"),
+ POSTED_TIME("postedTime"),
+ ACTOR("actor"),
+ VERB("verb"),
+ OBJECT("object"),
+ TARGET("target"),
+ PERMALINK_("permalink"),
+ TITLE("title"),
+ BODY("body");
+
+ /*
+ * The name of the JSON element.
+ */
+ private final String jsonString;
+
+ /*
+ * Constructs the field base for the JSON element.
+ *
+ * @param jsonString the name of the element
+ */
+ private Field(String jsonString) {
+ this.jsonString = jsonString;
+ }
+
+ /*
+ * Returns the name of the JSON element.
+ *
+ * @return String the name of the JSON element
+ */
+ public String toString() {
+ return jsonString;
+ }
+ }
+
+ /*
+ * Possible verbs for an activity stream entry.
+ */
+ public static enum Verb {
+ MARK_AS_FAVORITE("markAsFavorite"),
+ START_FOLLOWING("startFollowing"),
+ MARK_AS_LIKED("markAsLiked"),
+ MAKE_FRIEND("makeFriend"),
+ JOIN("join"),
+ PLAY("play"),
+ POST("post"),
+ SAVE("save"),
+ SHARE("share"),
+ TAG("tag"),
+ UPDATE("update");
+
+ /*
+ * The name of the JSON element.
+ */
+ private final String jsonString;
+
+ /*
+ * Constructs the field base for the JSON element.
+ *
+ * @param jsonString the name of the element
+ */
+ private Verb(String jsonString) {
+ this.jsonString = jsonString;
+ }
+
+ /*
+ * Returns the name of the JSON element.
+ *
+ * @return String the name of the JSON element
+ */
+ public String toString() {
+ return jsonString;
+ }
+ }
+
+ void setId(String id);
+
+ String getId();
+
+ void setStreamFavicon(String streamFavicon);
+
+ String getStreamFavicon();
+
+ void setPostedTime(String postedTime);
+
+ String getPostedTime();
+
+ void setActor(ActivityObject actor);
+
+ ActivityObject getActor();
+
+ void setVerb(List<String> verb);
+
+ List<String> getVerb();
+
+ void setObject(ActivityObject object);
+
+ ActivityObject getObject();
+
+ void setTarget(ActivityObject target);
+
+ ActivityObject getTarget();
+
+ void setPermalink(String permalink);
+
+ String getPermalink();
+
+ void setTitle(String title);
+
+ String getTitle();
+
+ void setBody(String body);
+
+ String getBody();
+}
\ No newline at end of file
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityObject.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityObject.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityObject.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityObject.java Sat May 29 10:46:42 2010
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.shindig.extras.as.opensocial.model;
+
+import java.util.List;
+
+import org.apache.shindig.protocol.model.Exportablebean;
+import org.apache.shindig.extras.as.core.model.ActivityObjectImpl;
+
+import com.google.inject.ImplementedBy;
+
+@ImplementedBy(ActivityObjectImpl.class)
+@Exportablebean
+public interface ActivityObject {
+
+ /*
+ * Fields that represent JSON elements for an activity entry.
+ */
+ public static enum Field {
+ ID("id"),
+ DISPLAY_NAME("displayName"),
+ SUMMARY("summary"),
+ PERMALINK("permalink"),
+ IMAGE("image"),
+ CONTENT("content"),
+ AUDIO_STREAM("audioStream"),
+ VIDEO_STREAM("videoStream"),
+ PLAYER_APPLET("playerApplet"),
+ BOOKMARK_TARGET("bookmarkTarget"),
+ THUMBNAIL("thumbnail"),
+ SUBJECT("subject"),
+ DESCRIPTION("description"),
+ RATING("rating"),
+ ICON("icon"),
+ IN_REPLY_TO("inReplyTo"),
+ OBJECT_TYPE("objectType");
+
+ /*
+ * The name of the JSON element.
+ */
+ private final String jsonString;
+
+ /*
+ * Constructs the field base for the JSON element.
+ *
+ * @param jsonString the name of the element
+ */
+ private Field(String jsonString) {
+ this.jsonString = jsonString;
+ }
+
+ /*
+ * Returns the name of the JSON element.
+ *
+ * @return String the name of the JSON element
+ */
+ public String toString() {
+ return jsonString;
+ }
+ }
+
+ String getId();
+
+ void setId(String id);
+
+ String getDisplayName();
+
+ void setDisplayName(String displayName);
+
+ String getSummary();
+
+ void setSummary(String summary);
+
+ String getPermalink();
+
+ void setPermalink(String permalink);
+
+ String getImage();
+
+ void setImage(String image);
+
+ String getContent();
+
+ void setContent(String content);
+
+ String getAudioStream();
+
+ void setAudioStream(String audioStream);
+
+ String getVideoStream();
+
+ void setVideoStream(String videoStream);
+
+ String getPlayerApplet();
+
+ void setPlayerApplet(String playerApplet);
+
+ String getBookmarkTarget();
+
+ void setBookmarkTarget(String bookmarkTarget);
+
+ String getThumbnail();
+
+ void setThumbnail(String thumbnail);
+
+ String getSubject();
+
+ void setSubject(String subject);
+
+ String getDescription();
+
+ void setDescription(String description);
+
+ String getRating();
+
+ void setRating(String rating);
+
+ String getIcon();
+
+ void setIcon(String icon);
+
+ List<String> getObjectType();
+
+ void setObjectType(List<String> objectType);
+
+ ActivityObject getInReplyTo();
+
+ void setInReplyTo(ActivityObject inReplyTo);
+}
\ No newline at end of file
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityStream.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityStream.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityStream.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/model/ActivityStream.java Sat May 29 10:46:42 2010
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.apache.shindig.extras.as.opensocial.model;
+
+import java.util.List;
+
+import org.apache.shindig.protocol.model.Exportablebean;
+import org.apache.shindig.extras.as.core.model.ActivityStreamImpl;
+
+import com.google.inject.ImplementedBy;
+
+/*
+ * Interface for an Activity Stream.
+ * <p>
+ * See the Activity Streams specification for more detail:
+ * http://activitystrea.ms/
+ */
+@ImplementedBy(ActivityStreamImpl.class)
+@Exportablebean
+public interface ActivityStream {
+
+ /*
+ * Fields that represent JSON elements for an activity entry.
+ */
+ public static enum Field {
+ DISPLAY_NAME("displayName"),
+ LANGUAGE("language"),
+ ENTRIES("entries"),
+ ID("id"),
+ SUBJECT("subject");
+
+ /*
+ * The name of the JSON element.
+ */
+ private final String jsonString;
+
+ /*
+ * Constructs the field base for the JSON element.
+ *
+ * @param jsonString the name of the element
+ */
+ private Field(String jsonString) {
+ this.jsonString = jsonString;
+ }
+
+ /*
+ * Returns the name of the JSON element.
+ *
+ * @return String the name of the JSON element
+ */
+ public String toString() {
+ return jsonString;
+ }
+ }
+
+ void setId(String id);
+
+ String getId();
+
+ void setEntries(List<ActivityEntry> entries);
+
+ List<ActivityEntry> getEntries();
+
+ void setLanguage(String language);
+
+ String getLanguage();
+
+ void setSubject(String subject);
+
+ String getSubject();
+
+ void setDisplayName(String displayName);
+
+ String getDisplayName();
+}
\ No newline at end of file
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/service/ActivityStreamsHandler.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/service/ActivityStreamsHandler.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/service/ActivityStreamsHandler.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/service/ActivityStreamsHandler.java Sat May 29 10:46:42 2010
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.extras.as.opensocial.service;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.apache.shindig.config.ContainerConfig;
+import org.apache.shindig.extras.as.opensocial.spi.ActivityStreamService;
+import org.apache.shindig.protocol.HandlerPreconditions;
+import org.apache.shindig.protocol.Operation;
+import org.apache.shindig.protocol.ProtocolException;
+import org.apache.shindig.protocol.RequestItem;
+import org.apache.shindig.protocol.Service;
+import org.apache.shindig.extras.as.opensocial.model.ActivityEntry;
+import org.apache.shindig.social.opensocial.service.SocialRequestItem;
+import org.apache.shindig.social.opensocial.spi.CollectionOptions;
+import org.apache.shindig.social.opensocial.spi.UserId;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
+
+@Service(name = "activitystreams", path="/{userId}+/{groupId}/{appId}/{activitystream}/{activityEntryId}+")
+public class ActivityStreamsHandler {
+
+ private final ActivityStreamService service;
+ private final ContainerConfig config;
+
+ @Inject
+ public ActivityStreamsHandler(ActivityStreamService service, ContainerConfig config) {
+ this.service = service;
+ this.config = config;
+ }
+
+ /**
+ * Allowed end-points /activities/{userId}/@self/{actvityId}+
+ *
+ * examples: /activities/john.doe/@self/1
+ */
+ @Operation(httpMethods="DELETE")
+ public Future<?> delete(SocialRequestItem request)
+ throws ProtocolException {
+
+ Set<UserId> userIds = request.getUsers();
+ Set<String> activityEntryIds = ImmutableSet.copyOf(request.getListParameter("activityEntryId"));
+
+ HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
+ HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
+ // Throws exceptions if userIds contains more than one element or zero elements
+ return service.deleteActivityEntries(Iterables.getOnlyElement(userIds), request.getGroup(),
+ request.getAppId(), activityEntryIds, request.getToken());
+ }
+
+ /**
+ * Allowed end-points /activities/{userId}/@self
+ *
+ * examples: /activities/john.doe/@self - postBody is an activity object
+ *
+ * TODO: REST end-point
+ */
+ @Operation(httpMethods="PUT", bodyParam = "activityEntry")
+ public Future<?> update(SocialRequestItem request) throws ProtocolException {
+ return create(request);
+ }
+
+ /**
+ * Allowed end-points /activities/{userId}/@self
+ *
+ * examples: /activities/john.doe/@self - postBody is an activity object
+ *
+ * TODO: REST end-point
+ */
+ @Operation(httpMethods="POST", bodyParam = "activityEntry")
+ public Future<?> create(SocialRequestItem request) throws ProtocolException {
+ Set<UserId> userIds = request.getUsers();
+ List<String> activityEntryIds = request.getListParameter("activityEntryId");
+
+ HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
+ HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
+ // TODO(lryan) This seems reasonable to allow on PUT but we don't have an update verb.
+ HandlerPreconditions.requireEmpty(activityEntryIds, "Cannot specify activityEntryId in create");
+
+ return service.createActivityEntry(Iterables.getOnlyElement(userIds), request.getGroup(),
+ request.getAppId(), request.getFields(),
+ request.getTypedParameter("activityEntry", ActivityEntry.class),
+ request.getToken());
+ }
+
+ /**
+ * Allowed end-points /activities/{userId}/{groupId}/{optionalActvityId}+
+ * /activities/{userId}+/{groupId}
+ *
+ * examples: /activities/john.doe/@self/1 /activities/john.doe/@self
+ * /activities/john.doe,jane.doe/@friends
+ */
+ @Operation(httpMethods="GET")
+ public Future<?> get(SocialRequestItem request)
+ throws ProtocolException {
+ Set<UserId> userIds = request.getUsers();
+ Set<String> optionalActivityIds = ImmutableSet.copyOf(request.getListParameter("activityEntryId"));
+
+ CollectionOptions options = new CollectionOptions(request);
+
+ // Preconditions
+ HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
+ if (userIds.size() > 1 && !optionalActivityIds.isEmpty()) {
+ throw new IllegalArgumentException("Cannot fetch same activityEntryIds for multiple userIds");
+ }
+
+ if (!optionalActivityIds.isEmpty()) {
+ if (optionalActivityIds.size() == 1) {
+ return service.getActivityEntry(userIds.iterator().next(), request.getGroup(),
+ request.getAppId(), request.getFields(), optionalActivityIds.iterator().next(),
+ request.getToken());
+ } else {
+ return service.getActivityEntries(userIds.iterator().next(), request.getGroup(),
+ request.getAppId(), request.getFields(), options, optionalActivityIds, request.getToken());
+ }
+ }
+
+ return service.getActivityEntries(userIds, request.getGroup(),
+ request.getAppId(),
+ // TODO: add pagination and sorting support
+ // getSortBy(params), getFilterBy(params), getStartIndex(params), getCount(params),
+ request.getFields(), options, request.getToken());
+ }
+
+ @Operation(httpMethods = "GET", path="/@supportedFields")
+ public List<Object> supportedFields(RequestItem request) {
+ // TODO: Would be nice if name in config matched name of service.
+ String container = firstNonNull(request.getToken().getContainer(), ContainerConfig.DEFAULT_CONTAINER);
+ return config.getList(container,
+ "${Cur['gadgets.features'].opensocial.supportedFields.activitystream}");
+ }
+
+ private static <T> T firstNonNull(T first, T second) {
+ return first != null ? first : Preconditions.checkNotNull(second);
+ }
+}
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/spi/ActivityStreamService.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/spi/ActivityStreamService.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/spi/ActivityStreamService.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/opensocial/spi/ActivityStreamService.java Sat May 29 10:46:42 2010
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.extras.as.opensocial.spi;
+
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.apache.shindig.auth.SecurityToken;
+import org.apache.shindig.protocol.ProtocolException;
+import org.apache.shindig.protocol.RestfulCollection;
+import org.apache.shindig.extras.as.opensocial.model.ActivityEntry;
+import org.apache.shindig.social.opensocial.spi.CollectionOptions;
+import org.apache.shindig.social.opensocial.spi.GroupId;
+import org.apache.shindig.social.opensocial.spi.UserId;
+
+/**
+ * The ActivityService interface defines the service provider interface to retrieve activities from
+ * the underlying SNS.
+ */
+public interface ActivityStreamService {
+
+ /**
+ * Returns a list of activities that correspond to the passed in users and group.
+ *
+ * @param userIds The set of ids of the people to fetch activities for.
+ * @param groupId Indicates whether to fetch activities for a group.
+ * @param appId The app id.
+ * @param fields The fields to return. Empty set implies all
+ * @param options The sorting/filtering/pagination options
+ * @param token A valid SecurityToken
+ * @return a response item with the list of activities.
+ */
+ Future<RestfulCollection<ActivityEntry>> getActivityEntries(Set<UserId> userIds,
+ GroupId groupId, String appId, Set<String> fields, CollectionOptions options, SecurityToken token)
+ throws ProtocolException;
+
+ /**
+ * Returns a set of activities for the passed in user and group that corresponds to a list of
+ * activityIds.
+ *
+ * @param userId The set of ids of the people to fetch activities for.
+ * @param groupId Indicates whether to fetch activities for a group.
+ * @param appId The app id.
+ * @param fields The fields to return. Empty set implies all
+ * @param options The sorting/filtering/pagination options
+ * @param activityIds The set of activity ids to fetch.
+ * @param token A valid SecurityToken
+ * @return a response item with the list of activities.
+ */
+ Future<RestfulCollection<ActivityEntry>> getActivityEntries(UserId userId, GroupId groupId,
+ String appId, Set<String> fields, CollectionOptions options, Set<String> activityIds, SecurityToken token)
+ throws ProtocolException;
+
+
+ /**
+ * Returns an activity for the passed in user and group that corresponds to a single
+ * activityId.
+ *
+ * @param userId The set of ids of the people to fetch activities for.
+ * @param groupId Indicates whether to fetch activities for a group.
+ * @param appId The app id.
+ * @param fields The fields to return. Empty set implies all
+ * @param activityId The activity id to fetch.
+ * @param token A valid SecurityToken
+ * @return a response item with the list of activities.
+ */
+ Future<ActivityEntry> getActivityEntry(UserId userId, GroupId groupId, String appId,
+ Set<String> fields, String activityId, SecurityToken token)
+ throws ProtocolException;
+
+ /**
+ * Deletes the activity for the passed in user and group that corresponds to the activityId.
+ *
+ * @param userId The user.
+ * @param groupId The group.
+ * @param appId The app id.
+ * @param activityIds A list of activity ids to delete.
+ * @param token A valid SecurityToken.
+ * @return a response item containing any errors
+ */
+ Future<Void> deleteActivityEntries(UserId userId, GroupId groupId, String appId,
+ Set<String> activityIds, SecurityToken token) throws ProtocolException;
+
+ /**
+ * Creates the passed in activity for the passed in user and group. Once createActivity is called,
+ * getActivities will be able to return the Activity.
+ *
+ * @param userId The id of the person to create the activity for.
+ * @param groupId The group.
+ * @param appId The app id.
+ * @param fields The fields to return.
+ * @param activity The activity to create.
+ * @param token A valid SecurityToken
+ * @return a response item containing any errors
+ */
+ Future<Void> createActivityEntry(UserId userId, GroupId groupId, String appId,
+ Set<String> fields, ActivityEntry activity, SecurityToken token) throws ProtocolException;
+}
Added: shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/sample/ActivityStreamsJsonDbService.java
URL: http://svn.apache.org/viewvc/shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/sample/ActivityStreamsJsonDbService.java?rev=949378&view=auto
==============================================================================
--- shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/sample/ActivityStreamsJsonDbService.java (added)
+++ shindig/trunk/extras/src/main/java/org/apache/shindig/extras/as/sample/ActivityStreamsJsonDbService.java Sat May 29 10:46:42 2010
@@ -0,0 +1,193 @@
+package org.apache.shindig.extras.as.sample;
+
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.shindig.auth.SecurityToken;
+import org.apache.shindig.common.util.ImmediateFuture;
+import org.apache.shindig.extras.as.opensocial.model.ActivityEntry;
+import org.apache.shindig.extras.as.opensocial.model.ActivityObject;
+import org.apache.shindig.extras.as.opensocial.spi.ActivityStreamService;
+import org.apache.shindig.protocol.ProtocolException;
+import org.apache.shindig.protocol.RestfulCollection;
+import org.apache.shindig.protocol.conversion.BeanConverter;
+import org.apache.shindig.social.opensocial.spi.CollectionOptions;
+import org.apache.shindig.social.opensocial.spi.GroupId;
+import org.apache.shindig.social.opensocial.spi.UserId;
+import org.apache.shindig.social.sample.spi.JsonDbOpensocialService;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+public class ActivityStreamsJsonDbService implements ActivityStreamService {
+ JsonDbOpensocialService jsonDb;
+ JSONObject db;
+ BeanConverter converter;
+
+ @Inject
+ public ActivityStreamsJsonDbService(JsonDbOpensocialService jsonDb,
+ @Named("shindig.bean.converter.json")
+ BeanConverter converter) {
+ this.jsonDb = jsonDb;
+ this.db = jsonDb.getDb();
+ this.converter = converter;
+ }
+
+
+ /**
+ * db["people"] -> Map<Person.Id, Array<ActivityEntry>>
+ */
+ private static final String ACTIVITYSTREAMS_TABLE = "activityEntries";
+
+
+ // Are fields really needed here?
+ public Future<Void> createActivityEntry(UserId userId, GroupId groupId, String appId,
+ Set<String> fields, ActivityEntry activityEntry, SecurityToken token) throws ProtocolException {
+ try {
+ JSONObject jsonObject = convertFromActivityEntry(activityEntry, fields);
+ if (!jsonObject.has(ActivityEntry.Field.ID.toString())) {
+ jsonObject.put(ActivityEntry.Field.ID.toString(), System.currentTimeMillis());
+ }
+
+ // TODO: bug fixed: jsonArray will not be null; will throw exception!
+ // Fix in createActivity()
+ JSONArray jsonArray;
+ if(db.getJSONObject(ACTIVITYSTREAMS_TABLE).has(userId.getUserId(token))) {
+ jsonArray = db.getJSONObject(ACTIVITYSTREAMS_TABLE)
+ .getJSONArray(userId.getUserId(token));
+ } else {
+ jsonArray = new JSONArray();
+ db.getJSONObject(ACTIVITYSTREAMS_TABLE).put(userId.getUserId(token), jsonArray);
+ }
+ jsonArray.put(jsonObject);
+ return ImmediateFuture.newInstance(null);
+ } catch (JSONException je) {
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ je);
+ }
+ }
+
+ public Future<Void> deleteActivityEntries(UserId userId, GroupId groupId,
+ String appId, Set<String> activityIds, SecurityToken token)
+ throws ProtocolException {
+ try {
+ String user = userId.getUserId(token);
+ if (db.getJSONObject(ACTIVITYSTREAMS_TABLE).has(user)) {
+ JSONArray activityEntries = db.getJSONObject(ACTIVITYSTREAMS_TABLE).getJSONArray(user);
+ if (activityEntries != null) {
+ JSONArray newList = new JSONArray();
+ for (int i = 0; i < activityEntries.length(); i++) {
+ JSONObject activityEntry = activityEntries.getJSONObject(i);
+ if (!activityIds.contains(activityEntry.getString(ActivityEntry.Field.ID.toString()))) {
+ newList.put(activityEntry);
+ }
+ }
+ db.getJSONObject(ACTIVITYSTREAMS_TABLE).put(user, newList);
+ // TODO: This seems very odd that we return no useful response in this
+ // case
+ // There is no way to represent not-found
+ // if (found) { ??
+ // }
+ }
+ }
+ // What is the appropriate response here??
+ return ImmediateFuture.newInstance(null);
+ } catch (JSONException je) {
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ je);
+ }
+ }
+
+ public Future<ActivityEntry> getActivityEntry(UserId userId, GroupId groupId,
+ String appId, Set<String> fields, String activityId, SecurityToken token)
+ throws ProtocolException {
+ try {
+ String user = userId.getUserId(token);
+ if (db.getJSONObject(ACTIVITYSTREAMS_TABLE).has(user)) {
+ JSONArray activityEntries = db.getJSONObject(ACTIVITYSTREAMS_TABLE).getJSONArray(user);
+ for (int i = 0; i < activityEntries.length(); i++) {
+ JSONObject activityEntry = activityEntries.getJSONObject(i);
+ JSONObject actor = new JSONObject(activityEntry.get(ActivityEntry.Field.ACTOR.toString()).toString());
+ String actorId = actor.get(ActivityObject.Field.ID.toString()).toString();
+ if (actorId.equals(user)
+ && activityEntry.get(ActivityEntry.Field.ID.toString()).toString().equals(activityId)) {
+ return ImmediateFuture.newInstance(jsonDb.filterFields(activityEntry, fields, ActivityEntry.class));
+ }
+ }
+ }
+
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "ActivityEntry not found");
+ } catch (JSONException je) {
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ je);
+ }
+ }
+
+ public Future<RestfulCollection<ActivityEntry>> getActivityEntries(
+ Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields,
+ CollectionOptions options, SecurityToken token)
+ throws ProtocolException {
+ List<ActivityEntry> result = Lists.newArrayList();
+
+ try {
+ Set<String> idSet = jsonDb.getIdSet(userIds, groupId, token);
+ for (String id : idSet) {
+ if (db.getJSONObject(ACTIVITYSTREAMS_TABLE).has(id)) {
+ JSONArray activityEntries = db.getJSONObject(ACTIVITYSTREAMS_TABLE).getJSONArray(id);
+ for (int i = 0; i < activityEntries.length(); i++) {
+ JSONObject activityEntry = activityEntries.getJSONObject(i);
+ result.add(jsonDb.filterFields(activityEntry, fields, ActivityEntry.class));
+ // TODO: ActivityStreams don't have appIds
+// if (appId == null || !activitystream.has(ActivityStream.Field.APP_ID.toString())) {
+// result.add(filterFields(activitystream, fields, ActivityStream.class));
+// } else if (activitystream.get(ActivityStream.Field.APP_ID.toString()).equals(appId)) {
+// result.add(filterFields(activitystream, fields, ActivityStream.class));
+// }
+ }
+ }
+ }
+ return ImmediateFuture.newInstance(new RestfulCollection<ActivityEntry>(result));
+ } catch (JSONException je) {
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ je);
+ }
+ }
+
+ public Future<RestfulCollection<ActivityEntry>> getActivityEntries(
+ UserId userId, GroupId groupId, String appId, Set<String> fields,
+ CollectionOptions options, Set<String> activityIds, SecurityToken token)
+ throws ProtocolException {
+ List<ActivityEntry> result = Lists.newArrayList();
+ try {
+ String user = userId.getUserId(token);
+ if (db.getJSONObject(ACTIVITYSTREAMS_TABLE).has(user)) {
+ JSONArray activityEntries = db.getJSONObject(ACTIVITYSTREAMS_TABLE).getJSONArray(user);
+ for (int i = 0; i < activityEntries.length(); i++) {
+ JSONObject activityEntry = activityEntries.getJSONObject(i);
+ JSONObject actor = new JSONObject(activityEntry.get(ActivityEntry.Field.ACTOR.toString()));
+ String actorId = actor.get(ActivityObject.Field.ID.toString()).toString();
+ if (actorId.equals(user)
+ && activityIds.contains(activityEntry.getString(ActivityEntry.Field.ID.toString()).toString())) {
+ result.add(jsonDb.filterFields(activityEntry, fields, ActivityEntry.class));
+ }
+ }
+ }
+ return ImmediateFuture.newInstance(new RestfulCollection<ActivityEntry>(result));
+ } catch (JSONException je) {
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ je);
+ }
+ }
+
+ private JSONObject convertFromActivityEntry(ActivityEntry activityEntry, Set<String> fields)
+ throws JSONException {
+ // TODO Not using fields yet
+ return new JSONObject(converter.convertToString(activityEntry));
+ }
+
+}
Modified: shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml?rev=949378&r1=949377&r2=949378&view=diff
==============================================================================
--- shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml (original)
+++ shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml Sat May 29 10:46:42 2010
@@ -26,6 +26,7 @@
<display-name>Shindig</display-name>
<!-- configuration -->
<!-- If you have your own Guice module(s), put them here as a colon-separated list. -->
+ <!-- Note that any extras modules are optional -->
<context-param>
<param-name>guice-modules</param-name>
<param-value>
@@ -36,7 +37,8 @@
org.apache.shindig.gadgets.oauth.OAuthModule:
org.apache.shindig.common.cache.ehcache.EhCacheModule:
org.apache.shindig.sample.shiro.ShiroModule:
- org.apache.shindig.extras.ShindigExtrasGuiceModule
+ org.apache.shindig.extras.ShindigExtrasGuiceModule:
+ org.apache.shindig.extras.as.ActivityStreamsGuiceModule
</param-value>
</context-param>
Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java?rev=949378&r1=949377&r2=949378&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java Sat May 29 10:46:42 2010
@@ -17,6 +17,12 @@
*/
package org.apache.shindig.social.core.util.xstream;
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.apache.shindig.protocol.DataCollection;
import org.apache.shindig.protocol.RestfulCollection;
import org.apache.shindig.protocol.conversion.xstream.ClassFieldMapping;
@@ -69,12 +75,6 @@ import com.thoughtworks.xstream.io.Hiera
import com.thoughtworks.xstream.mapper.AttributeMapper;
import com.thoughtworks.xstream.mapper.Mapper;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
/**
* Opensocial 0.81 compliant Xstream binding
*/
@@ -135,6 +135,7 @@ public class XStream081Configuration imp
.put("feed", atom)
.put("person", os)
.put("activity", os)
+ .put("activityStream", os)
.put("account", os)
.put("address", os)
.put("bodyType", os)
@@ -154,6 +155,7 @@ public class XStream081Configuration imp
new ClassFieldMapping("content", AtomContent.class),
new ClassFieldMapping("activity", Activity.class),
+// AS TODO new ClassFieldMapping("activityStream", ActivityStream.class),
new ClassFieldMapping("account", Account.class),
new ClassFieldMapping("address", Address.class),
new ClassFieldMapping("bodyType", BodyType.class),
@@ -188,6 +190,7 @@ public class XStream081Configuration imp
new ClassFieldMapping("content", AtomContent.class),
new ClassFieldMapping("activity", Activity.class),
+// AS TODO new ClassFieldMapping("activityStream", ActivityStream.class),
new ClassFieldMapping("account", Account.class),
new ClassFieldMapping("address", Address.class),
new ClassFieldMapping("bodyType", BodyType.class),
@@ -223,6 +226,7 @@ public class XStream081Configuration imp
.put("map", ConcurrentHashMap.class)
.put("appdata", DataCollection.class)
.put("activity", Activity.class)
+// AS TODO .put("activityStream", ActivityStream.class)
.put("account", Account.class)
.put("address", Address.class)
.put("bodyType", BodyType.class)