You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by wo...@apache.org on 2011/05/20 17:43:12 UTC

svn commit: r1125436 - in /shindig/trunk: content/sampledata/ java/social-api/src/main/java/org/apache/shindig/social/core/model/ java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/ java/social-api/src/main/java/org/apache/shindi...

Author: woodser
Date: Fri May 20 15:43:12 2011
New Revision: 1125436

URL: http://svn.apache.org/viewvc?rev=1125436&view=rev
Log:
Committing Ryan Baxter's patch to enable Embedded Experience via Activity Streams.

https://reviews.apache.org/r/764/

Added:
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/EmbeddedExperienceImpl.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/EmbeddedExperience.java
Modified:
    shindig/trunk/content/sampledata/canonicaldb.json
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ExtensionImpl.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Extension.java
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonDelete.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonGroup.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonIds.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml

Modified: shindig/trunk/content/sampledata/canonicaldb.json
URL: http://svn.apache.org/viewvc/shindig/trunk/content/sampledata/canonicaldb.json?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/content/sampledata/canonicaldb.json (original)
+++ shindig/trunk/content/sampledata/canonicaldb.json Fri May 20 15:43:12 2011
@@ -425,6 +425,13 @@
             "width": 250,
             "height": 250
           }
+        },
+        "openSocial": {
+          "embed": {
+            "url": "http://example.org/album/",
+            "gadget": "http://example.org/albumViewer.xml",
+            "context": "1234"
+          }
         }
       }]
 },

Added: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/EmbeddedExperienceImpl.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/EmbeddedExperienceImpl.java?rev=1125436&view=auto
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/EmbeddedExperienceImpl.java (added)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/EmbeddedExperienceImpl.java Fri May 20 15:43:12 2011
@@ -0,0 +1,61 @@
+package org.apache.shindig.social.core.model;
+
+import org.apache.shindig.social.opensocial.model.EmbeddedExperience;
+
+/**
+ * Embedded experience implementation.
+ *
+ */
+public class EmbeddedExperienceImpl implements EmbeddedExperience {
+	
+	private Object context;
+	private String gadget;
+	private String previewImage;
+	private String url;
+	
+	/**
+	 * Constructor
+	 */
+	public EmbeddedExperienceImpl(){}
+
+	/** {@inheritDoc} */
+	public Object getContext() {
+		return context;
+	}
+
+	/** {@inheritDoc} */
+	public String getGadget() {
+		return gadget;
+	}
+
+	/** {@inheritDoc} */
+	public String getPreviewImage() {
+		return previewImage;
+	}
+	
+	/** {@inheritDoc} */
+	public String getUrl(){
+		return url;
+	}
+
+	/** {@inheritDoc} */
+	public void setContext(Object context) {
+		this.context = context;
+	}
+
+	/** {@inheritDoc} */
+	public void setGadget(String gadget) {
+		this.gadget = gadget;
+	}
+
+	/** {@inheritDoc} */
+	public void setPreviewImage(String previewImage) {
+		this.previewImage = previewImage;
+	}
+	
+	/** {@inheritDoc} */
+	public void setUrl(String url){
+		this.url = url;
+	}
+
+}

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ExtensionImpl.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ExtensionImpl.java?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ExtensionImpl.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ExtensionImpl.java Fri May 20 15:43:12 2011
@@ -1,10 +1,29 @@
 package org.apache.shindig.social.core.model;
 
+import org.apache.shindig.social.opensocial.model.EmbeddedExperience;
 import org.apache.shindig.social.opensocial.model.Extension;
 
 /**
  * Extension namespace implementation.
  */
 public class ExtensionImpl implements Extension {
+	
+	//Embedded experience extension
+	private EmbeddedExperience embed;
+	
+	/**
+	 * Constructor
+	 */
+	public ExtensionImpl(){}
+	
+	/** {@inheritDoc} */
+	public EmbeddedExperience getEmbed() {
+		return embed;
+	}
+
+	/** {@inheritDoc} */
+	public void setEmbed(EmbeddedExperience embed) {
+		this.embed = embed;
+	}
 
 }

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=1125436&r1=1125435&r2=1125436&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 Fri May 20 15:43:12 2011
@@ -51,13 +51,14 @@ import org.apache.shindig.social.opensoc
 import org.apache.shindig.social.opensocial.model.ActivityObject;
 import org.apache.shindig.social.opensocial.model.Address;
 import org.apache.shindig.social.opensocial.model.BodyType;
