Esempio n. 1
0
 public void removeAllJobs() throws SchedulerException {
   for (String groupName : quartzScheduler.getJobGroupNames()) {
     for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
       quartzScheduler.deleteJob(jobKey);
     }
   }
 }
Esempio n. 2
0
 public RunTimeJobDetail scheduleJob(JobDetail jobDetail, Trigger trigger)
     throws SchedulerException, JobAlreadyExistsException {
   if (quartzScheduler.checkExists(jobDetail.getKey()))
     throw new JobAlreadyExistsException(jobDetail.getKey().getName() + " already exists");
   quartzScheduler.scheduleJob(jobDetail, trigger);
   return getJobDetails(jobDetail.getKey().getGroup(), jobDetail.getKey().getName());
 }
Esempio n. 3
0
 public List<RunTimeJobDetail> listAllJobs() throws SchedulerException {
   List<RunTimeJobDetail> jobs = new ArrayList<RunTimeJobDetail>();
   for (String groupName : quartzScheduler.getJobGroupNames()) {
     for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
       jobs.add(getJobDetails(groupName, jobKey.getName()));
     }
   }
   return jobs;
 }
Esempio n. 4
0
  public List<RunTimeJobDetail> searchJobs(String groupExp, String nameExp)
      throws SchedulerException {
    Pattern groupPattern = Pattern.compile(groupExp);
    Pattern namePattern = Pattern.compile(nameExp);

    List<RunTimeJobDetail> jobs = new ArrayList<RunTimeJobDetail>();
    for (String groupName : quartzScheduler.getJobGroupNames()) {
      if (groupPattern.matcher(groupName).matches()) {
        for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
          if (namePattern.matcher(jobKey.getName()).matches()) {
            jobs.add(getJobDetails(groupName, jobKey.getName()));
          }
        }
      }
    }
    return jobs;
  }
Esempio n. 5
0
 public void resumeJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.resumeJob(jobKey);
 }
Esempio n. 6
0
 public void pauseJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.pauseJob(jobKey);
 }
Esempio n. 7
0
 public RunTimeJobDetail getJobDetails(String group, String name) throws SchedulerException {
   JobKey jobKey = new JobKey(name, group);
   return new RunTimeJobDetail()
       .setJobDetail(quartzScheduler.getJobDetail(jobKey))
       .setTriggers(quartzScheduler.getTriggersOfJob(jobKey));
 }
Esempio n. 8
0
 /**
  * Search Trigger
  *
  * @param group
  * @param name
  * @return
  * @throws SchedulerException
  */
 public Trigger getTrigger(String group, String name) throws SchedulerException {
   return quartzScheduler.getTrigger(new TriggerKey(name, group));
 }
Esempio n. 9
0
 public void removeJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.deleteJob(jobKey);
 }