Sun Java logo     Previous      Contents      Index      Next     

Sun logo
Sun Java System Portal Server 6 2004Q2 Migration Guide 

Chapter 5
Migrating The Desktop


Note

All instances of the Sun™ ONE Portal Server 3.0 product refer to what were formerly known as the iPlanet™ Portal Server 3.0, Service Pack 3a, iPlanet™ Portal Server 3.0, Service Pack 4 products, and iPlanet™ Portal Server 3.0, Service Pack 5 products.


This chapter provides procedures to migrate the Sun ONE Portal Server 3.0 Desktop to the Sun™ ONE Portal Server 6.2 Desktop. In particular, migration of the Desktop includes:

This chapter also discusses customizations that the migration tools do not migrate automatically and the steps you need to take to migrate these customizations.

This chapter contains the following sections:


Desktop Pre-Migration Issues and Tasks

This section describes manual tasks that you may need to carry out before running the export tool.

Ensuring Files are Migrated

The installation of Sun ONE Portal Server 6.2 creates the BaseDir/SUNWps/migration/modules/desktop/migrate_files.txt file containing the default location of the notes provider text file. If you have moved files to non-default locations (for example, locations other than the public_html and templates directories), or if you have created a provider similar to the notes provider, you must add file system directories or files to the migrate_files.txt file before running the export tool in order to have them migrated. Files and resources listed in the migrate_files.txt are not translated. They are migrated “as is.”


Using the Export Tool

The export tool, exportps, stores data from the Sun ONE Portal Server 3.0 system to an export directory. To migrate the Sun ONE Portal Server 3.0 Desktop to Sun ONE Portal Server 6.2, you need to begin by running the export tool to gather the various Desktop data and store it to disk.

To Run the Export Tool

  1. On the Sun ONE Portal Server 3.0 system, change to the migration tool directory:
  2. cd BaseDir/SUNWps/migration/bin/

  3. Run the exportps command:
  4. ./exportps [-a] [-p LDAP passphrase] [ExportDir]

    Table 5-1 describes the options available for exporting the Sun ONE Portal Server 3.0 Desktop. This two-column table lists the options in the first column and their descriptions in the second column.

    Table 5-1  Options Available for Exporting the Sun ONE Portal Server 3.0 Desktop

    Option

    Description

    -a

    Runs all modules without a menu.

    To choose to export only the Desktop from the export menu, do not use the -a option.

    -p LDAP passphrase

    Sets the LDAP passphrase in order to avoid the LDAP passphrase prompt. If you do not use the -p LDAP passphrase option with the -a option, the tool will prompt you for the LDAP passphrase.

    ExportDir

    Specifies the directory where the information is to be saved. If you do not use the ExportDir option, the tool prompts you for the export directory.

  5. The system displays a message similar to the following:
  6. Which directory should be created to store the Portal Server system? [/tmp/psExport]

    You see this prompt only if you do not specify the output directory on the command line. You can choose the default directory /tmp/psExport or enter the export directory.

    Type the directory and press Enter.

  7. The system displays a message similar to the following:
  8. Delete the directory /tmp/psExport?

    You see this message only if there is already exported data in the ExportDir directory. If you have not already exported the Desktop, you may keep the export directory without risking any conflicts in the data. If you have already exported the Desktop, you should delete the directory to avoid conflicts.

  9. The system displays a message similar to the following:
  10. Found iPS version 3.0sp5

    Begin export process at Tue Jul 23 15:28:42 PDT 2003

    Error file: /tmp/psExport/logs/error.20370

    Report file: /tmp/psExport/logs/report.20370

    Metrics file: /tmp/psExport/logs/export_metrics.20370

    Export Menu:

    1) LDAP Database

    2) Desktop

    3) Certificate Databases

    4) All of the above

    5) Exit

    Select one of the listed options to export:

    You see the export menu only if you do not specify the -a option.

  11. Type 2 and press Enter to export the Desktop only.
  12. The system displays the following message:
  13. Enter the LDAP admin passphrase :

    You see this prompt only if you select a full export using the -a option and you do not specify the -p LDAP passphrase option.

    Type the LDAP admin passphrase and press Enter.

    You see output similar to the following:

    Copying templates and resource bundles

    .......

    Successful completion of export process at Tue Jul 23 15:29:41 PDT 2003

  14. Change to the export directory you specified in Step 2 or Step 3. For example:
  15. cd ExportDir

    Substitute the export directory for ExportDir. If you used the default export directory, for example, use /tmp/psExport.

    Type ls to see the directories and files created by the export tool.

    Table 5-2 shows the directories and files created by the export tool. This two-column table lists the directories and files in the first column and their descriptions in the second column.

    Table 5-2  Directories and Files Created by the Export Tool When Exporting the Desktop 

    Directory

    Description

    ExportDir/logs

    Contains error.PID, export_metrics.PID, and report.PID files (where PID is the process ID)

    ExportDir/
    templates.tar

    Contains exported Desktop templates, resource bundles, web server root documents, modified and new authentication templates.

    After the export has completed, or if you run into problems, check the ExportDir/logs directory for the report.PID, error.PID, and export_metrics.PID files (where PID is the process ID). The report.PID file contains actions the export tool has or has not taken. The error.PID file contains warnings or errors so that you can correct any problems. The export_metrics.PID file contains metrics detailing when various elements of the export tool started, stopped, and the total time it took to export the data. You can look at the stdout header to know which log and report files to examine for the exportps command you are running.

  16. Examine the exported data and manually change, before converting the data, all instances of the name of the Sun ONE Portal Server 3.0 system to the name of the Sun ONE Portal Server 6.2 system. If the port numbers on the two systems are different, you must change these manually as well.
  17. If you are performing a single-system migration, server names will be the same, but port numbers will be different. You need to change port numbers manually before converting the data.

  1. If you have customized Sun ONE Portal Server 3.0 iwtLogin provider templates, you should modify the display*.html templates in Sun ONE Portal Server 6.2 before migrating your templates. The migrated iwtLoginProvider channel uses the Sun ONE Portal Server 6.2 Login templates.
  2. If you do not modify the display*.html templates in Sun ONE Portal Server 6.2 before migrating the templates, you will need to update the Login templates with your Sun ONE Portal Server 3.0 customizations.

  3. Because the Sun ONE Portal Server 3.0 iwtLoginProvider templates are not being migrated, the Sun ONE Portal Server 6.2 templates must be manually edited.
    1. cd /etc/opt/SUNWps/desktop/default/Login
    2. In any of the display*.html files, add https://server_name:port/ to the following:
    3. <FORM ACTION=”https://server_name:port/amserver/login” ...>

      <A HREF=”https://server_name:port/amserver/login ...”>


