1 4 package org.oddjob.quartz; 5 6 import java.util.Date ; 7 import java.util.List ; 8 import java.util.Set ; 9 10 import org.quartz.Calendar; 11 import org.quartz.JobDetail; 12 import org.quartz.JobListener; 13 import org.quartz.Scheduler; 14 import org.quartz.SchedulerContext; 15 import org.quartz.SchedulerException; 16 import org.quartz.SchedulerListener; 17 import org.quartz.SchedulerMetaData; 18 import org.quartz.Trigger; 19 import org.quartz.TriggerListener; 20 import org.quartz.UnableToInterruptJobException; 21 22 25 public class MockScheduler implements Scheduler { 26 27 public Trigger trigger; 28 public JobDetail jobDetail; 29 30 35 public String getSchedulerName() throws SchedulerException { 36 return "Mock Scheduler"; 37 } 38 39 44 public String getSchedulerInstanceId() throws SchedulerException { 45 return "0001"; 46 } 47 48 53 public SchedulerContext getContext() throws SchedulerException { 54 return null; 55 } 56 57 63 80 public void start() throws SchedulerException { } 81 82 99 public void pause() throws SchedulerException { 100 throw new UnsupportedOperationException (); 101 } 102 103 108 public boolean isPaused() throws SchedulerException { 109 return false; 110 } 111 112 125 public void shutdown() throws SchedulerException { } 126 127 143 public void shutdown(boolean waitForJobsToComplete) 144 throws SchedulerException { 145 146 } 147 148 153 public boolean isShutdown() throws SchedulerException { 154 return false; 155 } 156 157 168 public SchedulerMetaData getMetaData() throws SchedulerException { 169 return null; 170 } 171 172 187 public List getCurrentlyExecutingJobs() throws SchedulerException { 188 return null; 189 } 190 191 197 213 public Date scheduleJob(JobDetail jobDetail, Trigger trigger) 214 throws SchedulerException { 215 this.trigger = trigger; 216 this.jobDetail = jobDetail; 217 return trigger.getStartTime(); 218 } 219 220 231 public Date scheduleJob(Trigger trigger) throws SchedulerException { 232 this.trigger = trigger; 233 return trigger.getStartTime(); 234 } 235 236 241 public boolean unscheduleJob(String triggerName, String groupName) 242 throws SchedulerException { 243 this.trigger = null; 244 return true; 245 } 246 247 265 public Date rescheduleJob(String triggerName, 266 String groupName, Trigger newTrigger) throws SchedulerException { 267 this.trigger = newTrigger; 268 return trigger.getStartTime(); 269 } 270 271 272 290 public void addJob(JobDetail jobDetail, boolean replace) 291 throws SchedulerException { 292 throw new UnsupportedOperationException (); 293 } 294 295 305 public boolean deleteJob(String jobName, String groupName) 306 throws SchedulerException { 307 throw new UnsupportedOperationException (); 308 } 309 310 316 public void triggerJob(String jobName, String groupName) 317 throws SchedulerException { 318 throw new UnsupportedOperationException (); 319 } 320 321 327 public void triggerJobWithVolatileTrigger(String jobName, String groupName) 328 throws SchedulerException { 329 throw new UnsupportedOperationException (); 330 } 331 332 340 public void pauseJob(String jobName, String groupName) 341 throws SchedulerException { 342 throw new UnsupportedOperationException (); 343 } 344 345 359 public void pauseJobGroup(String groupName) throws SchedulerException { 360 throw new UnsupportedOperationException (); 361 } 362 363 370 public void pauseTrigger(String triggerName, String groupName) 371 throws SchedulerException { 372 throw new UnsupportedOperationException (); 373 } 374 375 388 public void pauseTriggerGroup(String groupName) throws SchedulerException { 389 throw new UnsupportedOperationException (); 390 } 391 392 406 public void resumeJob(String jobName, String groupName) 407 throws SchedulerException { 408 throw new UnsupportedOperationException (); 409 } 410 411 425 public void resumeJobGroup(String groupName) throws SchedulerException { 426 throw new UnsupportedOperationException (); 427 } 428 429 442 public void resumeTrigger(String triggerName, String groupName) 443 throws SchedulerException { 444 throw new UnsupportedOperationException (); 445 } 446 447 460 public void resumeTriggerGroup(String groupName) throws SchedulerException { 461 throw new UnsupportedOperationException (); 462 } 463 464 479 public void pauseAll() throws SchedulerException { 480 throw new UnsupportedOperationException (); 481 } 482 483 496 public void resumeAll() throws SchedulerException { 497 throw new UnsupportedOperationException (); 498 } 499 500 506 public String [] getJobGroupNames() throws SchedulerException { 507 return new String [] {Scheduler.DEFAULT_GROUP}; 508 } 509 510 516 public String [] getJobNames(String groupName) throws SchedulerException { 517 return new String [] { jobDetail.getName() }; 518 } 519 520 526 public Trigger[] getTriggersOfJob(String jobName, String groupName) 527 throws SchedulerException { 528 return new Trigger[] { trigger }; 529 } 530 531 536 public String [] getTriggerGroupNames() throws SchedulerException { 537 return new String [] { "What's the default trigger group?" }; 538 } 539 540 546 public String [] getTriggerNames(String groupName) throws SchedulerException { 547 return new String [] { trigger.getFullName() }; 548 } 549 550 558 public Set getPausedTriggerGroups() throws SchedulerException { 559 throw new UnsupportedOperationException (); 560 } 561 562 568 public JobDetail getJobDetail(String jobName, String jobGroup) 569 throws SchedulerException { 570 return jobDetail; 571 } 572 573 579 public Trigger getTrigger(String triggerName, String triggerGroup) 580 throws SchedulerException { 581 return trigger; 582 } 583 584 596 public int getTriggerState(String triggerName, String triggerGroup) 597 throws SchedulerException { 598 return Trigger.STATE_NONE; 599 } 600 601 616 public void addCalendar(String calName, Calendar calendar, boolean replace, boolean updateTriggers) 617 throws SchedulerException { 618 throw new UnsupportedOperationException (); 619 } 620 621 630 public boolean deleteCalendar(String calName) throws SchedulerException { 631 throw new UnsupportedOperationException (); 632 } 633 634 639 public Calendar getCalendar(String calName) throws SchedulerException { 640 throw new UnsupportedOperationException (); 641 } 642 643 648 public String [] getCalendarNames() throws SchedulerException { 649 throw new UnsupportedOperationException (); 650 } 651 652 658 669 public void addGlobalJobListener(JobListener jobListener) 670 throws SchedulerException { 671 throw new UnsupportedOperationException (); 672 } 673 674 679 public void addJobListener(JobListener jobListener) 680 throws SchedulerException { 681 throw new UnsupportedOperationException (); 682 } 683 684 693 public boolean removeGlobalJobListener(JobListener jobListener) 694 throws SchedulerException { 695 throw new UnsupportedOperationException (); 696 } 697 698 707 public boolean removeJobListener(String name) throws SchedulerException { 708 throw new UnsupportedOperationException (); 709 } 710 711 717 public List getGlobalJobListeners() throws SchedulerException { 718 throw new UnsupportedOperationException (); 719 } 720 721 727 public Set getJobListenerNames() throws SchedulerException { 728 throw new UnsupportedOperationException (); 729 } 730 731 737 public JobListener getJobListener(String name) throws SchedulerException { 738 throw new UnsupportedOperationException (); 739 } 740 741 752 public void addGlobalTriggerListener(TriggerListener triggerListener) 753 throws SchedulerException { 754 throw new UnsupportedOperationException (); 755 } 756 757 762 public void addTriggerListener(TriggerListener triggerListener) 763 throws SchedulerException { 764 throw new UnsupportedOperationException (); 765 } 766 767 776 public boolean removeGlobalTriggerListener(TriggerListener triggerListener) 777 throws SchedulerException { 778 throw new UnsupportedOperationException (); 779 } 780 789 public boolean removeTriggerListener(String name) throws SchedulerException { 790 throw new UnsupportedOperationException (); 791 } 792 793 799 public List getGlobalTriggerListeners() throws SchedulerException { 800 throw new UnsupportedOperationException (); 801 } 802 803 809 public Set getTriggerListenerNames() throws SchedulerException { 810 throw new UnsupportedOperationException (); 811 } 812 813 819 public TriggerListener getTriggerListener(String name) 820 throws SchedulerException { 821 throw new UnsupportedOperationException (); 822 } 823 824 830 public void addSchedulerListener(SchedulerListener schedulerListener) 831 throws SchedulerException { 832 throw new UnsupportedOperationException (); 833 } 834 835 844 public boolean removeSchedulerListener(SchedulerListener schedulerListener) 845 throws SchedulerException { 846 throw new UnsupportedOperationException (); 847 } 848 849 855 public List getSchedulerListeners() throws SchedulerException { 856 throw new UnsupportedOperationException (); 857 } 858 859 860 894 public boolean interrupt(String jobName, String groupName) throws UnableToInterruptJobException { 895 throw new UnsupportedOperationException (); 896 } 897 } 898 | Popular Tags |