1 package org.apache.turbine.services.schedule; 2 3 18 19 import java.util.List ; 20 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 import org.apache.turbine.services.TurbineServices; 24 import org.apache.turbine.services.pull.ApplicationTool; 25 import org.apache.turbine.util.TurbineException; 26 27 33 public class SchedulerTool implements ApplicationTool 34 { 35 36 private static Log log = LogFactory.getLog(ScheduleService.LOGGER_NAME); 37 38 41 public void init(Object data) 42 { 43 if (!TurbineServices.getInstance().isRegistered( 44 ScheduleService.SERVICE_NAME)) 45 { 46 log.error("You can not use the SchedulerTool unless you enable " 47 +"the Scheduler Service!!!!"); 48 } 49 } 50 51 54 public void refresh() 55 { 56 } 57 58 63 public List getScheduledJobs() 64 { 65 return TurbineScheduler.listJobs(); 66 } 67 68 71 public boolean isEnabled() 72 { 73 return TurbineScheduler.isEnabled(); 74 } 75 76 82 public JobEntry getJob(String jobId) 83 { 84 JobEntry je = null; 85 86 try 87 { 88 je = TurbineScheduler.getJob(Integer.parseInt(jobId)); 89 } 90 catch (TurbineException e) 91 { 92 log.error("Could not retreive job id #" + jobId, e); 93 } 94 95 return je; 96 } 97 98 } 99 | Popular Tags |