Using the Conversion Tool

The conversion tool, convertps, enables you to select which data to convert from the data exported from a valid installation of Sun ONE Portal Server 3.0. Because the conversion tool runs on the Sun ONE Portal Server 6.2 system, you need to move the export directory from the Sun ONE Portal Server 3.0 system to the Sun ONE Portal Server 6.2 system.

To Run the Conversion Tool

  1. On the Sun ONE Portal Server 3.0 system, change to the directory above the export directory containing the data output by the export tool.
  2. For example, if you used the default directory (/tmp/psExport) for exporting the Desktop, you would type:

    cd /tmp

  3. Save the export directory using the tar command. For example:
  4. tar cvf export.tar psExport

  5. Use an FTP program to transfer the export.tar file to the Sun ONE Portal Server 6.2 system.
  6. Extract the files from export.tar using the tar command. For example:
  7. tar xvf export.tar

  8. On the Sun ONE Portal Server 6.2 system, change to the migration tool directory:
  9. cd BaseDir/SUNWps/migration/bin

  10. Run the convertps command:
  11. ./convertps [-a] [-f] [-i ExportDir] [-o ImportDir]

    Table 5-3 describes the options available for the convertps command. This two-column table lists the options in the first column and their descriptions in the second column.

    Table 5-3  Options Available for Converting the Desktop 

    Option

    Description

    -a

    Runs all modules without a menu.

    To choose to convert only the Desktop from the conversion menu, do not use the -a option.

    -f

    Converts Sun ONE Portal Server 3.0 roles to Sun ONE Identity Server roles and places users under the organization. This option retains the multiple role to user assignment similar to Sun ONE Portal Server 3.0, but does not retain the hierarchical role functionality. All roles are created under the organization and are not prioritized. The display profile documents are prioritized and merged accordingly. To see if the roles have been migrated to roles, view the roles under the organization in the admin console.

    If you do not use the -f option, the conversion tool converts Sun ONE Portal Server 3.0 roles to Sun ONE Identity Server suborganizations and places users under the suborganization. Without the -f option, the conversion tool retains the hierarchical functionality and customizations from Sun ONE Portal Server 3.0. The disadvantage is that it is difficult to move users from one suborganization to another. To see if the roles have been migrated to suborganizations, view the hierarchy in the admin console.

    -i ExportDir

    Specifies the input directory for the conversion. The input directory is the directory which contains the exported data created by the export tool. The conversion tool searches for export data in /tmp/psExport unless you specify a different input directory using the -i ExportDir option.

    If you specify a directory which does not contain data exported with the export tool, the conversion tool notifies you that the directory does not have export data and prompts you to enter a valid export directory.

    -o ImportDir

    Specifies the output directory for the conversion tool. The output directory is the directory used by the import tool.

    If you choose an import directory which already contains converted data, the conversion tool notifies you that modifying an existing migration may render import data unusable and prompts you to delete the import directory.

  12. The system displays the following messages:
  13. Found Portal Server version 6.2

    Enter Identity Server Internal LDAP Authentication User password:

    Type in a valid password.

    Which directory should be created to store the converted data? [/tmp/psImport]

    You see this prompt only if you do not specify the output directory using the -o ImportDir option. You can choose the default directory or enter another import directory.

    Import directory /tmp/psImport already exists.

    If you do not wish to overwrite data within this directory, please exit this migration process and rename the directory.

    Delete the directory /tmp/psImport?

    You see the message about an existing import directory only if the import directory already contains converted data. If you have already converted the Desktop, you should exit this migration process by pressing Ctrl-C and rename the directory before converting the data.

  14. After you choose the output directory, you see output similar to the following:
  15. Begin conversion process at Wed Jul 24 15:19:34 PDT 2003

    Error file: /tmp/psImport/logs/error.28128

    Report file: /tmp/psImport/logs/report.28128

    Metrics file: /tmp/psImport/logs/convert_metrics.28128

    Conversion Menu

    1) LDAP Database

    2) Gateway Rules to Rewriter Rules

    3) Desktop

    4) Certificate Databases

    5) All of the above

    6) Exit

    Select one of the listed options to convert:

    You see the conversion menu only if you do not specify the -a option.

  16. Type 3 and press Enter to convert only the Desktop.
  17. The system displays messages similar to the following:

    *** Extracting templates ***

    *****

    Begin desktop conversion process at Wed Jul 24 15:36:06 PDT 2003

    *** Converting templates ***

    *** Converting jsp ***

    *** Converting soft links ***

    *** Converting resource bundles ***

    *** Converting static web content ***

    End desktop conversion process at Wed Jul 24 15:38:13 PDT 2003

    Successful completion of conversion process at Wed Jul 24 15:38:13 PDT 2003

  18. Change to the import directory making sure to substitute the import directory that you selected in Step 7. For example:
  19. cd ImportDir

    Substitute the import directory for ImportDir. If you used the default import directory, for example, use /tmp/psImport.

  20. Type ls to see the directories and files created by the conversion tool.
  21. Table 5-4 shows the directories and files created by the conversion tool when converting the Desktop. This two-column table lists the directories and files in the first column and their descriptions in the second column.

    Table 5-4  Directories and Files Created by the Conversion Tool When Converting the Desktop

    Directory

    Description

    ImportDir/desktop.tar

    Contains Desktop data.

    ImportDir/locale.tar

    Contains resource bundles.

    ImportDir/public_html.tar

    Contains static web data.

    ImportDir/auth.tar

    Contains new or modified authentication modules.

    ImportDir/logs

    Contains error.PID, convert_metrics.PID, and report.PID files (where PID is the process ID).

    After the conversion has completed, or if you run into problems, check the ImportDir/logs directory for the report.PID, error.PID, and convert_metrics.PID files (where PID is the process ID). The report.PID file contains actions the conversion tool has or has not taken and also alerts you to any customizations which you need to convert manually. The error.PID file contains warnings or errors so that you can correct any problems. The convert_metrics.PID file contains metrics detailing when various elements of the conversion tool started, stopped, and the total time it took to convert the data. You can look at the stdout header to know which log and report files to examine for the convertps command you are running.

  22. If you run the convertps tool again in order to convert data other than the Desktop, the tool will prompt you to delete the import directory. Type no if you wish to keep the Desktop data you have already converted.


