13.2 Portlets
We introduced the concept of a
portlet in
the previous section. Basically, a portlet is
a reusable program that delivers information. This information can
come from a variety of sources. A portlet works with and leverages
the services provided by the OracleAS Portal runtime to integrate its
information into the overall OracleAS Portal environment. The portlet
is one of the key enablers for OracleAS Portal's
display of information.A portlet displays information that is collected from a source, known
as a portlet provider. The portlet provider collects the
information and then passes it to the portlet, which displays the
information. This architecture, and the two types of portlet
providers, are shown in Figure 13-3.
Figure 13-3. Portlet architecture and provider types

portlets. Portlet providers can be organized into Provider Groups,
which combine related providers. A Database Provider, described
later, can be shared between multiple instances of OracleAS Portal.Each portlet is registered in the Portlet Repository, which is a part
of the overall OracleAS Infrastructure. When you build a page, you
can select any of the portlets in the repository for inclusion in a
region.An individual instance of a portlet can be shared across multiple
pages in a page group. By sharing a portlet, you both ensure a
consistent view of the information the portlet is providing and
reduce the resources required to retrieve the information and create
the portlet for the end user.
13.2.1 Providers
Portal providers act as the link between a
content source and an OracleAS Portal page via portlets. OracleAS
Portal includes many portal providers and can create additional
providers to run within the OracleAS Portal environment or to
register external providers. There are two basic types of providers,
Web Providers and Database Providers, described in the following
sections.13.2.1.1 Web Providers
A Web Provider collects information from
someplace on the Web and delivers information to its portlets using
SOAP over HTTP. Because it
uses the common protocol of SOAP, a Web Provider can be written in
virtually any language. A Web Provider runs in its own environment,
while a Database Provider, written in PL/SQL, runs in the Oracle
database that holds the Portal Repository.The OracleAS Portal Development Kit (PDK),
described later in this chapter, comes with a Java framework that
makes it easier to create Web Providers in Java. This framework
includes interfaces to use such Oracle Application Server features as
OracleAS Single Sign-On.13.2.1.2 Database Providers
Database Providers, as their name
implies, retrieve information from an Oracle database and are written
in PL/SQL. These Database
Providers supply information for portlets based on PL/SQL or JSPs.Database Providers run in the Oracle database that is also used for
the OracleAS Portal Repository. You can access
Database Providers running on other OracleAS Portal instances through
a feature called the Federated Portal Adapter.
13.2.2 Using Prebuilt Portlets
Although
the overall thrust of OracleAS Portal is now to provide a
consolidated interface to many sources of information, earlier
versions of OracleAS Portal put a lot of effort into making it easy
to create your own portlets using a set of portlet
wizards.These wizards prompt you for information and then create PL/SQL
packages to implement the portlet. The wizards are entirely
HTML-based, so you can build portlets from any browser.You can build a number of different types of portlets with OracleAS
Portal wizards:Form portlets
These portlets
include simple forms, master detail sets of forms, and forms based on
PL/SQL procedures.
Report portlets
These portlets can be built using the Query
Wizard, which doesn't require knowledge of SQL or
can be based on an SQL query. You can also create a Query-By-Example
report, which provides a form interface for users to implement their
own selection criteria. An item in a report can be used as a link to
another portlet page with detailed information about the item.
Chart portlets
These portlets can include links from chart
values to more detailed information.
Hierarchy portlets
These portlets display multiple levels of
related information.
Frame driver portlets
These portlets create a page with two frames, with the content of one
frame driving the display of information in the other frame.
URL page portlets
These portlets display the content of a URL.
Data component portlets
These portlets display data in a spreadsheet
format.
Calendar portlets
These portlets include links to underlying information based on date.
Dynamic page portlets
These portlets display dynamically created
HTML pages.
XML page portlets
These portlets are based on XML.
The most recent version of OracleAS Portal includes two new prebuilt
portlets that give a broader range of functionality:OmniPortlet
This portlet can access data from a variety of sources, including a
database, an XML file, a comma-separated variable file, web pages, or
Web Services. The OmniPortlet can display the information in a
variety of ways. OmniPortlet provides some of the same functionality
as some of the prebuilt portlets mentioned previously, such as
reports, charts, and forms.
Web Clipping portlet
This portlet makes it easy for a developer to select a web page and
have some or all of its content displayed in a portlet. With the Web
Clipping portlet, any web page can be a data source.
These two new portlets are also Web Provider portlets, which means
they can exist outside the Oracle database.OracleAS Portal also includes wizards that help you build portlets
that are meant to be part of a page, such as menus, links, and
list-of-values portlets.Once you have created a portlet, you can use the OracleAS Portal
environment to edit the portlet and make changes to its look, feel,
or functionality. For Database Provider portlets, Portal
automatically stores each version of a portlet, and you can recall
earlier versions if necessary.The end result of building a prebuilt portlet with one of the
development wizards is a PL/SQL package that is stored in the
OracleAS Portal Repository and run when the portlet is called. The
OracleAS Portal development environment includes an option to compile
the PL/SQL package to ensure that any code you may have added to the
package compiles without errors.In addition to the prebuilt portlets that come with OracleAS Portal,
you can download third-party portlets from the Portal Studio site;
it's described in a later subsection.The development wizards make building portlets fairly easy, and you
can include a lot of functionality in these declaratively created
portlets. You can even go so far as to include PL/SQL routines to run
at various times during the processing of a page.
|
mission-critical OLTP applications with portlets, the ease of
creation makes them a viable option for helping users to interact
with information in the database through a browser interface. Also,
the Database Provider portlets require that the data they are
accessing exist within the Portal Repository Database, which is
frequently not the case. You can use OmniPortlet to access data
outside the Portal Repository Database, because OmniPortlet is a Web
Provider.
13.2.3 OracleAS Portal Development Kit
The wizard-driven interface
that comes with OracleAS Portal is powerful and productive, but there
may be times when you want to implement some type of functionality
that is beyond the scope of these built-in wizards. For these
occasions, the OracleAS Portal team has created the OracleAS Portal
Development Kit.The PDK contains all the information and APIs you need to create your
own customized portlets, in either PL/SQL or Java. Using the PDK is
significantly more complex than the simple creation of portlets with
the built-in wizards, but it offers almost unlimited flexibility.
13.2.4 Java Portlets
Two new
Java standards,
Web Services for Remote
Portlets (WSRP) and Java Specification Request 168 (JSR 168), provide
the Java world with specifications for portlets to run in different
portal environments.OracleAS Portal comes with an
Oracle JDeveloper
Portlet Wizard, which helps you
create a portlet out of Java code in Oracle JDeveloper. This wizard
is an add-on for Oracle JDeveloper that allows you to create Java
portlet code. This code can be run against any JSR 168-compliant
portal, which includes OracleAS Portal. Portal Studio, described in
the next section, has a section that lets you test a Java portlet to
make sure it can properly interoperate with a JSR 168-compliant
portal.The Oracle JDeveloper Portlet Wizard can also create portlets that
use the Oracle PDK, rather than JSR 168, as the basic API for the
portlet. Regardless of which type of Java portlet you create, the
portlet is run in the Java Portlet Container servlet.
13.2.5 Portal Studio
To encourage the creation and sharing of portlets and providers,
Oracle Corporation provides the Portal Studio site (http://portalstudio.oracle.com). Portal
Studio is intended to be a full-service support site, containing the
latest versions of the PDK, a discussion area for developers,
integration tools for other applications, and even a way to register
and test your own portlets. Portal Studio includes third-party
portlets and providers in its
Portal
Catalog. The OracleAS Portal development team and product managers
are continually updating this site with new explanations, tutorials,
and sample code.