Saturday, April 6, 2013

OIM11G: Scheduler Service - coding part


Scheduler Service


   Today III help you guys with some codes(different ways) to work with this opensource code that was added into OIM 10G &11G API to control the scheduler:


1)Running

SchedulerService schschservice = oimClient.getService(SchedulerService.class);
String jobnamestring = "Disable/Delete User After End Date";
schschservice.deleteTrigger(jobnamestring);
schschservice.resumeJob(jobnamestring);
schschservice.triggerNow(jobnamestring);


2)Reeschedule Job

triggersOfJob = schservice.getTriggersOfJob(jobjobnamestringInString);
trigger = new Trigger(jobnamestring,jobStartTime, repeatInterval, repeatCount,jobEndTime);
trigger.setLastModifyDate(lastTriggerModifyDate);
Jobdetails.setLastModifyDate(new Date(System.currentTimeMillis()));
schservice.updateJob(jobnamestring);
schservice.scheduleJob(jobnamestring, trigger);


3)Delete instances

SchedulerService schschservice = oimClient.getService(SchedulerService.class);
JobDetails job = schschservice.getJobDetail(jobnamestring);
schschservice.deleteJob(jobnamestring);


4)Get list of job triggers involved:

Trigger triggers[] = service.getTriggersOfJob(jobnameInString);
for(Trigger triggerX : triggers ) {
   System.out.println("The Name of the trigger is:  " + triggerX.getName() );
}

5)Query instances
Collect a list of:

SchedulerService schschservice = oimClient.getService(SchedulerService.class);
String[] todososJobs = schschservice.getAllJobs();


6)If you want to match them:

SchedulerService schschservice = oimClient.getService(SchedulerService.class);
String[] todososjobs = schschservice.getAllJobs();


7)Important Note:
resetRunningJobStatus(),schservice.stop(); and schservice.start(); are void methods not to stop your current job, but the entire scheduler service that you can manually control by this URL http://thiagoleoncioserver:14001/SchedulerService-web/status

So, before coding be aware of this!

**Next article I pretend to explain you guys how to register , import and create your own scheduledJob.**


Reference:
R1.0)http://docs.oracle.com/cd/E28389_01/apirefs.1111/e17334/oracle/iam/scheduler/api/SchedulerService.html

R2.0)Expression can be set based on Quartz: http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger

R3.0)You can add new configurable child elements. For the information about new child elements, refer to the following URL:
http://www.quartz-scheduler.org/

I hope all of this really helps you,
Thiago Leoncio.




No comments:

Post a Comment