Sun Java System Portal Server 7 Developer's Guide

Chapter 14 WSRP: Validating Registration Data

This chapter contains the following sections:

Overview of WSRP Communication

A WSRP consumer, after learning of a producer existence, attempts to connect to the producer. When the consumer initially contacts the producer, the producer describes it’s capabilities and expectations through it’s service description. The producer can also require a consumer to provide information about itself in order to be able to access the services offered by the producer. The producer, in its service description, defines registration property keys (and descriptions thereof). The producer expects registering consumers to provide values for these keys.

The consumer describes its capabilities to the producer and also answers questions asked by the producer by providing registration property values in its registration data. At registration time, the consumer passes the registration data to the producer.

Registering with the Producer

For producers that require registration, the consumer must register to use the producer. The consumer passes registration data to the producer and the producer validates the registration data provided by the consumer. If the registration data is deemed valid, the producer returns the consumer a registration handle. The consumer uses the registration handle for all further communications with the producer.

If in-band registration is supported in the producer, the consumer can register through the WSRP registration port type. If in-band registration is not supported by the producer, the consumer administrator must manually obtain the registration handle from the producer administrator.

Validating the Registration Data

A registration validation process can be implemented for informing the producer whether a registration (data from a consumer) is valid. A public service provider interface (the RegistrationValidator interface), povided with the Portal Server software, allows the logic that determines the validity of registration data.

The RegistrationValidator Interface

RegistrationValidator is the Java interface for the registration validation service provider interface. Where non-standard logic is required for validating registration data from consumers, implement this Java interface to validate the data with arbitrary logic.

Each producer instance can be configured with a unique registration validator. The producer uses the configured registration validator when:

The RegistrationValidator interface will be passed the registration data and service description. It uses a subset of the information contained in those obejcts to determine the return value of the validate() method. The return value is a code indicating success or failure. Any non-negative value indicates that the validation was successful. Any negative value indicates a validation failure.

The integer code return value can be interpreted by the producer to provide meaningful error messages to users. That is, for each RegistrationValidator implementation, resource messages must be inserted into the producer’s resource bundle. When an attempt to add a registration via the administration console takes place, the administration console gets the RegistrationValidator and calls the validate() method. A return value greater or equal to zero indicates success (validation succeeded). A negative return value indicates that validation failed.

The administration console displays the localized human-readable message regarding the validation. Typically, this is used for error messages; but it can also be used to provide warning messages or differing success messages. Registration validation messages should be formatted as such:

<RV class name><code>=<mesage>

where:

For example, to provide a message for RegistrationValidator class com.sun.portal.foo.FooValidator and for validator code -23:

com.sun.portal.foo.bar.FooValidator-23=Unknown company name

Note –

Javadocs for RegistrationValidator class is available online at http://hostname:port/portal/javadocs.


Default Implementation

The Portal Server software WSRP producer includes two default RegistrationValidator implementations—DummyRegistrationValidator and DefaultRegistrationValidator.

The DummyRegistrationValidator class always returns code 0. The DefaultRegistrationValidator class verifies that every registration property defined in the service description’s registration property descriptions is present in the registration data’s registration properties, and that every registration property has a non-null, non-empty value.

By default, the DefaultRegistrationValidator is configured as active.

By default, the following messages are installed to support the DefaultRegistrationValidator class:

-1

Missing

-2

Unknown Validation Error

0

Success