Building Portlets with JavaBeans
Developer's Overview
August 2001
|
 |
Contents
|
This article presents a conceptual overview of Oracle9iAS Portal
and the Oracle9iAS Portal Developer Kit (PDK) to give developers
a context for understanding the Case Study:
Keep Your Customers Informed. For detailed information, including
documentation, tutorials, and a product walkthrough, visit OTN's Oracle9iAS
Portal Community page.
|
Portals and Portlets
A
portal is a Web page that displays data from other sources. Increasingly,
developers are using portal software to offer employees, customers, and partners
personalized views of applications and information.
Oracle9iAS Portal provides a common,
integrated starting point for accessing data from a variety of sources:
- Web Sites: Content from any internal or external Web page, such as stock
quotes, news headlines, or travel services.
- Content Areas: Portal entities that hold self-published information (such
as documents, spreadsheets, and presentations) in the form of folders and
items. Portal pages can link one or more content areas together for better
organization and controlled access.
- Applications: Web-enabled applications.
- Custom Sources: Content and application pieces built using the PDK.
Oracle9iAS
Portal pages display content in regions called portlets. You can think
of portlets as "Web components" that display data from other Web sites
and applications and generate summaries of key information. Portlets provide
a standardized, reliable, secure way to represent and package enterprise information;
they provide at-a-glance views of data from various sources both inside and
outside of a corporate network. By assembling many portlets onto one page, you
can give end-users a centralized place to perform their daily business tasks.
From a developer's perspective, portlets are PL/SQL procedures or Java servlets
that execute on the server. Oracle9iAS Portal renders portlets dynamically
in nested HTML tables, with the output of each portlet displayed in a cell.
Typically, portlets use standard HTML to display information to users, but their
interfaces can be extended using other browser-capable technologies such as
Cascading Style Sheets (CSS), eXtensible Markup Language (XML), eXtensible Style
Language (XSL), JavaScript, and Java applets.
Oracle9iAS
Portal provides simple self-service tools for building portlets, and you can
use other tools, including Oracle JDeveloper
and the PDK. The PDK-Java provides services you can use to create portlets from
existing Java applications, servlets, and JSPs. It provides an abstraction to
handle communication with Oracle9iAS Portal, default classes to simplify
portlet creation, and exposes methods for end-user customization, session storage,
security, and logging.
Providers
In the Oracle9iAS Portal architecture, the portal never talks to a
portlet directly. Instead, it communicates via an entity called a provider
that represents and manages one or more portlets. A portlet provider is a Java
class or PL/SQL package that exposes a data source or application to Oracle9iAS
Portal. The best example of a portlet provider is Oracle9iAS Portal itself:
features including security, administration, application building, and self-service
publishing are exposed as portlets.
By
implementing functions that interact with Oracle9iAS Portal, providers
give a framework for portlets to work within. A portlet provider has the following
characteristics:
- Provides a communication link between the portal services and portlets.
- Implements session startup and provider login.
- Acts as a proxy to all portlet calls.
- Manages the portlet repository list.
You can expose portlets through two kinds of providers:
- Database providers are best for portlets that are executed within
the database or require significant interaction with the database, and in
situations where the development team has extensive Oracle experience.
- Web providers are best for leveraging existing code or external information
sources, when the portlets reside on machines other than Oracle9iAS
Portal nodes, and in development groups that have extensive Web development
background.
This article and the accompanying case study focus
on Web providers. For more information about Database providers, see Understanding
Database Providers.
The main purpose of the PDK-Java is to simplify portlet implementation while
representing the provider architecture in a natural way to Java developers.
There are four functional areas:
- The Provider Adapter (
oracle.portal.provider.v1.http.HttpProvider)
handles HTTP communication.
- The Provider Interfaces specify the functions a provider and its portlets
require to operate as part of the portal page.
- The Provider Runtime provides a base implementation of the Provider interfaces
in the class
oracle.portal.provider.v1.http.DefaultProvider.
- The Provider Utilities provide methods for rendering portlets.
The DefaultProvider (which implements the Provider Runtime) is the first line
of communication from the portal (through the Provider Adapter) when retrieving
portlet information and rendering a portlet. Once intialized by Oracle9iAS
Portal, the DefaultProvider uses its methods to answer all of the requests from
Oracle9iAS Portal.
The DefaultProvider gets information about a portlet by parsing a static XML
file named provider.xml. Click here
to display the provider.xml file used in the case
study that accompanies this article.
Created by the portlet developer, a provider.xml file has the
following characteristics:
- It describes the provider, including the name of the class that implements
the provider.
- It describes the portlet(s) the provider manages. Each portlet description
includes:
- Portlet ID, portlet name, portlet title, and portlet description.
- Implementation modes of the portlet such as renderer, security manager,
and personalization manager.
At runtime, the DefaultProvider locates provider.xml by using
the "provider_root" argument from the Oracle HTTP Server (Oracle9i
Application Server). Once located, the DefaultProvider parses this file and
creates an instance (Java object) for each portlet specified in the file. It
associates each of the portlet tags with each newly-created portlet instance.
The DefaultProvider then creates an instance for each render mode specified
in provider.xml and associates it with the value of its portlet
tag. Finally, the DefaultProvider creates a list of portlets and adds each newly-instantiated
portlet to the list. At this point, Oracle9iAS Portal can render the
portlet.
Rendering
Portlets generate text, such as HTML or XML, that browsers use to draw what
the portlet looks like. The act of generating this text for display is called
portlet rendering.
Because portlets are displayed in browsers, they can use most techniques that
browsers support, including JavaScript, Java applets, and plug-ins. Plain HTML
is the most basic way to render portlets and provides a great deal of flexibility.
You can use standard HTML paradigms such as links, forms, images, tables, and
any construct that can be displayed within an HTML table cell. A few constructs
(such as frames) cannot be used simply because they cannot be displayed in a
table cell.
When the user views a page containing a Web provider portlet, Oracle9iAS
Portal calls the portlets render manager to render the portlets
content. The portlet content can be rendered in several modes that can be made
available to end-users and administrators, as appropriate.
| Mode |
Description |
| MODE_SHOW |
A render request is made to render the portlet content. |
| MODE_EDIT |
The Customize link in the portlet banner is clicked.
The render request is made with this mode to set user level preferences. |
| MODE_EDIT_DEFAULTS |
The Edit Defaults link is clicked. If an administrator
wants to customize the portlet for all end users, and clicks on the Edit
Defaults link while customizing a page, the render request is made
with this mode to set system level preferences. |
| MODE_ABOUT |
The About link in the portlet banner is clicked,
and the about content of the portlet is requested. |
| MODE_HELP |
The Help link in the portlet banner is clicked,
and the help content for the portlet is requested. |
| MODE_SHOW_DETAILS |
The title of the portlet is clicked, requesting a full page
view of the portlet. |
| MODE_PREVIEW |
The title of the portlet is clicked in the Add Portlet
dialog of the Page Edit wizard to request a preview of the portlet. |

