Sun Java Solaris Communities My SDN Account Join SDN
 
Article

Open-Source Portal Initiative at Sun, Part 2: Portlet Repository

 
By Jeffrey Blattman, Navaneeth Krishnan, Dean Polla, and Marina Sum, October 25, 2006  

Part 1 of this series introduces the open-source portal initiative at Sun. This segment, part 2, defines portlets and portals and discusses the Open Source Portlet Repository (Portlet Repository for short), a new java.net project dedicated to the free and open exchange of portlets. Part 2 also explains the Portlet Repository goals, scope, and content and summarizes the guidelines for contributors.

See also part 3: Portlet Container and part 4: Web Services for Remote Portlets.

Contents
 
Portlets
Portals
Portlet Repository
Guidelines for Contributors
Other Portlet-Sharing Sites
References

 
Portlets

Portlets are the reusable Web components for building portals. Classic examples are My Yahoo! and, more recently, Google's IG customized home-page service. The "windows" you see on those pages are portlets. Figure 1 shows the portlets on Sun Java System Portal Server.

Figure 1: Portlets on Sun Java System Portal Server
Figure 1: Portlets on Sun Java System Portal Server (Click image for larger view.)
 

Java Specification Request (JSR) 168 is version 1.0 of the portlet specification, the standard that enables portlet portability. Before JSR 168 came into play, there were numerous noninteroperating definitions of a portlet. The term portlet had only a conceptual meaning. JSR 168, developed by an expert group with representatives from many industry and open-source leaders, including Apache, BEA, IBM, Oracle, and Sun Microsystems, defines a set of Java APIs for portal development and standardizes portlet preferences, user information, and life cycle. In the rest of this article, portlet means a JSR 168 portlet.

Version 2.0 of the portlet specification, called JSR 286, is now available for early draft review.

By definition, portlets generate markup fragments, not a complete page—one of the significant factors that differentiate portlets from servlets. A portlet is one of many components on a page. A large part of JSR 168 focuses on accommodating this definition.

Authoring a portlet is similar to authoring a servlet: You implement a simple Java interface or extend a base class and then package it into a Web application archive (WAR) file. Physically, portlets are extended Web applications. Any portlet Web application is also a Web application on the Java Platform, Enterprise Edition (Java EE platform). The difference is that a portlet application additionally contains one or more portlet implementation classes and a portlet descriptor. It might, of course, also contain any number of other nonportlet Java EE artifacts, such as servlets, JavaServer Pages (JSP) pages, Web services, static content, and so forth.

The Web Services for Remote Portlets (WSRP) specification enables portlets to be exposed as Web services and consumed by remote portals. Even though WSRP does not assume or depend on a portlet container, WSRP and the portlet container complement each other as a result of close alignment between their specifications.

Portals

The heart of a portal is a portlet container, which is to portlets what a servlet container is to servlets. Portlet containers execute portlets and manage their life cycle. Additionally, portals offer an aggregation metaphor—a mechanism with which you can arrange multiple portlets on a single page.

Beyond that, the definition of a portal blurs. Portals might provide other services, including but not limited to single sign-on, content management, search, and collaboration.

Again, to execute portlets, you need a portal—or at least a stand-alone portlet container. To learn how to obtain a portal container, see "Setting Up a Portlet Container."

Many sophisticated portal platforms include portlet containers. See these examples:

Apache Jetspeed-2 Enterprise Portal IBM WebSphere Portal Metadot
BEA Weblogic Portal JA-SIG uPortal Oracle Portal
eXo Jahia Sun Java System Portal Server
Gridsphere Liferay  
 
Portlet Repository

The Portlet Repository forms a portlet library, where portal developers can choose from a wide variety of content and services for their portals.

Goals

The Portlet Repository has two simple goals:

  • Stimulate the development of free portlets.
  • Facilitate the open exchange of portlets.

The Portlet Repository is a library of ready-to-run applications that you can download and deploy directly into your portal with, in most cases, no additional setups or configurations. Therefore, the Portlet Repository hosts only deployable portlet applications, and you should host portlet-related libraries or other developer utilities and tools in other java.net projects. For example, consider joining an existing project or create one under the Portal project on java.net.

Content

The Portlet Repository started with four portlets:

  • Bookmark Portlet — Manages bookmarks online.

  • Notepad Portlet — Creates personal notepad messages.

  • RSS Portlet — Displays syndicated content feeds.

  • Showtime Portlet — Compares the time in different time zones.

In the works are four additional portlets:

  • AJAX Portlet — Demonstrates how to integrate Asynchronous JavaScript and XML (AJAX) technology with a portlet.

  • Blog Portlet — Enables bloggers to manage blogs from portals.

  • Mashup Portlet — Combines data from multiple sources. See a related article.

  • JWChat Portlet — Communicates with an instant-messaging server with Extensible Messaging and Presence Protocol (XMPP) over HTTP binding. See the Jabber Web Chat site.
Process

This section walks you through the details of setup, builds, and deployment of the Portlet Repository portlets.

Setting Up a Portlet Container

To run a portlet, first set up a portlet container. A simple way to start is to download Apache Pluto, the JSR 168 reference implementation with which you can deploy and execute portlets. Be aware that Pluto does not support portal development.

Also of interest is java.net's Portlet Container project, which, like Pluto, offers a lightweight environment for developing portlets.

Acquiring the Code

