Sun Java System Portal Server 7.1 Developer Sample Guide

Chapter 2 Modifying the Developer Sample Portal

This chapter contains the following sections:

Introduction to Developer Sample

The Portal Server software includes a sample portal that demonstrates the Portal Server software features. The sample portal requires customization before deploying the portal because the sample portal does not have the custom content that you may require in your deployment environment.

Editing the Developer Sample Portal Files

Do not directly edit any of the files that make up the sample portal (display profile XML, JSP, and template files). Instead, make a copy of the sample portal files to modify to a new directory and then modify those copied files. In this way you preserve the integrity of the sample portal. Additionally, if you later apply a patch to the Portal Server, you won’t loose any changes you might have made to the sample portal files, as the patch would only overwrite the initially installed sample files.

Changing the Desktop Type

You should also create a custom desktop type for your users. The desktop type attribute of the desktop service is a comma-separated string. It is still a string type, but the desktop uses it as an ordered desktop type list. The list is used by the desktop lookup operation when searching for templates and JSPs. The lookup starts at the first element in the list and each element represents a sub directory under the desktop template base directory. If a template is not found in the first directory, then it proceeds to the next one in the list. This continues until the item is found (or not), for all desktop type elements in the list.

If the default directory is not included in the list, it will be added at the end of the list implicitly. For example, if the desktop type is developer_sample, the target template will be searched in the developer_sample sub directory, then the default sub directory.

By default, if the developer sample is installed, then the desktop type attribute is set to developer_sample, meaning files are retrieved from the developer_sample subdirectory. If the Developer Sample is not installed, then the desktop type attribute value is set to default. The authless user is created as part of the sample portal, and the desktop type for the authless user is set to developer_anonymous_sample,developer_sample.

You can define a new set of templates by creating a new directory under the PortalServer-DataDir/portals/portal-ID/desktop/ directory, placing your template files in this directory, and making this directory the Desktop Type attribute for that organization.

ProcedureTo change the Desktop type

  1. Create a new subdirectory in the PortalServer-DataDirportals/portal-ID/desktop directory.

    For example:


    mkdir PortalServer-DataDir/portals/portal-ID/desktop/sesta
  2. Manually copy only the template files that you wish to modify to the new directory location.

    For example, if your Desktop type will modify content.jsp file for JSPProvider, copy this file to PortalServer-DataDir/portals/portal-ID/desktop/sesta/JSPProvider/content.jsp, and customize the file for the new Desktop type in that location.

    You only need to copy the files that you have changed from the sample installation to the new directory tree. This structure enables you to tell at a glance which files have been modified from the original distribution. It also eliminates the need to back up copies of the original sample files.

  3. Use the Portal Server software management console to change the value of the Desktop Type attribute for the subdirectory created in step 1.

    As this attribute is a Dynamic Access Manager service attribute, you need to change it everywhere that it appears (organization, sub-organization, role, and user). Changing the Desktop Type at the organization level will not necessarily be reflected at the user level. This will be the case only if the user has not overwritten the Desktop Type in which case the Desktop Type value will be inherited from the organization level. If the user defines the Desktop Type at the user level, the value will remain the same even if the Desktop Type is changed at the organization level.

    In this example, in the Portal Server management console, you would specify sesta as the value for the Desktop Type attribute.

Restoring the Default Settings

The Developer Sample portal display profile file goes in the o=DeveloperSample,dc=sun,dc=com DN and the display profile file is in PortalServer-base/par-src/developer_sample/dp directory.

ProcedureTo Reload the Global Sample Display Profile

  1. Create the default portal PAR file.

    For example, typePortalServer-base/bin/psadmin create-par --dir PortalServer-base/par-src/default-portal/ /tmp/default-portal.par

  2. Import the default portal PAR file.

    For example, type PortalServer-base/bin/psadmin import -u amadmin -f password-file -p portal1 --overwrite /tmp/default-portal.par.

ProcedureTo Restore Developer Sample Display Profile

  1. Copy Developer Sample configuration files to a custom directory.

    Copy the template files from PortalServer-base/samples/portals/shared to a custom directory, remove the .template extension, and substitute the tokens in each file. For example, type:

    mkdir /tmp/mydir
    cp /opt/SUNWportal/samples/portals/shared/input.properties.template
     /tmp/mydir/input.properties
    cp /opt/SUNWportal/samples/portals/shared/password.properties.template
     /tmp/mydir/password.properties
  2. Specify values for the input.properties and password.properties files.

    Edit the input.properties file and replace all the tokens that begin and end with % with the appropriate Portal Server software settings. Edit the password.properties file and replace all the tokens that begin and end with % with the appropriate administrator password value.

  3. Run ant to install the Developer Sample.

    For example, to install the Developer Sample:

    • On Solaris, type:

      export JAVA_HOME=/usr/jdk/entsys-j2se
      /usr/sfw/bin/ant -buildfile PortalServer-base/samples/portals/developer/build.xml 
      -Dconfig.location PortalServer-DataDir/tmp -logfile 
      PortalServer-DataDir/tmp/dslog.txt
    • On Linux, type:

      export JAVA_HOME=/usr/jdk/entsys-j2se
      /opt/sun/bin/ant -buildfile 
      PortalServer-base/samples/portals/developer/build.xml 
      -Dconfig.location /var/opt/sun/portal/tmp -logfile 
      /var/opt/SUNWportal/tmp/dslog.txt