2 Building and Deploying an OUD Plug-In

This chapter describes how to build and to deploy an Oracle Unified Directory (OUD) plug-in that does not perform any action. This chapter contains the following sections:

2.1 Before You Begin

Prepare your development environment by completing the following tasks:

  • Install Oracle Unified Directory and create a new instance with fifty generated entries.

  • Install the Java Development Kit with the exact same version of the Java Runtime Environment running in the Oracle Unified Directory instance.

  • Create a new project for the development of your plug-in using your favorite integrated development environment (IDE), and reference the JAR file oud.jar that is located in install-dir/OracleUnifiedDirectory/lib/oud.jar

2.2 To Deploy a Plug-In to an OUD Instance

  1. Create a new class that extends the class oracle.oud.plugin.AbstractPlugin. This class will not perform any action but will be part of the processing. For example:

    package oracle.oud.example;
    import oracle.oud.plugin.AbstractPlugin;
    /**
    * A plug-in that does not perform any action.
    */
    public class ExamplePlugin
    extends AbstractPlugin
    {
     
    }
    
  2. Build your plug-in project.

    The content of the generated plug-in JAR file should contain the following files:

    • META-INF/MANIFEST.MF

    • oracle/oud/example/ExamplePlugin.class

  3. To ensure that your plug-in will continue to work with subsequent releases of the OUD plug-in API, you can embed a specific versioning file in the produced JAR file. The name of the file to embed is plugin.properties.

    Make the following modifications to the plugin.properties file:

    1. To define a target version for all plug-ins contained in the JAR file, add the following:

      plugin.version=11.1.2.1.0

    2. To define a target version only for the ExamplePlugin plug-in, specify the following:

      plugin.ExamplePlugin.version=11.1.2.1.0

    If the plugin.properties file is missing, then the behavior of the current implementation of the plug-in API applies.

  4. Restart the Oracle Unified Directory instance for the JAR file changes to take effect.

    1. Stop the OUD instance.

      UNIX, Linux
      $ cd instance-directory/OUD/bin
      $ stop-ds
      
      Windows
      C:\> cd instance-directory\OUD\bat
      C:\> stop-ds
      
    2. Copy the plug-in JAR file into the lib directory.

      UNIX, Linux
      # cp plugin.jar lib
      
      Windows
      C:\> copy plugin.jar lib
      
    3. Restart OUD instance.

      UNIX, Linux
      # start-ds
      
      Windows
      C:\> start-ds
      
  5. Modify the server configuration so that your plug-in is part of the server processing.

    Use the dsconfig command to declare a plug-in as a workflow element in an OUD server. You must specify the following information:

    • A plug-in name (ExamplePlugin in the example) that uniquely identifies this plug-in instance

    • The name of the Java class that implements the oracle.oud.plugin.ManagedPlugin Java interface

    • Whether the plug-in is enabled or disabled

    • The name of the workflow element that is behind the plug-in to be inserted.

      A plug-in may have 0, 1, or more next workflow elements depending on the use case it implements. For example:

    # dsconfig create-workflow-element \
        --set enabled:true \ 
        --set plug-in-class:oracle.oud.example.ExamplePlugin \ 
        --set next-workflow-elements:userRoot \ 
        --type plug-in \
        --element-name ExamplePlugin
    

After creating the plug-in, insert a plug-in workflow element in a workflow. The plug-in workflow element should appear either as the next element of a workflow, or as the next element of an existing workflow element. The following command changes the configuration of the workflow userRoot0 to forward LDAP requests to the previously added example plug-in:

# dsconfig set-workflow-prop \ 
    --workflow-name userRoot0 \ 
    --set workflow-element:ExamplePlugin

It is possible to create several instances of the same plug-in implementation as long each instance has a unique name.