Custom Registry Modules  Locate

In this section, we will show you how to extend BEA AquaLogic Service Registry functionality with your custom modules. Custom modules can be added to BEA AquaLogic Service Registry as shown in Figure 8.

Figure 8. Custom Registry Module - Architecture View

Custom Registry Module - Architecture View

To create and deploy a registry module, follow these steps:

  1. Write a class that implements org.systinet.uddi.module.Module.

  2. Copy your module implementation class to the directory REGISTRY_HOME/app/uddi/services/Wasp-inf/classes.

  3. Create a configuration file for the module in REGISTRY_HOME/app/uddi/conf.

  4. Shutdown BEA AquaLogic Service Registry, delete the REGISTRY_HOME/work directory, and restart the registry.

The main class of the custom module must implement org.systinet.uddi.module.Module interface that has these methods:

Accessing Registry APIs  Locate

To access the BEA AquaLogic Service Registry API you must obtain the API stub using the getApiInstance() method of the API implementation class. For example to obtain the stub of the Statistics API use:

StatisticsApi statapi = StatisticsApiImpl.getApiInstance();            
        

Mapping between API interface classes and implementation classes is stored in the REGISTRY_HOME/app/uddi/services/Wasp-inf/package.xml file. See Table 52, “Mapping API Interface and Implemenation Classes”.

Table 52. Mapping API Interface and Implemenation Classes

Interface classImplementation class
org.systinet.uddi.client.v1.InquireSoapcom.systinet.uddi.inquiry.v1.InquiryApiImpl
org.systinet.uddi.client.v1.PublishSoapcom.systinet.uddi.publishing.v1.PublishingApiImpl
org.systinet.uddi.client.v2.Publishcom.systinet.uddi.publishing.v2.PublishingApiImpl
org.systinet.uddi.client.v2.Inquirecom.systinet.uddi.inquiry.v2.InquiryApiImpl
org.systinet.uddi.client.v3.UDDI_Security_PortTypecom.systinet.uddi.v3.SecurityApiImpl
org.systinet.uddi.client.v3.UDDI_Publication_PortTypecom.systinet.uddi.publishing.v3.PublishingApiImpl
org.systinet.uddi.client.v3.UDDI_Inquiry_PortTypecom.systinet.uddi.inquiry.v3.InquiryApiImpl
org.systinet.uddi.client.subscription.v3.UDDI_Subscription_PortTypecom.systinet.uddi.subscription.v3.SubscriptionApiImpl
org.systinet.uddi.client.custody.v3.UDDI_CustodyTransfer_PortTypecom.systinet.uddi.custody.v3.CustodyApiImpl
org.systinet.uddi.replication.v3.ReplicationApicom.systinet.uddi.replication.v3.ReplicationApiImpl
org.systinet.uddi.client.wsdl2uddi.v3.Wsdl2uddiApicom.systinet.uddi.wsdl2uddi.v3.Wsdl2uddiApiImpl
org.systinet.uddi.client.wsdl2uddi.v2.Wsdl2uddiApicom.systinet.uddi.wsdl2uddi.v2.Wsdl2uddiApiImpl
org.systinet.uddi.client.category.v3.CategoryApicom.systinet.uddi.category.v3.CategoryApiImpl
org.systinet.uddi.client.taxonomy.v3.TaxonomyApicom.systinet.uddi.taxonomy.v3.TaxonomyApiImpl
org.systinet.uddi.statistics.StatisticsApicom.systinet.uddi.statistics.StatisticsApiImpl
org.systinet.uddi.admin.AdministrationUtilsApicom.systinet.uddi.admin.AdministrationUtilsApiImpl
org.systinet.uddi.permission.PermissionApicom.systinet.uddi.permission.PermissionApiImpl
org.systinet.uddi.group.GroupApicom.systinet.uddi.group.GroupApiImpl
org.systinet.uddi.account.AccountApicom.systinet.uddi.account.AccountApiImpl
org.systinet.uddi.configurator.ConfiguratorApicom.systinet.uddi.configurator.cluster.ConfiguratorApiImpl

Custom Module Sample  Locate

This section includes step-by-step instructions how to create a registry module that counts the number of restarts of BEA AquaLogic Service Registry and saves the result to a configuration file.

Follow these steps:

  1. Create Java file ExampleModule.java as shown in Example 7

  2. Compile the module using java -classpath "%REGISTRY_HOME%\app\uddi\services\Wasp-inf\lib\application_ core.jar; %REGISTRY_HOME%\lib\wasp.jar" ExampleModule.java

  3. Copy all module classes (ExampleModule.class, ExampleModule$RestartConfig$Counter.class, ExampleModule$RestartConfig.class) to the REGISTRY_HOME/app/uddi/services/Wasp-inf/classes/com/systinet/example/module directory.

  4. Create the configuration file mymodule.xml in REGISTRY_HOME/app/uddi/conf folder. For details, please see Example 8.

  5. Shutdown BEA AquaLogic Service Registry, delete the REGISTRY_HOME/work directory, and restart the registry.

The number of restarts will be printed in the window console in which you started BEA AquaLogic Service Registry. See also the configuration file of the module where a new element counter is created.

Example 7.  ExampleModule.java

package com.systinet.example.module;

import org.idoox.config.Configurable;
import org.systinet.uddi.module.Module;

public class ExampleModule implements Module {
    private long restart = 0;
    private RestartConfig.Counter counter;

    interface RestartConfig {
        public Counter getCounter();
        public void setCounter(Counter counter);
        public Counter newCounter();
        interface Counter {
            public long getRestart();
            public void setRestart(long restart);
        }
    }

    public void load(Configurable config) {
        System.out.println("MY MODULE CONFIG READING");
        RestartConfig restartConfig = (RestartConfig) config.narrow(RestartConfig.class);
        if (restartConfig != null) {
            counter = restartConfig.getCounter();
            if (counter == null) {
                counter = restartConfig.newCounter();
                restartConfig.setCounter(counter);
            }
            try {
                restart = counter.getRestart();
            } catch (Exception e) {
                counter.setRestart(0);
            }
        }
    }

    public void init() {
        System.out.println("MY MODULE STARTED");
        counter.setRestart(++restart);
        System.out.println("UDDI REGISTRY: number of restarts = " + restart);
    }

    public void destroy() {
    }
}

Example 8. Example configuration file for custom module

<?xml version="1.0" encoding="UTF-8"?>
<config name="myconf">
    <module loader="com.systinet.example.module.ExampleModule" name="MyModule">
    </module>
</config>