Using the Import Tool

The import tool, importps, enables you to import the data exported and converted using the export and conversion tools to a Sun ONE Portal Server 6.2 system. The import tool searches for a directory containing valid data created by the conversion tool.

To Run the Import Tool

  1. On the Sun ONE Portal Server 6.2 system, change to the import tool directory. For example:
  2. cd BaseDir/SUNWps/migration/bin

  3. Run the importps command:
  4. ./importps [-a] [-k] [-m] [ImportDir]

    Table 5-5 describes the options available for importing the Desktop. This two-column table lists the options in the first column and their descriptions in the second column.

    Table 5-5  Options Available for Importing the Desktop 

    Option

    Description

    -a

    Runs all modules without a menu.

    To choose to import only the Desktop from the import menu, do not use the -a option.

    -k

    Specifies that the tool does not overwrite existing users.

    When you run importps without the -k option, if it encounters a conflict with an existing user, it will delete the existing user and import the new user entry defined in ImportDir/ldap/user.ldif.

    If you run importps -k, if it encounters a conflict with an existing user, it leaves the existing user and places the rejected user entry in ImportDir/ldap/rejected_users.ldif.

    If the user has a display profile document in the ImportDir/dp/user/ directory, the display profile file may change. The -k option does not affect importing user display profile documents. The -k option only affects whether an existing LDAP user’s LDIF record is updated. The updates to the LDIF record include everything except display profile updates.

    -m

    Merges display profile documents.

    When you run importps without the -m option, it overwrites any existing display profile documents it finds. This means that the root suffix, organization, suborganization, and user level display profile documents, if they exist, are overwritten.

    If you run importps -m, when the tool encounters a conflict with an existing display profile document it will merge it.

    ImportDir

    Specifies the directory where the converted data is located. If the directory does not exist or if the directory does not contain valid converted data, the import tool prompts you to enter a directory containing the converted data to be imported. If you do not specify an import directory, the import tool will search /tmp/psImport.

  5. The system displays messages similar to the following:
  6. Found Portal Server version 6.2

    Enter Identity Server Internal LDAP Authentication User password:

    Type in a valid password.

    Enter Appserver Administrator password.

    You see this prompt only if you are migrating onto a Sun ONE Application Server web container.

    Begin import process at Thu Jul 25 16:20:40 PDT 2003

    Error file: /tmp/psImport/logs/importerror.2560

    Report file: /tmp/psImport/logs/importreport.2560

    Metrics file: /tmp/psImport/logs/import_metrics.2560

    Import Menu:

    1) LDAP Database

    2) Rewriter Rules

    3) Desktop

    4) Certificate Databases

    5) All of the above

    6) Exit

    You see the import menu only if you do not specify the -a option.

  7. Type 3 and press Enter to import only the Desktop.
  8. The system displays messages similar to the following:

    Extracting desktop templates

    Extracting locale resource bundles

    Extracting static webserver data

    Redeploying portal web application

    Deploying to instance host1.siroe.com...

    Successful completion of import process at Thu Jul 25 16:25:30 PDT 2003

    After the import has completed, or if you run into problems, check the ImportDir/logs directory for the importreport.PID, importerror.PID, and import_metrics.PID files (where PID is the process ID). The importreport.PID file contains actions the import tool has or has not taken and also alerts you to any customizations which you need to import manually. The importerror.PID file contains warnings or errors so that you can correct any problems. The import_metrics.PID file contains metrics detailing when various elements of the import tool started, stopped, and the total time it took to import the data. You can look at the stdout header to know which log and report files to examine for the importps command you are running.


