Oracle9iAS Portal Developer Kit
Database Provider Samples

The database provider samples provide a detailed template for creating your own database providers and portlets. The code is well commented.

This document explains:

- How the samples are packaged and how to install them

- The two portlets included in the samples:

  - Parameters Passing Portlet to illustrate how parameters can be passed to portlets.

  - CSS Portlet to illustrate the use of Cascading Style Sheets.

### CONTENTS

This section describes the files included in the sample. There are package specifications (*.pks), package bodies (*.pkb), and a bare-bones installation script.

Files

- param_portlet.pks: Contains detailed comments and headers for the Parameters Passing Portlet.

- param_portlet.pkb: Logic behind Parameters Passing Portlet.

- param_form_pkg.pks: Called internally by param_portlet.pkb.

- param_form_pkg.pkb: Logic for passing the parameters to one portlet or all portlets on a page.

- css_portlet.pks: Contains detailed comments and headers for the Cascading Style Sheet(CSS) Portlet.

- css_portlet.pkb: Logic behind the Cascading Style Sheet(CSS) Portlet.

- sample_provider.pks: Contains detailed comments and headers for the Sample Provider.

- sample_provider.pkb: Logic behind Sample Provider.

- install.sql: Main installation script that installs this sample.

- install_sample.sql: Called internally by install.sql script for compiling the packages.

- install_prov.sql: Called internally by install.sql for registering the provider.

Documentation

- install.sample.html: This document.

###
SETUP

To give you a good understanding of what goes on behind the scenes, these instructions describe how to install the database provider samples manually.

Installing the Packages

1. Find provsyns.sql and change to that directory (e.g. c:\portal30\webdb30\admin\plsql\wwc). Later, you will run this script to grant permission to call Oracle9iAS Portal APIs.
2. Create the schema where you will install the example.
   - Login to sqlplus (e.g. sqlplus sys/change_on_install)
   - Create a new schema (e.g. create user starter identified by starter;)
   - Give it permissions (e.g. grant connect, resource to starter;)
3. Grant your schema permission to call Oracle9iAS Portal APIs:
   - Login as the schema where your portal is installed (e.g. connect portal30/portal30;)
   - Run provsyns.sql as the schema where your portal is installed (e.g. @provsyns.sql starter;)
   - Exit sqlplus
4. Install the sample example:
   - Change to the directory where you unzipped this example
   - Login to sqlplus as your schema (e.g. sqlplus starter/starter)
   - Run install.sql (e.g. @install.sql)
   - Provide the inputs to this script when it asks for the following:
     - Portal schema username - Schema of Oracle Portal
     - Portal schema password
     - Provider schema username - Schema where you want to install this Provider
     - Provider schema password

The install.sql script runs each of the PL/SQL package scripts in turn. After completing these steps, all the logic needed to run your sample database provider and portlets resides in the database.

Registering Your Provider

The install script automatically registers your Provider for you. At the end of installation it prints out the Provider Registration information. Please verify that the Provider was registered successfully.

1. Login to Oracle9iAS Portal as a portal administrator.

2. Click the Administer tab.

3. Under the Administer tab, click on Display Portlet Repository within the portlet called Provider.

4. Scroll down to verify that the Sample Provider is listed with the Parameters Portlet and the HTML CSS Portlet.

You are now all set to add these portlets to your own pages.

###
PORTLETS

The portlets in the Sample Provider are meant to serve as a guide for developing PL/SQL portlets that require parameters or use the Cascading Style Sheets. They have been refined to reflect the best practices in PL/SQL portlet development.

Parameters Passing Portlet

The Parameters Portlet is designed to illustrate how you can pass parameters between portlets. Create a page with two instances of this portlet and see how you can pass values from one portlet instance to the other.

This portlet will take a name in a field provided on the portlet, and expect the user to click on either of two buttons provided - 'Display in this portlet' or 'Display in all portlets'. Depending on the button clicked, the portlet will pass the name entered in the field to the same portlet or other portlets on the page. On receiving the parameter, the portlet will substitute the welcome message on the portlet with the addition of the new parameter.

You can choose to pass your parameters to all the portlets on a page or to a specific portlet on the page by specifying the reference path of that instance. This sample provides well-commented code to help you with such functionality.

CSS Portlet

The CSS Portlet illustrates the usage of Cascading Style Sheets. The different styles for different lines on this portlet are derived from CSS. Using HTML CSS has several advantages :

- Separates the content from the layout

- User based retrieval of layout preferences

- When layout preferences are changed, no code modifications are required to have them applied.

As an example if you want to use the CSS Font class of PortletHeading3.

HTML code to generate :

> <p>

> <FONT class="PortletHeading3">This is a sample Heading3</FONT>

PL/SQL code that generates the HTML code above :

> htp.para

> l_text_name := 'This is sample Heading3';

> l_text := wwui_api_portlet.portlet_heading(p_string => l_text_name, p_level => 3);

> htp.p(l_text);

This sample provides well-commented code to help you with such functionality.

Revision history:

- November 02, 2000. For Nov Release.