1 package org.oddjob.scheduling; 2 3 import org.oddjob.arooa.ArooaHandler; 4 import org.oddjob.arooa.ArooaContext; 5 import org.oddjob.framework.SimpleJob; 6 import org.oddjob.util.OddjobConfigException; 7 8 35 36 37 public class UnscheduleJob extends SimpleJob { 38 static final long serialVersionUID = 20051121; 39 40 45 private String scheduleId; 46 47 53 private OddjobScheduler scheduler; 54 55 60 public void setScheduleId(String scheduleId) { 61 this.scheduleId = scheduleId; 62 } 63 64 69 public String getScheduleId() { 70 return scheduleId; 71 } 72 73 79 public ArooaHandler handlerForSchedules(ArooaContext arooaContext) { 80 return ScheduleInstructionFactory.handlerFor(arooaContext); 81 } 82 83 87 protected int execute() throws Exception { 88 if (scheduler == null) { 89 throw new OddjobConfigException("No scheduler specified."); 90 } 91 if (scheduleId == null) { 92 throw new OddjobConfigException("Nothing to unschedule."); 93 } 94 scheduler.unSchedule(scheduleId); 95 return 0; 96 } 97 98 101 public OddjobScheduler getScheduler() { 102 return scheduler; 103 } 104 107 public void setScheduler(OddjobScheduler scheduler) { 108 this.scheduler = scheduler; 109 } 110 } 111 112 | Popular Tags |