Desktop Post-Migration Issues and Tasks

Depending on customizations you have made to the Sun ONE Portal Server 3.0 Desktop and depending on your personal preferences, you may need to perform manual steps to your Sun ONE Portal Server 6.2 system after migrating the Desktop.

This section describes post migration issues and tasks you may need to perform after migrating the Desktop.

Desktop Links and Colors

If you are using a tabbed Desktop, after you migrate the Desktop from Sun ONE Portal Server 3.0 to Sun ONE Portal Server 6.2, the links and colors on the Desktop in Sun ONE Portal Server 6.2 are different from the links and colors on the Desktop in Sun ONE Portal Server 3.0. This section describes these differences.

Links

In Sun ONE Portal Server 3.0, the Desktop links are:

Home | Options | Contents | Layout | Help | Log Out

After migrating the Sun ONE Portal Server 3.0 Desktop to Sun ONE Portal Server 6.2, if using the tabbed Desktop, the Desktop has the following links:

Home | Tabs | Options | Theme | Help | Log Out

Under each tab, there is a link for Content and Layout.

Colors

If you are using a tabbed Desktop, after you migrate from Sun ONE Portal Server 3.0 to Sun ONE Portal Server 6.2, the background is navy blue rather than black. This is because the Sun ONE Portal Server 6.2 menubar template for the tabbed Desktop is used. There is no one-to-one mapping between the Sun ONE Portal Server 3.0 iwtDesktop and the Sun ONE Portal Server 6.2 TemplateTabContainer, TemplateTabContainerProvider, and each TemplateTabCustomTableContainerProvider. Therefore the customization of the tabbed Desktop menubar.template and each tab subcontainer is a manual process after migration. After migration, each tab’s Content and Layout links should be manually removed.

Background Color of the Channel Title Bar Does Not Line up with the Channel Border

Channels without action icons such as Help, Edit, and so on, do not align correctly with the channel content in Netscape 4.x. To resolve this problem, for each template container, modify providerWrapper.template by adding a non-breaking space before the provider commands tag. For example, instead of:

<TD BGCOLOR="#666699" NOWRAP>

  <P ALIGN=RIGHT>

    [tag:provider_cmds]

