Saturday, June 12, 2004

Portaloo

Went on a Websphere Portal course with Billy Bob and Red bob. It was jolly good and rather informative.

Portlets like servlets, midlets and applets are managed applications. In this case they are window like things on a web page. These are managed and rendered by a Portal Server.

Here is a simple portlet:


package uk.co.spuggy.portalcityarizona;

import java.io.IOException;

import org.apache.jetspeed.portlet.*;
import org.apache.jetspeed.portlet.event.*;


/**
* A sample portlet based on PortletAdapter
*/
public class examplePortlet extends PortletAdapter implements ActionListener, MessageListener {


public void init(PortletConfig portletConfig) throws UnavailableException
{
super.init(portletConfig);
}

public void doView(PortletRequest request, PortletResponse response) throws PortletException, IOException

{
.
.
//do some stuff
.
.
// Invoke the JSP to render
getPortletConfig().getContext().include(VIEW_JSP+getJspExtension(request), request, response);
}

public void doEdit(PortletRequest request, PortletResponse response)
throws PortletException, IOException

{
.
//do some stuff.
.
// Invoke the JSP to render
getPortletConfig().getContext().include(EDIT_JSP+getJspExtension(request), request, response);
}



/**
* Returns the file extension for the JSP file
*/
private static String getJspExtension(PortletRequest request)
{
String markupName = request.getClient().getMarkupName();
return "jsp";
}

}


It looks not dissimilar to a servlet really and the key hooks are doEdit, doView and doHelp which map on to the controls in the portlet "window". The portlet will need a little JSP block to do the doView bit too. Here are some portlets below:



To develop portlets you use the portal toolkit, which plugs into WSAD and has a host of wizards to support and confuse you. You can hook portlets together by getting them to send messages to each other. An example could be when a travel portlet allows selection of a city and then that same portlet sends the selected city to a weather portlet which displays the weather in that city on the next page refresh. This can also be done by an administrator without programming (oh yeah ;-))

There are a raft of other add-ons dealing with connecting to Peoplesoft and Web services; you name it.

As an aside, I have noticed that the Blue Meanies tend to abbreviate long product names and then sort of make a word out of the abbreviation. I realise this is not uncommon in the IT business but they really go to town. For instance WSAD is pronounced "Wuhsad" and there are plenty of others. This is all WBLX of course, or as we say: "wuhbollocks".

0 Comments:

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?