Sun Java System Portal Server 7 Developer's Guide

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