</TD>

you should use:

<TD BGCOLOR="#666699" NOWRAP>

  <P ALIGN=RIGHT>&nbsp;

    [tag:provider_cmds]

</TD>

If this is a tabbed Desktop, modify TemplateTabCustomTableContainerProvider/providerWrapper.template for each template type. You may need to modify other containers depending on your deployment.

Duplicate Portal Server / Sun ONE Portal Server Banner

It is possible, after importing with the -m option, that you will see duplicate Portal Server and Sun ONE Portal Server banners with Desktop links. This can happen when the Samples tab is looking for a SamplesTemplatePanelContainer directory in the XML documents. When it cannot find this directory it then uses the provider directory which is the TemplateTabContainerProvider. The HTML in this directory includes the additional banner. To prevent this from happening, you can simply copy an existing panel container, such as MyFrontPageTemplatePanelContainer, to SamplesTemplatePanelContainer. This will resolve this issue.

RSS Channel Does Not Display Content

The RSS channel may not display content if the channel’s display profile URL attribute value retrieves content from an external system (not the portal server itself).

To resolve this issue, take the following steps:

  1. On the remote host, add the entry Content-Type=text/xml File Suffix=rdf,xml to the web server’s configuration mime.types, file. For example:
  2. type=text/xml exts=rdf,xml

  3. Restart the web server on the remote host. For example:
  4. BaseDir/SUNWips/bin/ipsserver start

    or

    /etc/init.d/ipsserver start

  5. On the portal server host, add the following rule to the idsruleset:
  6. <TagText tag="url" attributePatterns="" />

JavaScript Error

When using the Sun ONE Portal Server 6.2 menubar.template a JavaScript™ error is thrown because the Logout link expects to find the JavaScript function closePopup.

Online Help Is Not Localized

After a successful data migration, the channel help URLs will not have the locale in the URL. For example, the URLs will be similar to:

http://host/portal/docs/online_help/...

To localize the online help, update the display profile documents and provide the correct <ConditionalProperties> definition. For example, for the locale en_US use the <ConditionalProperties> definition to define the helpURL as:

<ConditionalProperties condition="locale" value="en">

  <ConditionalProperties condition="locale" value="US">

    <String name="helpURL"
      value="online_help/user_help/desktop/desktopTOC.html"
      advanced="true"/>

  </ConditionalProperties>

</ConditionalProperties>

After defining the helpURL, the Desktop Channel Help URL will be similar to:

http://host/portal/docs/en_US/online_help/...


Writing Data Migration Modules

See Appendix B, "Sun ONE Portal Server 3.0 Data Migration Module Author's Guide" for information on writing your own data migration modules.


Migrating Custom Channels and Custom Providers

This section discusses the steps you must take to migrate custom channels and custom providers from Sun ONE Portal Server 3.0 to Sun ONE Portal Server 6.2. In addition to following the steps for migrating the Desktop discussed in this chapter, manual changes to provider code are necessary for your custom providers to work in Sun ONE Portal Server 6.2. You will need to read the Sun ONE Portal Server 6.0 Desktop Customization Guide and the Javadocs for the Sun ONE Portal Server 6.2 Desktop in order to understand what you need to do.

Overview of the Process of Migrating Custom Providers

  1. Run the export tool on the Sun ONE Portal Server 3.0 system.
  2. Run the conversion tool on the Sun ONE Portal Server 6.2 system.
  3. Run the import tool on the Sun ONE Portal Server 6.2 system.
  4. Copy the custom Java™ files to a working directory where you can compile against the new install jar files.
  5. Follow the steps in the section on Making Manual Changes to Provider Code to rework code manually.
  6. Compile using javac or Forte™ for Java, after importing the appropriate jar.
  7. Add compiled provider classes to the classes directory.
  8. Add any utility jar files to the classes directory.

You do not have to restart the server because the class loader will pick up the new classes.

Research and Planning

This section discusses research and planning recommendations that you should follow before migrating custom channels and custom providers.

Reading Documentation

Take the time to read the Sun ONE Portal Server 6.2 documentation, Sun ONE Portal Server 6.2 APIs, Sun ONE Identity Server 6.1, and Sun ONE Identity Server SDK and API documentation.

Training Your Staff

The documentation for Sun ONE Portal Server 6.2 and Sun ONE Identity Server 6.1 is extensive and serves as a great starting point to help you migrate to Sun ONE Portal Server 6.2. You may also wish to take advantage of any training available for Sun ONE Portal Server 6.2 and Sun ONE Identity Server 6.1.

Defining the Features of Sun ONE Portal Server 6.2 You Plan to Use

