on i4PACE(i for Personal Archiving and Creating Environment)
actions » SearchLogin 89 articles • 30 Jul 2010

Article with comments

Saturday, 05 Apr 2008

permalink Shindig

Started to install Apache Shindig. At http://incubator.apache.org/shindig/, found the prerequisites:

  1. Java1.5 JDK/JRE or later
  2. Subversion
  3. Maven

The first two are available at Ubuntu Repositories. Download Maven and untar it as below:

su
cd /usr/local/lib
wget http://archive.apache.org/dist/maven/binaries/apache-maven-2.0.8-bin.tar.gz
tar -xzvf apache-maven-2.0.8-bin.tar.gz

Set the environment parameters PATH and JAVA_HOME by adding the following lines to /etc/bash.bashrc.

JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.03"
PATH="/usr/local/lib/apache-maven-2.0.8/bin:$JAVA_HOME/bin:$PATH"

As an example, http://localhost:8080/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml And, check

>source /etc/bash.bashrc
>printenv | grep JAVA
JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.03
>printenv | grep PATH
PATH=/usr/local/lib/apache-maven-2.0.8/bin:/usr/lib/jvm/java-6-sun-1.6.0.03/bin:/usr/local/sbin…
>mvn --version
Maven version: 2.0.8
Java version: 1.6.0_03
OS name: "linux" version: "2.6.22-14-rt" arch: "i386" Family: "unix"

This completes the prerequisites, and now proceed to "Getting the code" at http://incubator.apache.org/shindig. As a user, do:

>mkdir -p ~/Src/Shindig
>cd ~/Src/Shindig
>svn co http://svn.apache.org/repos/asf/incubator/shindig/trunk/ .

As a result,

>ls
COPYING  NOTICE  config  features  javascript  pom      site
LICENSE  README  etc     java      php         pom.xml

Then,

cd java/gadgets
mvn package

download lots and lots of files. Showing below is the last lines of the output.

:
:
[INFO] [war:war]
[INFO] Packaging webapp
[INFO] Assembling webapp[gadgets] in [/home/laurel/Src/Shindig/java/gadgets/target/gadgets]
[INFO] Processing war project
[INFO] Copy webapp webResources[/home/laurel/Src/Shindig/java/gadgets/../../javascript/] to[/home/laurel/Src/Shindig/java/gadgets/target/gadgets]
[INFO] Webapp assembled in[719 msecs]
[INFO] Building war: /home/laurel/Src/Shindig/java/gadgets/target/gadgets.war
[INFO] Preparing source:jar
[WARNING] Removing: jar from forked lifecycle, to prevent recursive invocation.
[INFO] No goals needed for project - skipping
[INFO] [source:jar {execution: attach-sources}]
[INFO] Building jar: /home/laurel/Src/Shindig/java/gadgets/target/gadgets-sources.jar
[INFO] [jar:jar {execution: default}]
[INFO] Building jar: /home/laurel/Src/Shindig/java/gadgets/target/gadgets.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 minutes 21 seconds
[INFO] Finished at: Sun Apr 06 00:00:33 JST 2008
[INFO] Final Memory: 25M/45M
[INFO] ------------------------------------------------------------------------

Now run the Jetty server by

mvn jetty:run-war

Its last output lines are

[INFO] [jetty:run-war]
[INFO] Configuring Jetty for project: Apache Shindig Java Gadget Server
2008-04-06 00:59:53.875::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
[INFO] Context path = /gadgets
[INFO] Tmp directory =  determined at runtime
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] Starting jetty 6.1.9 ...
2008-04-06 00:59:54.304::INFO:  jetty-6.1.9
2008-04-06 00:59:54.360::INFO:  Extract jar:file:/home/laurel/Src/Shindig/java/gadgets/target/gadgets.war!/ to /home/laurel/Src/Shindig/java/gadgets/target/work/webapp
2008-04-06 00:59:54.102::INFO:  No Transaction manager found - if your webapp requires one, please configure one.
2008-04-06 00:59:56.298::INFO:  Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server

As an example, http://localhost:8080/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml showed the screen below.
[[image: jetty_server_gadget_example.png]]
OK, it works! :-> So nice! But, how did it work? Study (!) I think this gives me a good environment to study Gadget and OpenSocial applications.

Now how can I stop the server? This time, just hit Ctrl-C :-O Below is the output at the terminal.

2008-04-06 11:42:39.133::INFO:  Shutdown hook executing
2008-04-06 11:42:40.696::INFO:  Shutdown hook complete
[INFO] Jetty server exiting.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 644 minutes 59 seconds
[INFO] Finished at: Sun Apr 06 11:42:40 JST 2008
[INFO] Final Memory: 15M/28M
[INFO] -----------------------------------------------------------------------


Oh, how about my first helloworld gadget at http://blog.i4pace.net/helloworld.xml? Tried http://localhost:8080/gadgets/ifr?url=http://blog.i4pace.net/helloworld.xml, and the browser showed Hello World! A little yay :-) It's always good to start from the most simple way of doing things.

Another one introduced in a OpenSocial tutorial worked as well. Specifying the URL http://localhost:8080/gadgets/ifr?url=http://blog.i4pace.net/gifts_5_streams.xml shows a screen below: [[image: gifts_streams.png]]

Don't know how to daemonize the start/stop of the server... Meanwhile, will run it in the background. Then, need to find out what processes to kill to stop the server.

• Wrote Teru at 18:26 (edited 24×, last on 09 Apr 2008) | read 80× | Add comment

Comments (0)

No comments for this article yet.

Write a comment

Your name  
E-mail   (only visible for blog owner)
Homepage
How much is 2+5?   (protection against spam-bots)
Text:

[b] [i] [u] [tt] [center] [code] [quote] [url] [url=] [img] [@] [@@] [@:]
detailed help about markup
Process times: page=0.035 request=0.051 cpu=0.050