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:
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.
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.
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".
Add the task metadata to the scheduled task XML file.
For details, see Section 6.3, "Configure the Scheduled Task XML File".
Develop the scheduled task Java class.
For details, see Section 6.4, "Develop the Scheduled Task Class".
Declare the new scheduled task as a plug-in.
For details, see Section 6.5, "Configure the Plug-in XML File".
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".
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.
Each scheduled task contains the following metadata information:
Name of the scheduled task
Name of the Java class that implements the scheduled task
(Optional) Parameters that the scheduled task accepts. Each parameter contains the following additional information:
Parameter Data Type
Required/ Optional Parameter
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.
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.
<scheduledTasks xmlns="http://xmlns.oracle.com/oim/scheduler"> <task> <name>Test_scheduled_task</name> <class>oracle.iam.scheduler.TestScheduler</class> <description>Retrieve Employee Records For Given Department</description> <retry>5</retry> <parameters> <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> </parameters> </task> </scheduledTasks>
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.
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:
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.
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:
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.
Specify the plug-in point for the scheduled task by changing the value of the
pluginpoint attribute of the plugins element to
The following XML code block from the plugin.xml file shows the value entered within the plugins element:
For scheduled tasks, the <plugins> elment remains the same for all scheduled tasks.
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"> </plugin> </plugins> </oimplugins>
Save and close the plugin.xml file.
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
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
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.