+import org.apache.shindig.social.opensocial.model.EmbeddedExperience;
+import org.apache.shindig.social.opensocial.model.Extension;
 import org.apache.shindig.social.opensocial.model.ListField;
 import org.apache.shindig.social.opensocial.model.MediaItem;
 import org.apache.shindig.social.opensocial.model.MediaLink;
 import org.apache.shindig.social.opensocial.model.Message;
 import org.apache.shindig.social.opensocial.model.MessageCollection;
 import org.apache.shindig.social.opensocial.model.Name;
-import org.apache.shindig.social.opensocial.model.Extension;
 import org.apache.shindig.social.opensocial.model.Organization;
 import org.apache.shindig.social.opensocial.model.Person;
 import org.apache.shindig.social.opensocial.model.Url;
@@ -175,6 +176,7 @@ public class XStream081Configuration imp
         new ClassFieldMapping("person", Person.class),
         new ClassFieldMapping("url", Url.class),
         new ClassFieldMapping("openSocial", Extension.class),
+        new ClassFieldMapping("embed", EmbeddedExperience.class),
         // this is an example of a class field mapping with context. If
         // ListField is mapped inside an element named emails, replace the element
         // name
@@ -214,6 +216,7 @@ public class XStream081Configuration imp
         new ClassFieldMapping("person", Person.class),
         new ClassFieldMapping("url", Url.class),
         new ClassFieldMapping("openSocial", Extension.class),
+        new ClassFieldMapping("embed", EmbeddedExperience.class),
         // this is an example of a class field mapping with context. If
         // ListField is mapped inside an element named emails, replace the element
         // name that would have been defiend as fqcn ListField with email
@@ -254,6 +257,7 @@ public class XStream081Configuration imp
         .put("person", Person.class)
         .put("url", Url.class)
         .put("openSocial", Extension.class)
+        .put("embed", EmbeddedExperience.class)
         .put("listField", ListField.class).build()
     );
 

