Sun Java System Portal Server 7.2 Technical Reference

Chapter 78 Portlet Application Framework

This chapter contains the following sections:

Overview of the Framework

The Portal Server portlet applications framework provides a convenient method for customizing, configuring, and deploying portlet applications. This can be done by editing a single properties file and executing several well-defined ant targets.

Portlet application source files are located in the PortalServer-DataDir/portals/portal-ID/portletapps directory. Each subdirectory here contains an ant build.xml file, a Java properties file named tokens.properties, and the source files for the portlet web application.

Ant Targets

Perform actions on the portlet applications by executing ant targets. The following targets are supported:

customize

Builds the deployable portlet web application (WAR) by performing token substitution on the WAR source files. The tokens and values are read from the tokens.properties file.

config_backend and unconfig_backend

Configures any data sources that the portlet requires. For example, it might create a user and tables in a database. The unconfig_backend target undoes the actions performed by the config_backend target.

config_resource

Creates any JavaTM EE resources required by the portlet. For example, it might create a JDBCTM resource. As there is no unconfig_resource, resource removal must be performed manually by using the web container administration console or command line.

deploy and undeploy

Deploys the portlet web application that was built using the customize target. The undeploy target removes the portlet web application.

Installing the Portlet Application

The Portal Server software sets up a default portal under the portal1 ID. It customizes, configures, and deploys all portlet applications for this portal using default values and values provided at install time. The default portal is a special case. Thereafter, when a new portal is created, the PortalServer-DataDir/portals/portal-ID/portletapps directory is populated, the tokens.properties files are filled with default values, but the portlet applications are not deployed.


Example 78–1 Reconfiguring the File Sharing Portlet Application

By default, the file sharing portlet application is configured to store files in a database, but it can also be configured to use the file system. In this example, the file sharing portlet in the default portal is re-configured to use the file system.

  1. Undeploy and unconfigure the file sharing portlet application in the default portal located at /var/opt/SUNWportal/portals/portal1/portletapps/filesharing directory.

    To undeploy, run ant undeploy and to unconfigure, run ant unconfig_backend.

  2. Edit the File Sharing portlet's tokens.properties file and modify the following tokens:

    REPOSITORY_TYPE

    Change the value of this token from Database to FileSystem.

    FILE_SYSTEM_REPOSITORY_ROOT_DIR

    Change the value of this token to /export/filesharing/portal1 to change the location where the files are stored on the file system.

  3. Save the file.

  4. Build the deployable portlet web application using the customize target ant customize.

  5. Configure the portlet application's data sources by running ant config_backend. Here, this command will simply create the file system directories used by the portlet application.

  6. Deploy the portlet application by running the command ant deploy.