Oracle Identity Manager contains a set of predefined tasks that can be scheduled as job runs.OIM 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.You can develop various scheduled task such as reconciliation, user expire date check and etc.
In this post, i will explain create a custom scheduled task for check user's expire date. This jobs send notification to user's manager two weeks before end date.
Steps for create new schedule tasks are as follows;
1- Developing schedule task java class.
This class extends from OIM API's oracle.iam.scheduler.vo.TaskSupport. And override execute method for processing logic based on your requirements.
import oracle.iam.scheduler.vo.TaskSupport;
public class ExpireCheckJob extends TaskSupport {
public ExpireCheckJob() {
super();
}
public void execute(HashMap hashMap) throws Exception{
try{
List<HashMap<String, String>> usrlist = new ArrayList<HashMap<String, String>>();
usrlist = getusersExpireToday();
for (int i = 0; i < usrlist.size(); i++) {
User userDetails = usrlist.get(i);
sendNotificationToUserManager(user);
}
}catch(Exception e){
e.printStackTrace();
}
}
public HashMap getAttributes() {
return null;
}
public void setAttributes() {
}
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.
2-Create the plugin.xml file.
<?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="com.oracle.oim.scheduledjobs.ExpireCheckJob" version="1.0" name=""/>ExpireCheckJob
</plugins>
</oimplugins>
3- create a plugin.zip file which contains jar and plugin.xml Like following directory structure;
plugin.zip
/ lib /
Plugin.Jar
plugin.xml
4-Copy this zip file to OIM_HOME/server/plugins
5-Copy jar file to OIM_HOME/server/ScheduleTask
6-Configuring the schedule task xml file
This xml defines schedule task information.
<?xml version="1.0" encoding="UTF-8"?>
<xl-ddm-data version="2.0.1.0" user="XELSYSADM" database="jdbc:oracle:thin:@trkist01-odb-01:1521/MIDM" exported-date="1342018530943" description="ExpireCheckJob">
<scheduledTask repo-type="MDS" name="ExpireCheckJob" mds-path="/db" mds-file="ExpireCheckJob.xml">
<completeXml>
<scheduledTasks xmlns="http://xmlns.oracle.com/oim/scheduler">
<task>
<name>ItAuthExpireCheckJob</name>
<class>com.oracle.oim.scheduledjobs.ExpireCheckJob</class>
<description>ExpireCheckJob</description>
<retry>1</retry>
</task>
</scheduledTasks>
</completeXml>
</scheduledTask>
</xl-ddm-data>
Import the schedule task xml file via OIM Sysadmin console.
7- Create a new schedule task from OIM Sysadmin console.
- Log in to Oracle Identity System Administration with the appropriate credentials.
- In the left pane, under System Management, click Scheduler. The Advanced Administration is displayed with the Scheduler section in the System Management tab active.
- On the left pane, from the Actions menu, select Create. Alternatively, you can click the icon with the plus (+) sign beside the View list.
- On the Create Job page, enter values in the following fields under the Job Information section:
- Job Name: Enter a name for the job.For our example : Expire Date Check
- Task: Specify the name of the scheduled task that runs the job. For our example : ExpireDateCheckJobTo search and specify a scheduled task:
- Click the magnifying glass icon next to this field.
- In the Search and Select : Scheduled Task dialog box, specify a search criterion for the scheduled task and click the icon next to Search field.A list of all scheduled tasks that meet the search criterion is displayed.
- From this list, select the scheduled task that runs the job being created, and then click Confirm.
- Periodic: Select this option if you want the job to be run at a time that you specify, on a repeating basis. If you select this option, then you must enter an Periodic: Select this option if you want the job to be run at a time that you specify, on a repeating basis. If you select this option, then you must enter an integer value in the Run every field under the Job Periodic Settings section and select one of the following values:
- mins
- hrs
- days
- Cron: Select this option if you want the job to be run at a particular interval on a recurring basis. For example, you can create a job that must run at 8:00 A.M. every Monday through Friday or at 1:30 A.M. every last Friday of the month.The recurrence of the job must be specified in the Cron Settings section. In the Recurring Interval field, you can select any of the following values:
- Daily
- Weekly
- Monthly on given dates
- Monthly on given weekdays
- Yearly
- Single: Select this option if the job is to be run only once at the specified start date and time.
- No pre-defined schedule: This option specifies that no schedule is attached to the job you are creating, and therefore, it is not triggered automatically. As a result, the only option to trigger the job is by clicking Save and Run Now.
About me:
Mustafa Kaya is a Senior Consultant in Oracle Fusion Middleware Team, living in Istanbul. Before coming to Oracle, he worked in teams developing web applications and backend services at a telco company. He is a Java technology enthusiast, software engineer and addicted to learn new technologies,develop new ideas.
Follow Mustafa on Twitter,Connect on LinkedIn, and visit his site for Oracle Fusion Middleware related tips.