Added: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/EmbeddedExperience.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/EmbeddedExperience.java?rev=1125436&view=auto
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/EmbeddedExperience.java (added)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/EmbeddedExperience.java Fri May 20 15:43:12 2011
@@ -0,0 +1,110 @@
+package org.apache.shindig.social.opensocial.model;
+
+import org.apache.shindig.protocol.model.Exportablebean;
+import org.apache.shindig.social.core.model.EmbeddedExperienceImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * Represents an embedded experience that may be inlined.
+ * 
+ */
+@ImplementedBy(EmbeddedExperienceImpl.class)
+@Exportablebean
+public interface EmbeddedExperience {
+
+  /**
+   * Fields that represent JSON elements for an embedded experience.
+   */
+  public static enum Field {
+    GADGET("gadget"), CONTEXT("context"), PREVIEWIMAGE("previewImage"), URL("url");
+
+    /*
+     * 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;
+    }
+  }
+
+  /**
+   * Gets the URL to the gadget definition for this embedded experience
+   * 
+   * @return the URL to the gadget definintion for this embedded experience
+   */
+  String getGadget();
+
+  /**
+   * Sets the URL to the gadget definition for this embedded experience
+   * 
+   * @param gadget
+   *          the URL to the gadget definition for this embedded experience
+   */
+  void setGadget(String gadget);
+
+  /**
+   * Gets the contextual data for this embedded experience
+   * 
+   * @return the contextual data for this embedded experience
+   */
+  Object getContext();
+
+  /**
+   * Sets the contextual data for the embedded experience
+   * 
+   * @param context
+   *          the contextual data for this embedded experience
+   */
+  void setContext(Object context);
+
+  /**
+   * Gets the URL to an image that may act as a preview for this embedded
+   * experience
+   * 
+   * @return the URL to an image that may act as a preview for this embedded
+   *         experiece
+   */
+  String getPreviewImage();
+
+  /**
+   * Set the URL to an image that may act as a preview for this embedded
+   * experience
+   * 
+   * @param previewImage
+   *          the URL to an image that may act as a preview for this embedded
+   *          experience
+   */
+  void setPreviewImage(String previewImage);
+
+  /**
+   * Gets the URL that may be used as an embedded experience
+   * 
+   * @return the URL that may be used as an embedded experience
+   */
+  String getUrl();
+
+  /**
+   * Sets the URL that may be used as an embedded experience
+   * 
+   * @param url
+   *          the URL that may be used as an embedded experience
+   */
+  void setUrl(String url);
+}

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Extension.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Extension.java?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Extension.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Extension.java Fri May 20 15:43:12 2011
@@ -11,31 +11,47 @@ import com.google.inject.ImplementedBy;
 @ImplementedBy(ExtensionImpl.class)
 @Exportablebean
 public interface Extension {
-	
-	public static enum Field {
-	  ; // No fields to add
-	  
-		/**
-		 * 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;
-		}
-	}
+
+  public static enum Field {
+    EMBED("embed"); // Embedded Experiences
+
+    /**
+     * 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;
+    }
+  }
+
+  /**
+   * Gets the embedded experience for this activity.
+   * 
+   * @return the embedded experience for this activity
+   */
+  EmbeddedExperience getEmbed();
+
+  /**
+   * Sets the emnbedded experience for this activity.
+   * 
+   * @param embed
+   *          the embedded experience to set
+   */
+  void setEmbed(EmbeddedExperience embed);
 }

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml Fri May 20 15:43:12 2011
@@ -66,6 +66,13 @@
         </target>
         <title>John posted a new video to his album.</title>
         <verb>post</verb>
+        <openSocial>
+          <embed>
+            <context>1234</context>
+            <gadget>http://example.org/albumViewer.xml</gadget>
+            <url>http://example.org/album/</url>
+          </embed>
+        </openSocial>
       </activityEntry>
     </content>
   </entry>

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml Fri May 20 15:43:12 2011
@@ -102,6 +102,13 @@
         </target>
         <title>John posted a new video to his album.</title>
         <verb>post</verb>
+        <openSocial>
+          <embed>
+            <context>1234</context>
+            <gadget>http://example.org/albumViewer.xml</gadget>
+            <url>http://example.org/album/</url>
+          </embed>
+        </openSocial>
       </activityEntry>
     </content>
   </entry>

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonDelete.json
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonDelete.json?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonDelete.json (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonDelete.json Fri May 20 15:43:12 2011
@@ -51,6 +51,13 @@
             "width": 250,
             "height": 250
           }
+        },
+        "openSocial":{
+          "embed":{
+            "gadget":"http://example.org/albumViewer.xml",
+            "context":"1234",
+            "url":"http://example.org/album/"
+          }
         }
       }
    ],

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonGroup.json
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonGroup.json?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonGroup.json (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonGroup.json Fri May 20 15:43:12 2011
@@ -77,6 +77,13 @@
             "width": 250,
             "height": 250
           }
+        },
+        "openSocial":{
+          "embed":{
+            "gadget":"http://example.org/albumViewer.xml",
+            "context":"1234",
+            "url":"http://example.org/album/"
+          }
         }
       }
    ],

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonIds.json
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonIds.json?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonIds.json (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonIds.json Fri May 20 15:43:12 2011
@@ -77,6 +77,13 @@
             "width": 250,
             "height": 250
           }
+        },
+        "openSocial":{
+          "embed":{
+            "gadget":"http://example.org/albumViewer.xml",
+            "context":"1234",
+            "url":"http://example.org/album/"
+          }
         }
       }
    ],

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml Fri May 20 15:43:12 2011
@@ -44,6 +44,13 @@
     <upstreamDuplicate>upstream2</upstreamDuplicate>
     <url>http://example.org/album/my_fluffy_cat.jpg</url>
   </object>
+  <openSocial>
+    <embed>
+      <context>1234</context>
+      <gadget>http://example.org/albumViewer.xml</gadget>
+      <url>http://example.org/album/</url>
+    </embed>
+  </openSocial>
   <provider>
 
     <url>http://example.org/activity-stream</url>

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml?rev=1125436&r1=1125435&r2=1125436&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml Fri May 20 15:43:12 2011
@@ -105,6 +105,13 @@
       </target>
       <title>John posted a new video to his album.</title>
       <verb>post</verb>
+      <openSocial>
+        <embed>
+          <context>1234</context>
+          <gadget>http://example.org/albumViewer.xml</gadget>
+          <url>http://example.org/album/</url>
+        </embed>
+      </openSocial>
     </activityEntry>
   </entry>
 </response>
\ No newline at end of file