6 Developing Scheduled Tasks

Oracle Identity Manager contains a set of predefined tasks that can be scheduled as job runs. An example is a password warning task that sends email to users for password expiration.

Oracle Identity Manager also provides the capability of creating your own scheduled tasks. You can create scheduled tasks according to your requirements if none of the predefined scheduled tasks fit your needs.

For example, you can configure a reconciliation run using a scheduled task that checks for new information on target systems periodically and replicates the data in Oracle Identity Manager.

This chapter explains how to create and implement your custom scheduled tasks. It contains these topics:

6.1 Overview of Task Creation

This section outlines the essential steps in creating scheduled tasks, and presents an example to illustrate the process. Subsequent sections provide details on each step.

6.1.1 Steps in Task Creation

The basic steps for configuring new scheduled tasks are as follows:

  1. Review Oracle Identity Manager's predefined scheduled tasks to determine whether a custom task is necessary.

    For details about the predefined tasks, see "Managing Scheduled Tasks" in the Oracle Fusion Middleware System Administrator's Guide for Oracle Identity Manager.

  2. Determine key features of the scheduled task, such as the task name and the parameters that control the actions performed by the task.

    For details, see Section 6.2, "Define the Metadata for the Scheduled Task".

  3. Add the task metadata to the scheduled task XML file.

    For details, see Section 6.3, "Configure the Scheduled Task XML File".

  4. Develop the scheduled task Java class.

    For details, see Section 6.4, "Develop the Scheduled Task Class".

  5. Declare the new scheduled task as a plug-in.

    For details, see Section 6.5, "Configure the Plug-in XML File".

  6. Package the task files so that Oracle Identity Manager can locate the files and make the task available for jobs.

    For details, see Section 6.6, "Create the Directory Structure for the Scheduled Task".

6.1.2 Example of Scheduled Task

To illustrate the steps in developing a scheduled task, we use an example scheduled task that retrieves employee records belonging to the given department from a given IT resource.

In addition, our scheduled task should allow the user to specify the number of records to be retrieved and whether to include disabled records in the retrieval.

6.2 Define the Metadata for the Scheduled Task

Each scheduled task contains the following metadata information:

  • Name of the scheduled task

  • Name of the Java class that implements the scheduled task

  • Description

  • Retry Interval

  • (Optional) Parameters that the scheduled task accepts. Each parameter contains the following additional information:

    • Parameter Name

    • Parameter Data Type

    • Required/ Optional Parameter

    • Help Text

6.3 Configure the Scheduled Task XML File

Configuring the scheduled task XML file involves updating the XML file that contains the definitions of custom scheduled tasks. This section describes how to update the task XML file with the details of the new custom scheduled task.

You can modify the task.xml file located in the /db namespace of Oracle Identity Manager MDS schema, or you can create a custom scheduled task file. If you create a custom file, then the file name must be the same as the scheduled task name, with the .xml extension. You must import the custom scheduled task file to the /db namespace of Oracle Identity Manager MDS schema.

See Also:

Chapter 7, "Developing Plug-ins" for examples of plug-ins.


The scheduled task XML file can be imported into MDS using an Oracle WebLogic Server import utility. In a clustered environment, having the file in MDS avoids the need to copy the file on each node of the cluster.

For details about importing files into MDS, see Chapter 33, "MDS Utilities and User Modifiable Metadata Files".

The elements in the XML file reflect the task parameters that you described in Section 6.2, "Define the Metadata for the Scheduled Task".

Example 6-1 shows a sample XML code for the scheduled task described in the preceding paragraph. Note that all the parameters are declared to be required parameters in this example.

Example 6-1 Sample XML for a Scheduled Task

<scheduledTasks xmlns="http://xmlns.oracle.com/oim/scheduler">
        <description>Retrieve Employee Records For Given Department</description>
            <string-param required="true" helpText="Name of the department">Department Name</string-param>
            <string-param required="true" encrypted="false" helpText="Name of the department">Department Name</string-param>
            <number-param required="true" helpText="Number of Records to Be Retrieved">Number of Records</number-param>
            <boolean-param required="false" helpText="Retrieve disabled employee records?">Get Disabled Employees</boolean-param>

See Also:

Appendix A, "Scheduled Task Configuration File" for details about the elements in the scheduled task configuration file.

