Oracle Portal

This document describes (in brief note form) how to create a simple portlet for use by Oracle Portal, using Oracle JDeveloper9i.

Software Versions Used

  • Oracle JDeveloper 9.0.3.1 (May not work with any other version, certainly not earlier versions)
  • Oracle Portal 9.0.2.2.14
  • Oracle Container for Java (OC4J) 9.0.3.0.0
  • Oracle Portal Development Kit v2

Steps

Create Portlet Development Kit (PDK) Library

The portlet wizard automatically adds this library to the project if it does not already exist.

  • Edit project settings
  • Select 'library'
  • Add 'Oracle9iAS PDK-Java v2' to the list of selected libraries. This library includes the following jars from the PDK...
    • ptlshare.jar
    • pdkjava.jar
    • jazn.jar

Create Connection to OC4J

  • Select 'File|New' in JDeveloper
  • Select 'General|Connections' from the categories tree list (This behaviour is specific to the JDeveloper Version
  • Select 'Application Server Connection' in the 'items' list
  • Select OK
  • Enter a connection name - E.g. local
  • Select the connection type - E.g. Standalone OC4J
  • Enter the OC4J admin username and password created when installing OC4J
  • Select 'next'
  • Enter the url as 'ormi://Hostname/' or 'ormi://ip.address.of.host/' or if local machine 'ormi://localhost/'
  • Enter the name of the target web site e.g. http-web-site
  • Enter the location of admin.jar - e.g. c:\jdev9031\j2ee\home
  • Select 'next'
  • Test the connection. The status will report 'Success!' if successfull.
  • Select 'finish'

Target Web Site

This section describes how to ascertain the target web site specified during Creating Connection to OC4J.

The web site name is specified in OC4J server.xml. This configuration file will be in the OC4J home directory, e.g. c:\jdev9031\j2ee\home. It is specified in the <web-site> tag. e.g. <web-site path="./http-web-site.xml" />. If OC4J is installed using the default options, 'http-web-site' will be OK.

Java Portlet Wizard

  • Select the appropriate project in JDeveloper
  • Select 'File|New' in JDeveloper
  • Select 'Web Tier|Oracle9iAS Portal' in the 'Categories' tree list
  • Select 'Java Portlet' in the 'items' list
  • Enter a portlet name - not saved - edit provider xml file afterwards
  • Enter Display name - not saved - edit provider xml file afterwards
  • Enter description - not saved - edit provider xml file afterwards
  • Enter timeout seconds e.g. 100
  • Enter timeout message - (This doesn't appear to be saved anywhere!!!)
  • Fill in the remaining wizard pages, except the last, as suits your requirements. For demonstration purposes it suffices to leave the defaults.
  • On the final (7th) page enter a provider name.
  • Select 'Finish'

Create Deployment EAR

  • Select the appropriate project in JDeveloper
  • Select 'File|New'
  • Select 'Deployment Profiles' in the 'Categories' tree list
  • Select 'WAR file - J2EE Web Module' in the 'items' list
  • Select 'OK'
  • Enter an appropriate deployment name. This will be used to construct the default WAR and EAR filenames
  • Select 'OK'
  • Edit the various deployment profile settings. The defaults will suffice most situations.
  • Depending on how you installed the Portal Development Kit, you may need to include the jar files in the deployment.
    • Select 'WAR file|WEB-INF/lib' in the tree list
    • Check 'Oracle9iAS PDK-Java v2' in the 'Which Libraries are involved in Dependency Analysis?' list
  • Select 'OK'

Deploy Ear File

  • Right click the deploy file created in the Create deployment EAR wizard step
  • Select 'Deploy to' and choose the connection type created in the Create Connection to OC4J step. E.g. 'local'
  • The JDeveloper 'Deployment' window will eventually show the '--- Deployment finished ---' message. You should see messages in the OC4J application showing that it auto-deployed the application

Test the Deployment

We need to determine what the root url is for the application. It is constructed as follows:

  • http://hostname:port/ApplicationRoot/providers
    • hostname = The host name of your OC4J instance e.g. localhost
    • port = This is defined in the website xml OC4J configuration file. See the "Target Web Site" section to determine this filename. The default installation will be ${OC4J_HOME}/config/http-web-site.xml. The port is specified by a 'port' attribute of the <web-site> tag. If it's not specified, it no doubt defaults to port 80.
    • ApplicationRoot = This is the Web Context Root that was set during Create Deployment Ear. It will also be specifed as the 'root' attribute of the <web-app> tag in the website xml configuration file.
    • providers = constant value of 'providers'

Example URL

  • http://localhost:8888/Workspace1-Project1-context-root/providers

Fire up a browser with the url and, if successfull, a test page will be displayed listing all the providers within this deployment. (Only one provider in this instance).

You can also run a test for an individual provider by appending the provider name to the above url. E.g.

  • http://localhost:8888/Workspace1-Project1-context-root/providers/myprovidername

In this version of Portal, a single definition can contain many providers. One is specified as a default, but more can be included. Using this test method allows you to specify a particular provider. See #MultipleProviders.

The provider name was specified during the Java Portlet Wizard step. It was specified as the 'portlet name'. You can also determine it by inspecting the contents of the ${OC4J_HOME}/applications/mytestportlet/mytestportlet/WEB-INF/deployment directory. There will be a property file for each provider, with a filename prefix consisting of the provider name. This same property file should also be displayed in the JDeveloper system navigator under your project.

Register the Portlet

  • Login to Oracle9iAS Portal
  • Select the 'Builder' link at the top right corner
  • Under the 'Providers' portlet, select the 'Register a Portlet Provider' link
  • Enter a name - (recoment no spaces etc)
  • Enter a display name - something fairly meaningful
  • Enter a timeout and timeout message
  • Select 'Web' as the implementation style
  • Select 'Next'
  • Enter the 'URL' as the 'provider' url determined in Test the Deployment. This is the general one that ends with 'providers'
  • Enter the 'Service Id' as the 'provider name' determined in Test the Deployment. This is the name that can be appended as a suffix to the general provider URL, in the form of urn:myprovidername where 'myprovidername' is the name of the specific provider for the portlet we are registering
  • The default values for the remaining settings should suffice for a simple scenario
  • Select the 'Finish' button, cunningly placed at the top right of the page

Adding Further Providers

To be done...


Adding Further Portlets to a single Provider

This achieved by adding further definintions of the <portlet/> tag within provider.xml.

  • Provide a unique id number in the <id/> tag.

-- Frank Dean 20 May 2003