User profile development options

The application developer has a few options for customizing the user profile support provided by IBM WAS. The Related information provides instructions and additional details about each option.

 

Extending the data represented in user profiles

Webapplications can maintain several pieces of data about users. You can extend the data representation to allow the collection of arbitrary name-value pairs.

Use the following interface with the com.ibm.websphere.userprofile.UserProfileExtender class to extend a user profile hash table...

com.ibm.websphere.userprofile.UserProfileProperties

This action enables you to place arbitrary name-value pairs in the user profile. Extending the hash table is similar to using the java.util.Dictionary class in the base JDK 1.x, or any of the classes that extend it.

 

Adding columns to the base user profile implementation

Application developers can customize user profiles by adding columns to the base user profile implementation. Adding new columns is accomplished by implementing the interface...

com.ibm.websphere.userprofile.UserProfileExtender

and extending the base class...

com.ibm.servlet.personalization.userprofile.UserProfile

The application developer can add columns to but not delete columns from the base implementation.

Adding columns is a two-step process, as follows...

  1. Extend the UserProfile class.

  2. Modify your existing servlets to use the new columns.

Several examples are available to demonstrate how to extend the base user profile implementation and utilize the extension with a servlet.

Example Description
UPServletExample.java Demonstrates how a servlet opens a user profile and prints the fields contained within.
UserProfileExtendedSample.java Shows how to extend the UserProfile class to add a column to the user profile for a cellular phone number.

The WebSphere Application Server administrator configures the User Profile Manager to point to the extended class.

UPServletExampleExtended.java Shows how to modify the UPServletExample servlet to include the cellular phone number in the output.
UserProfileExtended.java Shows how to extend a hash table to place arbitrary name-value pairs into the user profile.
UPServletExtended.java Shows how to extend the servlet. When any of the newly added columns are removed or replaced, look for the table named "USERPROFILE" in the database to which the user profile is configured and drop that table.

The examples are encoded in HTML for viewing in a browser. The documentation directory also contains nonHTML versions (.java files) that are ready for use.

 

Extending the User Profile enterprise bean and importing legacy databases

Application developers can extend the User Profile enterprise bean itself and import legacy databases into the user profile. The main advantage in extending the User Profile enterprise bean is to gain the ability to import existing databases into the user profile. You can also extend this enterprise bean to add columns to the base user profile implementation.

 

See Also

Managing user profiles
Example: UPServletExample.java
Example: UserProfileExtendedSample.java
Example: UPServletExampleExtended.java
Example: UserProfileExtended.java
Example: UPServletExtended.java