After reading the available documentation and attending any subsequent training, the next recommended step is to take into account all the new features you want your providers to take advantage of as you plan to migrate them. For instance, the non-tabbed Desktop is migrated to a TemplateTableContainer and the tabbed Desktop is migrated to a TemplateTabContainer.

Taking Inventory of Custom Provider Code Used in Your Sun ONE Portal Server 3.0 Deployment

You should create an inventory of custom provider code used in your Sun ONE Portal Server 3.0 deployment. This inventory is useful when initiating a project plan for migrating custom provider code and should account for ascertaining the answers to some preliminary questions like:

Initiating a Project Plan for Ensuring Custom Provider Conversion

In order to accomplish conversion of custom providers from Sun ONE Portal Server 3.0 to Sun ONE Portal Server 6.2, it is recommended that a project plan be developed that indicates milestones, tasks, and resources necessary to smooth the transition of these providers.

Preparing Your Test Environment

In order to migrate custom providers, you should set up a test environment of Sun ONE Portal Server 6.2. This can be done on the same system as your Sun ONE Portal Server 3.0 test environment or on a clean system.

Running the Migration Tools

Once your Sun ONE Portal Server 6.2 system is set up, you should run the migration tools as documented in this guide. This will migrate the provider's LDAP data (including custom provider attributes), provider templates, and so on to the Sun ONE Portal Server 6.2 environment.

Validating Custom Provider Data Migration

After migrating from Sun ONE Portal Server 3.0, you should see the following items already migrated for your custom providers by the tools:

Making Manual Changes to Provider Code

This section discusses the steps you need to follow in order to change provider code manually so that your Sun ONE Portal Server 3.0 custom providers work in Sun ONE Portal Server 6.2. You will need to read the Javadocs for the Sun ONE Portal Server 6.2 Desktop in order to make these correctly.

  1. Move your source code to the Sun ONE Portal Server 6.2 system if it is different from the Sun ONE Portal Server 3.0 system. The classes directory is specified in the /etc/opt/SUNWps/desktop/desktopconfig.properties file. By default, the directory is BaseDir/SUNWps/desktop/classes.
  2. Set your CLASSPATH environment variable. Before compilation you need to change your CLASSPATH setting to include the Desktop SDK jar, for example:
  3. CLASSPATH: BaseDir/SUNWps/sdk/desktop/desktopsdk.jar

    If you are using any Sun ONE Identity Server APIs directly, you may also need to include the Sun ONE Identity Server SDK.

    Include any other Java classes and jar files that your custom provider code relies on.

  4. Change import statements by removing:
    • session.Session
    • session.SessionException
    • util.Debug
  5. Use the new debug by making the following changes:
    • Comment out import.
    • Comment out static block.
    • Use getProviderContext().debugMessage(“message goes here”).
    • Use getProviderContext().isDebugMessageEnabled() boolean check around the log statement
  6. Change getStringProperty calls by removing the first string in the signature, component, by changing from:
  7. getStringProperty(component, tag, default)

    to:

    getStringProperty(tag, default)

    Another API which enables you to get the localized version of the string from the display profile is getStringProperty(tag, default, true);.

    You can also use methods such as getBooleanProperty and getIntegerProperty, which deal with Boolean and integer values.

  8. Wrap getStringProperty calls with try/catch for ProviderContextException. getStringProperty throws ProviderException.
  9. Change calls to getResourceBundle so they are wrapped in a try block that catches the ProviderException.
  10. Remove the store() method. This has been eliminated because getStringProperty and others have been extended to encompass this functionality.
  11. Changes to getContent(Map) are optional. See the provider API documentation.
  12. Compile your code. Use the javac command line script to compile your code. Then, discover and fix any errors. There will most likely be errors that involve the specifics of your custom provider.
  13. Verify your migrated custom providers by checking:
    • That the channel properties in the display profile have been migrated correctly.
    • That users can log in and the migrated channels based on the custom provider are available on the Desktop.
    • That the custom provider has no errors in normal operation (display of content, edit, help, and so on). You can check logs in /var/opt/SUNWam/debug/.
    • That your channel’s attributes based on the custom provider can be administered via the Sun ONE Portal Server 6.2 admin console and that changing these attributes has no adverse affect for your users.
    • Desktop errors located in the /var/opt/SUNWam/debug/desktop.debug file and other errors located in files with corresponding names in that directory.

Common Errors Encountered and Recommended Fixes

The list below includes common errors that you may encounter when compiling your custom providers via the javac command-line script. It includes answers to these issues as known to date.

Information About Channel Migration

For any channel, these are the other important components:

Example Custom Provider: Manual Code Changes for Migration

//change package from: com.iplanet.portalserver.providers.quotations;

package com.sun.portal.providers.quotations;

// Use some basic Java classes

import java.lang.*;

