Thursday, November 27, 2008

My Javaworld Article - Portlet 2.0 Quickstart Guide

I just published a new article in Javaworld titled: A quickstart guide to Portlet 2.0. It talks about how get up and running your first portlet on the JBoss Portlet Container.

Makes a good addition to the Portlet 2.0 (JSR 286) Tutorial series.

Friday, June 27, 2008

Make any website a social network ...

... is the theme of the day. Be it Google Friend Connect, Facebook Connect or Myspace Data Availability- everyone wants you to use *their* social data.

What does it mean for developers ? Not sure. None of these platforms are public yet. And it will be interesting to see how open they will be.

Tuesday, June 17, 2008

OpenSocial & Facebook Developer Meet in Bangalore

We are conducting an OpenSocial/Facebook developer meet in Bangalore. If you are interested in learning more about any of these technologies, please feel free to participate.

The details are available here:
http://upcoming.yahoo.com/event/807031

Don't forget to confirm your participation beforehand.

JSR 286 - Too little , too late

Just noticed that the JSR 286 spec has been finally posted : JSR-286 Now Posted. As you can see, the Expert Group for this spec was formed in Dec 2005. And it has taken 2.5 years for the EG to iterate to the next version. Portlet 1.0 was released in 2003, 5 years back.

My personal opinion is that this technology has been delayed to almost a point of irrelevance. And it would be interesting to see if Portlet 2.0 will succeed to make an impact.

Friday, April 18, 2008

Will OpenSocial replace existing portal standards ?

Going by the current trend it seems that OpenSocial might replace current server side portal standards like Portlets and WSRP for good. OpenSocial gadgets can be considered the Web 2.0 equivalent of portlets

While portlets are server-side components that depend on aggregation at the server, OpenSocial gadgets are lightweight, javascript/DHTML/Ajax components that aggregate on the client (i.e the web browser). Portlets are expected to be deployed and maintained by administrators whereas OpenSocial gadgets can be pulled, on the fly, from just about any given source. And there is nothing much that you can do with portlets that cannot be done with a OpenSocial gadget and a servlet backend.

Time to say goodbye to all Portal Servers out there ?

Thursday, February 21, 2008

OpenSoShell - OpenSocial developer tool

OpenSoShell is a tiny open social gadget that can help developers run OpenSocial
Javascript API
snippets directly within an opensocial container like Orkut or Hi5.
It is not meant to be a full fledged IDE or development environment. But it can help complement existing gadget development tools like Firebug.

I have released it with an Apache license. Feel free to give it a shot.

http://portalzone.googlecode.com/svn/trunk/opensocial/opensoshell/opensoshell.xml

Update:
Here is how you can get started. Signup for an orkut account and request for sandbox access.Install the gadget by pointing to the URL from the the "My Applications" page.
You can find detailed instructions here: Orkut Developer Guide

You can also check out the video tutorial series.

Thursday, January 24, 2008

Portlet Tutorial - Deploying your first portlet to OpenPortal Portlet Container 2.0

This post is a part of the Portlet 2.0 (JSR 286) Tutorial series


At the time of this writing, only Sun seems to have a functional JSR 286 portlet container. Apache Pluto 2.0 is work in progress and I have been unsuccessful in running the Exo Portlet Container.


The OpenPortal portlet container is Sun Microsystem's implementation of the JSR 286 spec. Here is how you would deploy the Hello World portlet to this container.

Step 1 :

Get JDK 5 or greater: http://java.sun.com/javase/downloads/index.jsp

Step 2 :

Get the Glassfish Application Server or Tomcat
If you downloaded Glassfish, set it up first.

Step 3 :

Download the latest stable release of the portlet container.

Step 4 :

Follow the install instructions: Installing the Portlet Container

Step 5:

Start your server and access the portlet container at http://localhost:8080/portletdriver

Step 6:

Once you have the portlet container running, you will notice two tabs. A Portlets tab and an Admin tab.The Portlets tab helps view all the portlets currently deployed. The Admin tab is used to to deploy/undeploy portlets. You are most likely to see a blank page. This is because no portlets are deployed by default.

Click on the Admin tab and proceed to deploy the portlet.


















Once you click on deploy, the portlet is automatically deployed and configured. Click on the Portlets tab to now view the portlet.












You have successfully run your first portlet !

Wednesday, January 16, 2008

