If you run a social network, you really owe it to your users to investigate OpenSocial as a way of allowing your users to add third-party functionality to their profiles. Shindig (available in a PHP and a Java version) allows you to easily add this capability.

Mac OS X Leopard has Java 1.6 and Maven 2.0.6 installed. I had some build issues with the older Maven so I upgraded to 2.0.9. You also need to ensure that your JAVA_HOME variable is set. You can confirm this by typing the following commands in a terminal:

Trinity:shindig kelvin$ echo $JAVA_HOME
/Library/Java/Home
Trinity:shindig kelvin$ mvn -v
Maven version: 2.0.9
Java version: 1.6.0_07
OS name: "mac os x" version: "10.5.5" arch: "x86_64" Family: "mac"

Then download the code from the main repository:

Trinity:code kelvin$ mkdir shindig
Trinity:code kelvin$ svn co http://svn.apache.org/repos/asf/incubator/shindig/trunk/ ./shindig
A    shindig/NOTICE
A    shindig/java
A    shindig/java/social-api
A    shindig/java/social-api/src
A    shindig/java/social-api/src/test

...la dee da...

A    shindig/features/mocks/env.js
A    shindig/features/mocks/xhr.js
 U   shindig
Checked out revision 707938.

Okay, Shindig has now been downloaded. Let’s build it. You can try building it using ‘mvn clean install’ first and if you get any errors, try turning off the tests. Sometimes the tests can get out of sync with the code. I was able to build it without any problems.

Trinity:shindig kelvin$ mvn clean install
[INFO] Scanning for projects...
[INFO] Reactor build order: 
[INFO]   Apache Shindig Project
[INFO]   Apache Shindig Project Parent
[INFO]   Apache Shindig Common Code
[INFO]   Apache Shindig Gadget Renderer
[INFO]   Apache Shindig Social API
[INFO]   Apache Shindig Features
[INFO]   Apache Shindig Web App
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Shindig Project
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /Users/kelvin/code/shindig/target
[INFO] [site:attach-descriptor]

...etc etc etc...

[INFO] [install:install]
[INFO] Installing /Users/kelvin/code/shindig/java/server/target/shindig-server-1-SNAPSHOT.war to /Users/kelvin/.m2/repository/org/apache/shindig/shindig-server/1-SNAPSHOT/shindig-server-1-SNAPSHOT.war
[INFO] Installing /Users/kelvin/code/shindig/java/server/target/shindig-server-1-SNAPSHOT-sources.jar to /Users/kelvin/.m2/repository/org/apache/shindig/shindig-server/1-SNAPSHOT/shindig-server-1-SNAPSHOT-sources.jar
[INFO] 
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Apache Shindig Project ................................ SUCCESS [6.196s]
[INFO] Apache Shindig Project Parent ......................... SUCCESS [0.531s]
[INFO] Apache Shindig Common Code ............................ SUCCESS [9.470s]
[INFO] Apache Shindig Gadget Renderer ........................ SUCCESS [25.571s]
[INFO] Apache Shindig Social API ............................. SUCCESS [11.381s]
[INFO] Apache Shindig Features ............................... SUCCESS [7.117s]
[INFO] Apache Shindig Web App ................................ SUCCESS [13.737s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 14 seconds
[INFO] Finished at: Sun Nov 09 10:43:56 PST 2008
[INFO] Final Memory: 51M/80M
[INFO] ------------------------------------------------------------------------

or if you want to skip the tests, try this…

Trinity:shindig kelvin$ mvn clean install -Dmaven.test.skip=true

Woot. Now let’s start it up. By default, the server will run on localhost port 8080.

Trinity:shindig kelvin$ mvn -Prun
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'jetty'.
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.1/maven-antrun-plugin-1.1.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugin-parent/2.0.1/maven-plugin-parent-2.0.1.pom
7K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.1/maven-antrun-plugin-1.1.jar
11K downloaded
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Shindig Project
[INFO]    task-segment: [jetty:run-war]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing jetty:run-war


...more more more...

[INFO] Starting jetty 6.1.9 ...
2008-11-09 10:47:45.790::INFO:  jetty-6.1.9
2008-11-09 10:47:45.812::INFO:  Extract jar:file:/Users/kelvin/code/shindig/java/server/target/shindig-server-1-SNAPSHOT.war!/ to /Users/kelvin/code/shindig/target/work/webapp
2008-11-09 10:47:47.372::INFO:  No Transaction manager found - if your webapp requires one, please configure one.
Nov 9, 2008 10:47:48 AM org.apache.shindig.common.JsonContainerConfig loadContainers
INFO: Loading resources from: containers/default/container.js
Nov 9, 2008 10:47:48 AM org.apache.shindig.common.JsonContainerConfig loadResources
INFO: Reading container config: containers/default/container.js
2008-11-09 10:47:48.313::INFO:  Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server

See if you can render anything by opening a web browser and putting the following into the address bar.

http://localhost:8080/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml

If all went well, you should see the To Do list demo.

The To Do Shindig App

The To Do Shindig App