Writing a Content Checker  Locate

In this section, we will show you how to create a content checker. The content checker provides an approver the ability to programmatically check data for approval. We assume you are familiar with the Approval Process, which is described in the following sections:

We will show you how to create and deploy a content checker on the following example: an Approver set a rule that each business entity name must start with prefix "org_". Data that does not satisfy this rule cannot be approved (that is, copied to a discovery registry). The content checker is executed when a approver clicks on the Approve button in the Approve request page of the Oracle Service Registry console.

To set up this optional content checking:

  1. Write a class that implements the class org.systinet.uddi.approval.checker.v3.CheckerApi.

  2. Deploy the implementation class to the Oracle Service Registry.

  3. Register the implementation of the content checker class in the Oracle Service Registry's data.

Now, we will look at the steps in detail:

  1. Write a class that implements the org.systinet.uddi.approval.checker.v3.CheckerApi

    1. Create the content checker class as shown in Example 15.

    2. Compile the CheckerApiImpl.java, and add jars from the directory PUBLICATION_REGISTRY_HOME/dist to the class path.

  2. Deploy the implementation class to the Oracle Service Registry.


    In the case of deployment to an application server, you must make the modifications in the location where they will be used. This may mean in the registry directory where registry is unpacked inside the application server, not in the installation directory. If the registry is not yet deployed, but the WAR/EAR file is available, modify the WAR/EAR file first and then deploy it. The relative paths for files are the same but PUBLICATION_REGISTRY_HOME is different.

    1. Copy the CheckerApiImpl.class to the file PUBLICATION_REGISTRY_HOME/app/uddi/services/WASP-INF/lib/approval_staging_v3.jar to the folder com/systinet/uddi/approval/v3/approver inside the jar file.

    2. Shutdown the Publication Registry, delete the PUBLICATION_REGISTRY_HOME/work directory, and restart the Publication Registry.

  3. Register the implementation of the content checker class in the Oracle Service Registry data.

    1. Log on to the Publication Registry as an approver. The content checker will be applicable to an approver who follows these steps:

    2. Publish the WSDL of the checker service:

      Publish the WSDL located at http://<host_name>:<http_port>/uddi/doc/wsdl/approval_checker.wsdl to a new or already existing business entity. Use the Advanced publishing mode and be sure to reuse the existing WSDL portType (tModel name:CheckerApi, tModel's key: uddi:systinet.com:uddi:service:porttype:approvalchecker). The WSDL service approval_checker_SoapService will be published under the business entity.

    3. Specify the checker in the access point of a new binding template under the approval_checker_SoapService service.

      Enter the value of access point which starts with the class: prefix and continue with the fully qualified class name. For example, class:com.systinet.uddi.approval.v3.approver.CheckerApiImpl.

Example 15.  Content Checker Implementation

package com.systinet.uddi.approval.v3.approver;

import org.systinet.uddi.InvalidParameterException;
import org.systinet.uddi.approval.checker.v3.CheckerApi;
import org.systinet.uddi.approval.checker.v3.struct.CheckRequest;
import org.systinet.uddi.approval.v3.ApprovalErrorCodes;
import org.systinet.uddi.approval.v3.ApprovalException;
import org.systinet.uddi.approval.v3.struct.ApprovalEntitiesDetail;
import org.systinet.uddi.approval.v3.struct.EntitiesDetail;
import org.systinet.uddi.client.v3.struct.*;

 * Checks if a BE starts with org_
public class CheckerApiImpl implements CheckerApi {

    public DispositionReport checkRequest(CheckRequest checkRequest)
            throws ApprovalException {

        try {
            ResultArrayList resultArrayList = new ResultArrayList();

            ApprovalEntitiesDetail approvalEntitiesDetail = 
            if (approvalEntitiesDetail != null) {
                EntitiesDetail entitiesDetail4Saving = 
                BusinessEntityArrayList businessEntityArrayList = 
                if (businessEntityArrayList != null) {
                    for (int i = 0; i < businessEntityArrayList.size(); i++) {
                        BusinessEntity businessEntity = businessEntityArrayList.get(i);
                        if (businessEntity != null) {
                            NameArrayList nameArrayList = 
                            for (int j = 0; j < nameArrayList.size(); j++) {
                                Name name = nameArrayList.get(j);
                                if (name != null && !name.getValue().startsWith("org_")) {
                                      new Result(ApprovalErrorCodes.INVALID_DATA,
                                            new ErrInfo(ApprovalErrorCodes.getCode(
                                      "Only business entities whose name start with the " + 
                                      "prefix \"org_\" are allowed" +
                                      " (BE [key: " + businessEntity.getBusinessKey() + 
                                      ", name: " + name.getValue() + "])"),

            if (resultArrayList.size() > 0) {
                return new DispositionReport(resultArrayList);
            } else {
                return DispositionReport.DISPOSITION_REPORT_SUCCESS;
        } catch (InvalidParameterException e) {
            // should not occur
            throw new ApprovalException(ApprovalErrorCodes.FATAL_ERROR, e.getMessage());