Wednesday, April 9, 2014

Apache Shindig - Getting started

Shindig Environment Setup (Running the example)

Software installation

There are 2 ways of setting up the Shindig environment:
1.       Directly downloading the shindig war file
§  Download Shindig war from the url: http://shindig.apache.org/download/index.html (shindig-server-1.1-BETA5-incubating.war). Download the latest war.
§  Deploy it in the App Server.

(OR) 

if you want to build from source

2.     From source.
§  Download Apache Maven
§  Ensure JDK 6 is installed in the machine.
§  Set the path to JDK and Maven.
§  Build the war file out of the source using the following command.
mvn install -Dmaven.test.skip=true
Note: We were getting some compilation errors on the test classes hence ensure that we build using the above command.
§  The WAR file would be generated – place where it is built will be mentioned at the end of running the build.
§  Deploy the WAR in the App server.

Note: Deploying the war file:
Tomcat: deploy the war in the webapps directory, rename the war to ROOT.war and restart the server.

JBoss: deploy the war in the server/default/deploy directory, rename the war to ROOT.war and restart the server.

Invoke the following url to ensure that the application is properly installed.



Developing Gadgets

Steps:
§  Choose the gadget type – HTML or URL
§  Develop the gadget as defined in this section.
§  Place it in a location where it can be identified by an URI.
§  Develop the container code (which displays these gadgets)
§  Develop miscellaneous services like communication between container, gadget and server depending on your requirement.

Writing a simple Gadget (HTML): 




Code to display the gadget: 


The following were done in the above code:
§  Get the location of the gadget xml
§  Set the layout for the gadget container.
§  Create and add the gadget.
§  Render the gadget using the renderGadgets() API.

Writing a simple Gadget (URL): 

Just mention the url name in the attribute “href” instead of the html content.
There is no change in the way we display the URL type gadget. It follows the same step as we followed in the previous section. 

No comments:

Post a Comment