Developing Portlets with Apache Pluto
The Java Portlet Specification (originally created through JSR-168) provides a standard for developing portal components with the Java programming language. This specification, originally released in October of 2003, is gaining popularity as not only a standard for traditional portals, but also as a framework for deploying 'plugins' for standard Web applications. Apache Pluto is the reference implementation of the Java Portlet Specification. In addition to implementing the container interface required by the specification, the Pluto project provides a simple portal (driver) and other utilities which can be used to develop standard Portlets.
This article provides a basic introduction to the Pluto Portal Driver. It will investigate the basic architecture of the portal driver and introduce the development utilities and techniques. This article discusses the Pluto Portal Driver version 1.1.
Portal Components and Apache Pluto
Java Portlets provide content from disparate sources. This content is aggregated into a single presentation by the portal. Portlet developers wanting to create portlets that are deployable within a compliant portal implement interfaces defined by the Portlet API and adhere to the lifecycle restrictions defined by the Portlet Specification.
A Portlet Container manages the lifecycle of Java Portlets. Portlet containers instantiate, initialize, and invoke portlets in a manner defined by the specification. According to the specification, portals may implement their own container or embed an existing container. No matter what approach is taken, the container must ensure that Portlets are invoked in a manner compliant with the Java Portlet Specification's requirements.
Apache Pluto is a subproject of the Apache Portals Project. The Pluto project provides the container required by the specification. The project also provides a simple portal application (also referred to as the Pluto Portal Driver), and other utilities that can be used for portlet development. Additionally, the portal driver provides an example of how to embed the container within a portal.
The Pluto Portlet Container
The Pluto Portlet Container manages the lifecycle and invocation of specification compliant portlets. It is this component of Apache Pluto that is the official reference implementation of the Portlet Specification. A detailed discussion of the Portlet Container architecture is not required to utilize Pluto as a development or simple portal environment. It is also beyond the scope of this discussion.
The Pluto Portal
The Pluto Portal is a Web application that provides a basic portal implementation. The portal is not intended to be an enterprise portal implementation. The portal is intended for the following purposes:
- To simplify portlet development by providing a lightweight portal.
- To provide a simple example of how to embed and invoke the portlet container from within a portal.
- To provide an embeddable framework that can embedded within a Web application to provide support for pluggable components that adhere to the portlet specification.
In reality, the Pluto Portal is developed as two components. The portal proper provides the Web resource that makes up the user interface of the portal. This webapp utilizes the Pluto portal driver libraries (developed as a separate—reusable—module) for portlet invocation and other services. Although the portal driver does not support many extraneous services, it does support basic templating and aggregation services.
The Pluto Portal Driver Libraries
The Pluto Portal Driver provides the necessary hooks for invoking portlets through the Pluto Portlet Container. These hooks are implemented as tag libraries that can be utilized in any JSP page. The driver also provides a rather simple controller servlet, a templating framework, and an aggregation framework.
In addition to these services, the driver includes a configuration service that is used to properly configure the pages and portlets tgat are displayed within the portal. The default implementation of this service utilizes a simple XML file for configuration. Currently, real-time configuration through the portal interface (with RDBMS storage) is under development.
The default driver services are configured through a simple XML file—pluto-portal-driver-config.xml. Basic properties, supported window states and portlet modes, deployed portlet applications, and page configuration are all configured through this configuration.
<pluto-portal-driver> <portal-name/> <portal-version/> <container-name/> <supports> <portlet-mode/> <window-state/> </supports> <portlet-app> <context-path/> <portlets> <portlet/> </portlets> </portlet-app> <render-config/> <page/> <portlet/> </page> </render-config> </pluto-portal-driver>
|portal-name||The name of the portal implementation as returned by PortalContext.getPortalInfo()|
|portal-version||The version of the portal implementation as returned by PortalContext.getPortalInfo()|
|container-name||The name of the portlet container as required by the Pluto portlet container|
|supports||Defines a collection of items supported by the portal|
|portlet-mode||Defines a mode that is supported by the portal and returned by PortalContext.getSupportedPortletModes()|
|window-state||Defines a state that is supported by the portal and returned by PortalContext.getSupportedWindowStates()|
|portlet-app||Defines a deployed portlet application whose portlets are accessible through the portal application|
|context-path||Specifies the context path of the enclosing portlet application|
|portlets||Specifies a collection of portlets deployed within the enclosing portlet application|
|portlet||Specifies a portlet. Attributes:
|render-config||Specifies page configuration information
|page||A page within the portal. Attributes:
The driver libraries are developed as a separate module so that they can be leveraged within different projects. For example, the Pluto Portal Driver (version 1.0.1) is currently used as the plugin framework for Apache Geronimo, a J2EE compliant Application Server.
Page 1 of 3