Good Javascript resources

If you are planning to learn javascript or in the process of doing so, here are some pointers.

The best way to start is to watch a series of videos presentations from YUI Theater. These videos are brilliant with absolutely high quality content.

You can watch the videos in this order:


  1. The Javascript Programming Language


  2. Advanced Javascript


  3. The Theory of DOM


  4. Javascript: The Goood Stuff

  5. High Performance Javascript

  6. The State of Ajax

  7. High Performance Ajax


The YUI Theater also offers all the content downloadable in an ipod compatible format.

Other good online resources include The w3schools Ajax Tutorial and Sun's Java Ajax Blueprints.

If you are planning to buy a book then you can consider JavaScript: The Definitive Guide or the new book in the Head First series: Head First JavaScript (Head First) .

If you would like to keep updated with the latest in the javascript/ajax world, I would recommend Ajaxian.

Tuesday, January 15, 2008

Portlet Tutorial - Anatomy of a portlet

This post is a part of the Portlet 2.0 (JSR 286) Tutorial series

Now that we have written and successfully deployed our Hello World portlet, let's understand it's various components.Here is how our portlet would look when deployed in a container.


Notice how the portal has created a distinct boundary or window for our portlet. This is called a Portlet Window. Each portlet is visually contained in a portlet window. In addition to the portlet content (i.e the "Hello Portlet 2.0 World" message that we printed in the render method), the portlet window also contains the portlet title (we mentioned this in the portlet.xml) and some click-able controls called decorations. These decorations help control two different aspects of a portlet - modes and window states.

Portlet Modes and Portlet Window States

At any given point in time, all portlets can defined by in terms of two unique characteristics - what the portlet is currently doing and how much space the portlet is taking up on the page. The Portlet Mode defines what the portlet is currently doing. The Portlet Window State defines how much space a portlet takes up in a particular page.

For example, we could have written a help message for the Hello World Portlet and displayed it when a user clicks on the Help button (the decoration with a "?" symbol). In this case the portlet would be in the "Help" mode. Similarly we could have written different "Hello World" messages based on how much space the portlet occupies on the page. This is possible because in each case, the portlet would be associated with different window states.

Monday, January 7, 2008

Portlet Tutorial - Hello Portlet 2.0 World

This post is a part of the Portlet 2.0 (JSR 286) Tutorial series

As explained in the previous post, a portlet is a pluggable component that can be run inside any compliant portal server. Here is an example of a portlet running inside a portal.


Note how the portlet occupies only a part of the portal page. This is the primary difference between a portlet and a servlet. A portlet is meant to occupy only a part of the web page. And a portal web page consists of multiple, different portlets.

Now, let's learn to write a simple Hello World Portlet. The Portlet API defines an interface called javax.portlet.Portlet. Any portlet you write must implement this interface. One easy way to do so is to extend the javax.portlet.GenericPortlet class. The GenericPortlet already implements the Portlet interface and it is strongly recommended that you always inherit GenericPortlet while writing your own portlets.

Here is our code.


public class HelloWorldPortlet extends GenericPortlet{

public void render(RenderRequest request, RenderResponse response)
throws PortletException, IOException{

response.setContentType("text/html");
response.getWriter().write("Hello Portlet 2.0 World");
}
}

We have overridden only one method of the GenericPortlet interface called render.We will look into the render method in detail in a subsequent blog post. For the time being you can assume that whenever your portlet is "shown" on the portal page, the render method is called.

Since portlets are extended components of a regular web application, they can also be packaged along with your servlets and JSPs in a war file. However you will need a separate descriptor along your regular web.xml to describe portlets. This descriptor is called the portlet descriptor and the file is called portlet.xml.

Here is the portlet.xml for our Hello World Portlet.

<portlet-app xmlns=\"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd\"
xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
schemalocation=\"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd\">
<portlet>
<portlet-name>HelloWorldPortlet</portlet-name>
<portlet-class>com.portalzone.example1.HelloWorldPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
<portlet-mode>help</portlet-mode>
</supports>
<portlet-info>
<title>Hello World Portlet</title>
</portlet-info>
</portlet>
</portlet-app>


That’s it ! You have written your first portlet application. You can grab the ready to deploy war file from here: example1.war and deploy the application to your container of choice. If you are interested in the source, here it is : example1-src.zip.