This is basically exporting the task.xml from MDS and then adding the required tags to it and importing it back into MDS.

You must export the task.xml file from MDS, add the required tags to the file, and then import it back to MDS. See Chapter 33, "MDS Utilities and User Modifiable Metadata Files" for information about exporting and importing MDS files.

6.4 Develop the Scheduled Task Class

The next step is to create a Java class to execute the task whose metadata was defined in the XML file. The Java class that implements a scheduled task is known as a scheduled task class.

To develop a Java class for the scheduled task:

  1. Create a Java class file that extends the oracle.iam.scheduler.vo.TaskSupport class and overrides the execute() method with processing logic based on your requirements.

  2. Create a JAR file for the Java class that you created. Name the JAR such that you can readily associate this JAR with your custom scheduled task.

    The JAR file can contain the dependent classes of the Java class. You can also create a separate JAR file for the dependent classes and place it in the lib/directory.

  3. Copy the JAR file into the lib/ directory.

  4. Repeat Steps 1 through 3 for every Java class that you want to create.

6.5 Configure the Plug-in XML File

You must configure the plugin.xml file in order to declare the scheduled task as a plug-in. See Chapter 7, "Developing Plug-ins" for more information about plug-ins.


Oracle recommends creating one plugin.xml file for one scheduled task. This is because when the plugin is unregistered, the corresponding package is deleted.

To configure the plugin.xml file:

  1. Create the plugin.xml file by using any text editor.


    Create the plugin.xml file only if no such file exists. If there are existing plugins, then add a new plugin element for the new plugin.

  2. Specify the plug-in point for the scheduled task by changing the value of the pluginpoint attribute of the plugins element to oracle.iam.scheduler.vo.TaskSupport.

    The following XML code block from the plugin.xml file shows the value entered within the plugins element:

    <plugins pluginpoint="oracle.iam.scheduler.vo.TaskSupport">


    For scheduled tasks, the <plugins> elment remains the same for all scheduled tasks.

  3. Add a <plugin> element for each scheduled task that you are adding.

    To specify the class that implements the plug-in (in this case, the scheduled task), change the value of the pluginclass attribute of the plugin element to the name of the Java class that implements the scheduled task. The following XML code block from the plugin.xml file shows sample values entered within the plugin element:

    <plugin pluginclass= "oracle.iam.scheduler.TestScheduler" version="1.0.1" name="scheduler element"/>

    After modification, the plugin.xml file looks similar to the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <plugins pluginpoint="oracle.iam.scheduler.vo.TaskSupport">
    <plugin pluginclass= "oracle.iam.scheduler.TestScheduler"
    version="1.0.1" name="scheduler element">
  4. Save and close the plugin.xml file.

6.6 Create the Directory Structure for the Scheduled Task

The final step in configuring the scheduled task is to create a plugin.zip file with the directory structure specified in Example 6-2. In this example, a single plug-in is being added, but there can be multiple pugins in the plugin.zip file. Scheduler requires that files be zipped in a particular structure and named according to a particular naming convention. This ensures that Oracle Identity Manager identifies the custom scheduled tasks and makes it available in Oracle Identity Manager Administrative and User Console while creating jobs

Example 6-2 Directory Structure for the Scheduled Task


Note that:

  • The XML file for the plug-in must be named plugin.xml.

  • The lib/ directory must contain only .JAR files. The lib/ directory consists of JAR files that contains the classes implementing the plug-in logic and the dependent library JAR files. In most instances, this directory consists of a single JAR file with the implementation of all the plug-ins that are specified in plugin.xml. See "Developing Plug-ins" for for information about the directory structure.

  • The directory for the scheduled task must contain the following files:

    • XML for the plug-in

    • JAR files

  • There is one plugin.zip file for all the plug-ins that you create.

In the preceding example, CLASS_NAME.JAR is the JAR file that you create in Section 6.4, "Develop the Scheduled Task Class".

After you create the plugin.zip file, if deploying in a clustered environment, register the plug-in to the database by using appropriate APIs. See "Registering and Unregistering Plug-ins By Using APIs" for details about registering plug-ins to Oracle Identity Manager by using APIs.


The XML for the plug-in must be named plugin.xml. Ensure that the lib directory contains only JAR files.