Conclusion
Oracle9iAS Portal provides a starting point for accessing data from
diverse sources. Oracle9iAS Portal pages render content in portlets that
display data from other Web sites and applications and generate summaries of
key information. Oracle9iAS Portal provides simple self-service tools
for creating portlets, and you can build portlets with a variety of tools, including
Oracle JDeveloper and Oracle9iAS Portal Developer Kit. In addition to
providing abstractions for the underlying communications mechanisms, the PDK
services include methods for end-user customization, session storage, security,
and logging.
OTN's Oracle9iAS Portal Community
page provides resources for learning about and using Oracle9iAS Portal
and the PDK. It also provides Portal
Studio, a hosted developer service that you can use to build and deploy
Web portlets without having to install Oracle9iAS Portal yourself.
Questions or comments? Post a message in OTN's Oracle PDK discussion
forum or send email to the author.
Building Portlets with JavaBeans: Developer's Overview
Author: Robert Hall, Oracle Corporation
Date: August 2001
This document is provided for information purposes only and
the information herein is subject to change without notice. Please report any
errors herein to Oracle Corporation. Oracle Corporation does not provide any
warranties covering and specifically disclaims any liability in connection with
this document.
Oracle is a registered trademark and Enabling the Information
Age is a trademark or registered trademark of Oracle Corporation. All other
company and product names mentioned are used for identification purposes only
and may be trademarks of their respective owners.
Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
U.S.A.
Worldwide Inquiries:
+1.650.506.7200
Copyright © Oracle Corporation 2001
All Rights Reserved
|