1 10 11 package org.mule.providers.quartz.jobs; 12 13 import org.mule.MuleManager; 14 import org.mule.config.i18n.Message; 15 import org.mule.providers.quartz.QuartzConnector; 16 import org.mule.umo.manager.ObjectNotFoundException; 17 import org.quartz.Job; 18 import org.quartz.JobDataMap; 19 import org.quartz.JobExecutionContext; 20 import org.quartz.JobExecutionException; 21 22 31 public class DelegatingJob implements Job 32 { 33 public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException 34 { 35 JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); 36 Object tempJob = jobDataMap.get(QuartzConnector.PROPERTY_JOB_OBJECT); 37 if (tempJob == null) 38 { 39 tempJob = jobDataMap.get(QuartzConnector.PROPERTY_JOB_REF); 40 if (tempJob == null) 41 { 42 throw new JobExecutionException(new Message("quartz", 2).getMessage()); 43 } 44 else 45 { 46 try 47 { 48 tempJob = MuleManager.getInstance().getContainerContext().getComponent(tempJob); 49 } 50 catch (ObjectNotFoundException e) 51 { 52 throw new JobExecutionException(e); 53 } 54 if (!(tempJob instanceof Job)) 55 { 56 throw new JobExecutionException(new Message("quartz", 3).getMessage()); 57 } 58 } 59 } 60 else if (!(tempJob instanceof Job)) 61 { 62 throw new JobExecutionException(new Message("quartz", 3).toString()); 63 } 64 ((Job)tempJob).execute(jobExecutionContext); 65 } 66 } 67 | Popular Tags |