The Portlet Repository uses Concurrent Versions System (CVS) for version control and will switch to Subversion in the near future. You can browse the source files with java.net's online CVS browser. To download the code, you can access the Portlet Repository's CVS repository anonymously. For example:

$ cvs -d :pserver:guest@cvs.dev.java.net:/cvs login
Logging in to :pserver:guest@cvs.dev.java.net:2401/cvs
CVS password: <return>
$ cvs -d :pserver:guest@cvs.dev.java.net:/cvs checkout portlet-repository
cvs server: Updating portlet-repository
U portlet-repository/CDDLv1.0.txt
U portlet-repository/COPYRIGHT
U portlet-repository/pom.xml
cvs server: Updating portlet-repository/bookmarkportlet
...
 

For details, including how to access the CVS repository on the WinCVS client for Windows, see the Portlet Repository's CVS access page. Note that write access to the CVS repository requires that you have the developer role—have become a committer—in the Portlet Repository. To find out more, see "Guidelines for Contributors" later in this article.

Building the Portlets

The Portlet Repository uses Apache Maven 2 for project builds. If you're accustomed to building your Java projects with Apache Ant instead, be assured that Maven is a vast improvement. Just look at the pom.xml files in the source and compare them with an equivalent Ant build.xml file.

For details on Maven, download the free e-book, Better Builds With Maven, from Mergere.

You need not be an expert with Maven to build the Portlet Repository. For example:

$ cd src/portlet-repository/
$ mvn package
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Open Source Portlet Repository Project
[INFO] RSS Portlet - POR
...
 

Alternatively, you can build the Portlet Repository portlets with the NetBeans IDE and the Mevenide NetBeans Module. In particular, you can open and build Maven projects just like standard NetBeans Ant-based projects on Mevenide. Figure 2 shows the GUI.

Figure 2: GUI for Opening the Portlet Repository Maven Project in the NetBeans IDE
Figure 2: GUI for Opening the Portlet Repository Maven Project in the NetBeans IDE (Click image for larger view.)
 

The first time you build a portlet, Maven downloads all the necessary dependencies, a process that might take awhile. When the build is complete, each portlet subproject contains a WAR file in the dist subdirectory, for example: .../portletrepository/rssportlet/dist/rssportlet-1.0.war.

Deploying the Portlets

The deployment process for a portlet application depends on the portlet container of your choice. For details, see the documentation of your portlet container or portal.

Pluto includes administration portlets for deployment from a Web user interface. You can deploy Portlet Repository portlets by means of the Deploy War Admin Portlet. See Figure 3.

Figure 3: Pluto's Administration Interface
Figure 3: Pluto's Administration Interface (Click image for larger view.)
 

Figure 4 shows the deployment of a Portlet Repository portlet into Pluto.

Figure 4: Deployment of a Portlet Repository Portlet Into Pluto
Figure 4: Deployment of a Portlet Repository Portlet Into Pluto (Click image for larger view.)
 

Figure 5 shows the deployed portlet.

Figure 5: Deployed Portlet
Figure 5: Deployed Portlet (Click image for larger view.)
 
Guidelines for Contributors

The Portlet Repository needs contributors! Whether in the form of new portlets, enhancements, or bug fixes, your contributions are welcome.

Contributors to the Portlet Repository assume either of two roles:

  • Developer — Developers serve as gatekeepers to the project, ensuring that only high-quality, stable changes are committed.

  • Observer — Observers contribute code by submitting it to project developers.

The Portlet Repository guidelines ask that those interested in contributing to the repository start with the observer role. The process of then becoming a developer is simple: Act like one. If observers repeatedly demonstrate that they can function as developers, they can be nominated by a developer and voted in by other developers. For details, see the Portlet Repository contributor guidelines.

Before contributors can have code accepted into the project, they must sign and return a contributor agreement. In brief, the agreement is their consent to share the rights to the code they contribute. Contributors should carefully read the details of the agreement.

Other Portlet-Sharing Sites

Let a thousand flowers bloom! As the popularity of portlets and portals continues to grow, other noteworthy portlet-sharing sites are popping up. Here are a few examples:

The Portlet Repository contributors are committed to a free and open exchange with other portlet sites. No doubt portlets from one site will show up on another in a different form. Ultimately, which site hosts the portlets is immaterial. Success of the Portlet Repository hinges on whether it has helped build a robust portlet library for the community.

References
Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.
The Portal Post
 
Download SDK

Jeff BlattmanJeff Blattman, a software engineer at Sun for over 10 years, is currently working on the Sun Java System Portal Server project. He is a contributor to the Apache Roller, Portlet Repository, and Quickr-Flickr open source projects. Jeff is an avid amateur astronomer and enjoys keeping tropical aquaria. He lives in San Jose, CA with his wife and son.
 
Navaneeth KrishnanNavaneeth Krishnan, a member of the Sun Java System Portal Server development team, is a key contributor to the Portlet Repository and other open-source and community-building initiatives. His work blog, The Portal Zone, touches on numerous portal-related topics.
 
Dean PollaDean Polla, also a member of the Sun Java System Portal Server development team, is currently involved with the open-source portal projects. He contributes to the Portlet Repository and participates in the development of several other Portal Server features, including single sign-on access and sample portal desktops.
 
Marina SumMarina Sum is a staff writer for Sun Developer Network. She has been writing for Sun since 1989, mostly in the technical arena. Marina blogs on Sun products, technologies, events, and publications.