1 17 18 21 package org.quartz.impl; 22 23 import java.util.Date ; 24 import java.util.List ; 25 import java.util.Set ; 26 27 import org.quartz.Calendar; 28 import org.quartz.JobDataMap; 29 import org.quartz.JobDetail; 30 import org.quartz.JobListener; 31 import org.quartz.Scheduler; 32 import org.quartz.SchedulerContext; 33 import org.quartz.SchedulerException; 34 import org.quartz.SchedulerListener; 35 import org.quartz.SchedulerMetaData; 36 import org.quartz.Trigger; 37 import org.quartz.TriggerListener; 38 import org.quartz.UnableToInterruptJobException; 39 import org.quartz.core.QuartzScheduler; 40 import org.quartz.core.SchedulingContext; 41 import org.quartz.spi.JobFactory; 42 43 56 public class StdScheduler implements Scheduler { 57 58 65 66 private QuartzScheduler sched; 67 68 private SchedulingContext schedCtxt; 69 70 77 78 84 public StdScheduler(QuartzScheduler sched, SchedulingContext schedCtxt) { 85 this.sched = sched; 86 this.schedCtxt = schedCtxt; 87 } 88 89 96 97 102 public String getSchedulerName() { 103 return sched.getSchedulerName(); 104 } 105 106 111 public String getSchedulerInstanceId() { 112 return sched.getSchedulerInstanceId(); 113 } 114 115 public SchedulerMetaData getMetaData() { 116 return new SchedulerMetaData(getSchedulerName(), 117 getSchedulerInstanceId(), getClass(), false, isStarted(), 118 isInStandbyMode(), isShutdown(), sched.runningSince(), 119 sched.numJobsExecuted(), sched.getJobStoreClass(), 120 sched.supportsPersistence(), sched.getThreadPoolClass(), 121 sched.getThreadPoolSize(), sched.getVersion()); 122 123 } 124 125 130 public SchedulerContext getContext() throws SchedulerException { 131 return sched.getSchedulerContext(); 132 } 133 134 140 145 public void start() throws SchedulerException { 146 sched.start(); 147 } 148 149 157 public void pause() { 158 this.standby(); 159 } 160 161 166 public void standby() { 167 sched.standby(); 168 } 169 170 184 public boolean isStarted() { 185 return (sched.runningSince() != null); 186 } 187 188 193 public boolean isInStandbyMode() { 194 return sched.isInStandbyMode(); 195 } 196 197 200 public boolean isPaused() { 201 return isInStandbyMode(); 202 } 203 204 209 public void shutdown() { 210 sched.shutdown(); 211 } 212 213 218 public void shutdown(boolean waitForJobsToComplete) { 219 sched.shutdown(waitForJobsToComplete); 220 } 221 222 227 public boolean isShutdown() { 228 return sched.isShutdown(); 229 } 230 231 236 public List getCurrentlyExecutingJobs() { 237 return sched.getCurrentlyExecutingJobs(); 238 } 239 240 246 253 public Date scheduleJob(JobDetail jobDetail, Trigger trigger) 254 throws SchedulerException { 255 return sched.scheduleJob(schedCtxt, jobDetail, trigger); 256 } 257 258 265 public Date scheduleJob(Trigger trigger) throws SchedulerException { 266 return sched.scheduleJob(schedCtxt, trigger); 267 } 268 269 276 public void addJob(JobDetail jobDetail, boolean replace) 277 throws SchedulerException { 278 sched.addJob(schedCtxt, jobDetail, replace); 279 } 280 281 288 public boolean deleteJob(String jobName, String groupName) 289 throws SchedulerException { 290 return sched.deleteJob(schedCtxt, jobName, groupName); 291 } 292 293 300 public boolean unscheduleJob(String triggerName, String groupName) 301 throws SchedulerException { 302 return sched.unscheduleJob(schedCtxt, triggerName, groupName); 303 } 304 305 312 public Date rescheduleJob(String triggerName, 313 String groupName, Trigger newTrigger) throws SchedulerException { 314 return sched.rescheduleJob(schedCtxt, triggerName, groupName, newTrigger); 315 } 316 317 324 public void triggerJob(String jobName, String groupName) 325 throws SchedulerException { 326 triggerJob(jobName, groupName, null); 327 } 328 329 336 public void triggerJob(String jobName, String groupName, JobDataMap data) 337 throws SchedulerException { 338 sched.triggerJob(schedCtxt, jobName, groupName, data); 339 } 340 341 348 public void triggerJobWithVolatileTrigger(String jobName, String groupName) 349 throws SchedulerException { 350 triggerJobWithVolatileTrigger(jobName, groupName, null); 351 } 352 353 360 public void triggerJobWithVolatileTrigger(String jobName, String groupName, JobDataMap data) 361 throws SchedulerException { 362 sched.triggerJobWithVolatileTrigger(schedCtxt, jobName, groupName, data); 363 } 364 365 372 public void pauseTrigger(String triggerName, String groupName) 373 throws SchedulerException { 374 sched.pauseTrigger(schedCtxt, triggerName, groupName); 375 } 376 377 384 public void pauseTriggerGroup(String groupName) throws SchedulerException { 385 sched.pauseTriggerGroup(schedCtxt, groupName); 386 } 387 388 395 public void pauseJob(String jobName, String groupName) 396 throws SchedulerException { 397 sched.pauseJob(schedCtxt, jobName, groupName); 398 } 399 400 403 public Set getPausedTriggerGroups() throws SchedulerException { 404 return sched.getPausedTriggerGroups(schedCtxt); 405 } 406 407 414 public void pauseJobGroup(String groupName) throws SchedulerException { 415 sched.pauseJobGroup(schedCtxt, groupName); 416 } 417 418 425 public void resumeTrigger(String triggerName, String groupName) 426 throws SchedulerException { 427 sched.resumeTrigger(schedCtxt, triggerName, groupName); 428 } 429 430 437 public void resumeTriggerGroup(String groupName) throws SchedulerException { 438 sched.resumeTriggerGroup(schedCtxt, groupName); 439 } 440 441 448 public void resumeJob(String jobName, String groupName) 449 throws SchedulerException { 450 sched.resumeJob(schedCtxt, jobName, groupName); 451 } 452 453 460 public void resumeJobGroup(String groupName) throws SchedulerException { 461 sched.resumeJobGroup(schedCtxt, groupName); 462 } 463 464 471 public void pauseAll() throws SchedulerException { 472 sched.pauseAll(schedCtxt); 473 } 474 475 482 public void resumeAll() throws SchedulerException { 483 sched.resumeAll(schedCtxt); 484 } 485 486 493 public String [] getJobGroupNames() throws SchedulerException { 494 return sched.getJobGroupNames(schedCtxt); 495 } 496 497 504 public Trigger[] getTriggersOfJob(String jobName, String groupName) 505 throws SchedulerException { 506 return sched.getTriggersOfJob(schedCtxt, jobName, groupName); 507 } 508 509 516 public String [] getJobNames(String groupName) throws SchedulerException { 517 return sched.getJobNames(schedCtxt, groupName); 518 } 519 520 527 public String [] getTriggerGroupNames() throws SchedulerException { 528 return sched.getTriggerGroupNames(schedCtxt); 529 } 530 531 538 public String [] getTriggerNames(String groupName) throws SchedulerException { 539 return sched.getTriggerNames(schedCtxt, groupName); 540 } 541 542 549 public JobDetail getJobDetail(String jobName, String jobGroup) 550 throws SchedulerException { 551 return sched.getJobDetail(schedCtxt, jobName, jobGroup); 552 } 553 554 561 public Trigger getTrigger(String triggerName, String triggerGroup) 562 throws SchedulerException { 563 return sched.getTrigger(schedCtxt, triggerName, triggerGroup); 564 } 565 566 573 public int getTriggerState(String triggerName, String triggerGroup) 574 throws SchedulerException { 575 return sched.getTriggerState(schedCtxt, triggerName, triggerGroup); 576 } 577 578 585 public void addCalendar(String calName, Calendar calendar, boolean replace, boolean updateTriggers) 586 throws SchedulerException { 587 sched.addCalendar(schedCtxt, calName, calendar, replace, updateTriggers); 588 } 589 590 597 public boolean deleteCalendar(String calName) throws SchedulerException { 598 return sched.deleteCalendar(schedCtxt, calName); 599 } 600 601 608 public Calendar getCalendar(String calName) throws SchedulerException { 609 return sched.getCalendar(schedCtxt, calName); 610 } 611 612 619 public String [] getCalendarNames() throws SchedulerException { 620 return sched.getCalendarNames(schedCtxt); 621 } 622 623 629 634 public void addGlobalJobListener(JobListener jobListener) { 635 sched.addGlobalJobListener(jobListener); 636 } 637 638 643 public void addJobListener(JobListener jobListener) { 644 sched.addJobListener(jobListener); 645 } 646 647 653 public boolean removeGlobalJobListener(JobListener jobListener) { 654 return sched.removeGlobalJobListener( 655 (jobListener == null) ? null : jobListener.getName()); 656 } 657 658 663 public boolean removeGlobalJobListener(String name) { 664 return sched.removeGlobalJobListener(name); 665 } 666 667 672 public boolean removeJobListener(String name) { 673 return sched.removeJobListener(name); 674 } 675 676 681 public List getGlobalJobListeners() { 682 return sched.getGlobalJobListeners(); 683 } 684 685 690 public Set getJobListenerNames() { 691 return sched.getJobListenerNames(); 692 } 693 694 699 public JobListener getGlobalJobListener(String name) { 700 return sched.getGlobalJobListener(name); 701 } 702 703 708 public JobListener getJobListener(String name) { 709 return sched.getJobListener(name); 710 } 711 712 717 public void addGlobalTriggerListener(TriggerListener triggerListener) { 718 sched.addGlobalTriggerListener(triggerListener); 719 } 720 721 726 public void addTriggerListener(TriggerListener triggerListener) { 727 sched.addTriggerListener(triggerListener); 728 } 729 730 737 public boolean removeGlobalTriggerListener(TriggerListener triggerListener) { 738 return sched.removeGlobalTriggerListener( 739 (triggerListener == null) ? null : triggerListener.getName()); 740 } 741 742 747 public boolean removeGlobalTriggerListener(String name) { 748 return sched.removeGlobalTriggerListener(name); 749 } 750 751 756 public boolean removeTriggerListener(String name) { 757 return sched.removeTriggerListener(name); 758 } 759 760 765 public List getGlobalTriggerListeners() { 766 return sched.getGlobalTriggerListeners(); 767 } 768 769 774 public Set getTriggerListenerNames() { 775 return sched.getTriggerListenerNames(); 776 } 777 778 783 public TriggerListener getGlobalTriggerListener(String name) { 784 return sched.getGlobalTriggerListener(name); 785 } 786 787 792 public TriggerListener getTriggerListener(String name) { 793 return sched.getTriggerListener(name); 794 } 795 796 801 public void addSchedulerListener(SchedulerListener schedulerListener) { 802 sched.addSchedulerListener(schedulerListener); 803 } 804 805 810 public boolean removeSchedulerListener(SchedulerListener schedulerListener) { 811 return sched.removeSchedulerListener(schedulerListener); 812 } 813 814 819 public List getSchedulerListeners() { 820 return sched.getSchedulerListeners(); 821 } 822 823 public boolean interrupt(String jobName, String groupName) throws UnableToInterruptJobException { 824 return sched.interrupt(schedCtxt, jobName, groupName); 825 } 826 827 830 public void setJobFactory(JobFactory factory) throws SchedulerException { 831 sched.setJobFactory(factory); 832 } 833 834 } 835 | Popular Tags |