import java.io.*;

import java.util.*;

import java.net.*;

// Use some basic Java Servlet classes

import javax.servlet.*;

import javax.servlet.http.*;

// Use some iPS classes

//change to correct package name:

//import com.iplanet.portalserver.desktop.util.*;

import com.sun.portal.desktop.util.*;

//import com.iplanet.portalserver.providers.*;

import com.sun.portal.providers.*;

//change: import com.iplanet.portalserver.desktop.util.ParameterMap;

import com.sun.portal.desktop.util.ParameterMap;

//change: import com.iplanet.portalserver.desktop.util.Target;

import com.sun.portal.desktop.util.Target;

//change: import com.iplanet.portalserver.providers.ProfileProviderAdapter;

import com.sun.portal.providers.ProfileProviderAdapter;

//change: import com.iplanet.portalserver.providers.Provider;

import com.sun.portal.providers.Provider;

//change: import com.iplanet.portalserver.providers.ProviderException;

import com.sun.portal.providers.ProviderException;

//remove: import com.iplanet.portalserver.session.Session;

//remove: import com.iplanet.portalserver.session.SessionException;

//remove: import com.iplanet.portalserver.util.Debug;

//remove: import com.iplanet.portalserver.profile.*;

// The QuotationProvider Class

// This is a sample desktop provider application used to display

// famous/humorous quotations on the desktop.

//

// It shows how to use the BaseProvider API to:

// - display html content on the desktop

// - allow the user to edit attributes

//

// It also invokes the Session, Profile and Logging APIs in order to:

// - get/set user-level attributes regarding quotation preferences

// - provide logging

