Exemplo n.º 1
0
 public void removeAllJobs() throws SchedulerException {
   for (String groupName : quartzScheduler.getJobGroupNames()) {
     for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
       quartzScheduler.deleteJob(jobKey);
     }
   }
 }
Exemplo 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());
 }
Exemplo 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;
 }
Exemplo 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;
  }
Exemplo n.º 5
0
 public void resumeJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.resumeJob(jobKey);
 }
Exemplo n.º 6
0
 public void pauseJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.pauseJob(jobKey);
 }
Exemplo 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));
 }
Exemplo 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));
 }
Exemplo n.º 9
0
 public void removeJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.deleteJob(jobKey);
 }