public class QuotationProvider extends ProfileProviderAdapter implements Provider {

//remove: private static Debug debug = Debug.getInstance(“iwtQuotationsProvider”);

//remove: static {

// debug.setDebug();

//}

// The constructor - don’t need to do any special initialization

// so just invoke the ProfileProviderAdapter’s constructor

public QuotationProvider() {

super();

}

// Generate the HTML that will be displayed in this content provider’s

// area on the desktop

//getContent has a new signature, this method will be deprecated

public StringBuffer getContent(Map m) throws ProviderException {

StringBuffer content = new StringBuffer(); // Contains the HTML to be

// displayed

Hashtable quotesHash = new Hashtable(); // A Hash of quote vectors,

// one vector per category

BufferedReader quotesReader; // Used to read the quotes

String quote; // A single quotation

Random randomGenerator = new Random(); // To randomly pick quotes

// Read in the quotations into a Hashtable of Vectors, each containg

// the quotations of a specific category. If we can’t read the

// quotations file it’s okay - we just won’t display any quotes later.

// The category and quotation are separated by a “|” in the quotations

// file.

try {

//Change: all getStringProperty() calls to accept only the last two arguements, the component arg was removed.

// Change: String quotationFileName = getStringProperty(“iwtQuotationProvider, “fileLocation”, “/”);

String quotationFileName = getStringProperty(“iwtQuotationProvider, “fileLocation”, “/”);

quotesReader = new BufferedReader(new FileReader(new File(quotationFileName)));

while ((quote = quotesReader.readLine()) != null) {

String type = quote.substring(0,quote.indexOf(‘|’));

if (!quotesHash.containsKey(type)) {

quotesHash.put(type,new Vector());

}

((Vector)(quotesHash.get(type))).addElement(quote.substring(quote.indexOf(‘|’)+1));

}

} catch (ProviderContextException pe) {

}catch (Exception e) {

}

// Determine is user’s preference is to display the category along with

// a quotation.

boolean displayCategories = true;

// Change: if (getStringProperty(“iwtQuotationProvider”, “displayCategories”, “false”).equals(“false”)) {

try {

if (getStringProperty(“displayCategories”,”false”).equals(“false”)) {

} catch (ProviderContextException pe) { }

displayCategories = false;

}

// Get the possible quotation categories.

Enumeration e =

//Change: getListProperty(“iwtQuotationProvider”, “selectedCategories”, new Vector()).elements();

getListProperty(“selectedCategories”, new Vector()).elements();

// Print a quotation for each category selected by the user.

while (e.hasMoreElements()) {

String category = (String)e.nextElement();

// If the user wanted to display the category along with the

// quotation then do so.

if (displayCategories) {

//Remove: content = getTemplate(“category.template”);

Hashtable catgoryTags = new Hashtable();

try {

String category = getStringProperty(“category”, ““);

} catch (ProviderContextException pe) { }

//Remove: content.append(category);

contentTags.put(“quotations-category”, category);

//remove: content = swap.doSwap(content,contentTags);

content.append( getTemplate(“category.template”,categoryTags) );

}

// If there are any quotations for this category, pick a random

// one and display it, otherwise note that we didn’t find one.

if (quotesHash.containsKey(category)) {

Vector quoteVector = (Vector)quotesHash.get(category);

int whichQuoteIndex = Math.abs(randomGenerator.nextInt())%(quoteVector).size();

content.append(“<UL>”);

content.append(“<LI>”);

content.append((String)(quoteVector.elementAt(whichQuoteIndex)));

content.append(“</LI>”);

content.append(“</UL>”);

} else {

content.append(“<UL>”);

content.append(“<LI>”);

content.append(“(no quotes of this type found)”);

content.append(“</LI>”);

content.append(“</UL>”);

//New: add catch for provider exception around Resource Bundles.

try {

errMsg = getResourceBundle(“iwtQuotationProvider”).getString(“QuotationProvider-NoQuotesFound”);

} catch (ProviderException pe) {

errMsg = “There are no quotes found.”;

}

//New: use new message logging functionality

if (getProviderContext().isDebugMessageEnabled()) {

getProviderContext().debugMessage( errMsg );

}

}

}

// Now return the HTML we have constructed.

return content;

}

// Generate the HTML that will be displayed to let the user set

// his/her preferneces.

//optional: getEdit() method signature is different, customer may want to move to new implementation

public StringBuffer getEdit(Map m) throws ProviderException {

// Contains the HTML to be displayed

StringBuffer content = new StringBuffer();

// Display things in a single column table - so things line up.

content.append(“<P><TABLE>”);

// Let the user choose which categories s/he wants.

content.append(“<TR>”);

content.append(“<TD VALIGN=\”top\” HALIGN=\”left\”>”);

content.append(“Types of Quotes to Display”);

content.append(“</TD>”);

// Get the user’s selected categories

Vector selectedCategories = new Vector();

Enumeration e2 =

getListProperty(“selectedCategories”, new Vector()).elements();

while (e2.hasMoreElements()) {

selectedCategories.addElement((String)e2.nextElement());

}

// List the possible categories, marking those that have already

// been selected by the user.

content.append(“<TD VALIGN=\”top\” HALIGN=\”left\”>”);

Enumeration e =

getListProperty(“possibleCategories”, new Vector()).elements();

while (e.hasMoreElements()) {

String category = (String)e.nextElement();

content.append(“<INPUT TYPE=\”checkbox\” NAME=\”category-”);

content.append(category);

content.append(“\” VALUE=\””);

content.append(category);

content.append(“\””);

if (selectedCategories.contains(category)) {

content.append(“ CHECKED”);

}

content.append(“>”);

content.append(category);

content.append(“<BR>”);

}

content.append(“</TD>”);

content.append(“</TR>”);

// Let the user decide if they want to display a category with

// each quotation.

content.append(“<TR>”);

content.append(“<TD VALIGN=\”top\” HALIGN=\”left\”>”);

content.append(“<INPUT TYPE=\”checkboX\” NAME=\”display_categories\” VALUE=\”yes\””);

try {

if (getStringProperty(“displayCategories”,”true”).equals(“true”)) {

content.append(“ CHECKED”);

}

} catch (ProviderContextException pe) { }

content.append(“>Display the Category Along With the Quotation”);

content.append(“</TD>”);

content.append(“</TR>”);

content.append(“</TABLE>”);

return content;

}

// Handle the submittal of the edit form.

//optional: processEdit() method signature is different, customer may want to move to new implementation

public URL processEdit(Map m) throws ProviderException {

Hashtable req = new Hashtable(m);

Enumeration parameterNames = req.keys();

Vector categorySelections = new Vector(); // Categories user picked

boolean displayCategories = false; // Display category too ?

// Check all the passed parameters and add the selected categories

// as well as check to see if user opted to display categories.

while (parameterNames.hasMoreElements()) {

String parameter = (String)parameterNames.nextElement();

if (parameter.equals(“display_categories”)) {

displayCategories = true;

} else if (parameter.startsWith(“category-”)) {

String []category = (String [])req.get(parameter);

categorySelections.addElement(category[0]);

}

}

// Set the list of selected categories for later storing in the

// profile database.

setListProperty(“selectedCategories”, categorySelections);

// Set whether the user wants to display categories or not for later

// storing in the profile database.

if (displayCategories) {

setStringProperty(“displayCategories”, “true”);

} else {

setStringProperty(“displayCategories”, “false”);

}

// Done processing the edit form - now store the user’s preferences.

//Remove: store() method is obsolete

super.processEdit(parameterNames); ?

//} catch (ProfileException pe) { }

return null;

}

}



Previous      Contents      Index      Next     


Copyright 2004 Sun Microsystems, Inc. All rights reserved.