KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > impl > RemoteScheduler


1 /*
2  * Copyright 2004-2005 OpenSymphony
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy
6  * of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations
14  * under the License.
15  *
16  */

17
18 /*
19  * Previously Copyright (c) 2001-2004 James House
20  */

21 package org.quartz.impl;
22
23 import java.rmi.RemoteException JavaDoc;
24 import java.rmi.registry.LocateRegistry JavaDoc;
25 import java.rmi.registry.Registry JavaDoc;
26 import java.util.Date JavaDoc;
27 import java.util.List JavaDoc;
28 import java.util.Set JavaDoc;
29
30 import org.quartz.Calendar;
31 import org.quartz.JobDataMap;
32 import org.quartz.JobDetail;
33 import org.quartz.JobListener;
34 import org.quartz.Scheduler;
35 import org.quartz.SchedulerContext;
36 import org.quartz.SchedulerException;
37 import org.quartz.SchedulerListener;
38 import org.quartz.SchedulerMetaData;
39 import org.quartz.Trigger;
40 import org.quartz.TriggerListener;
41 import org.quartz.UnableToInterruptJobException;
42 import org.quartz.core.RemotableQuartzScheduler;
43 import org.quartz.core.SchedulingContext;
44 import org.quartz.spi.JobFactory;
45
46 /**
47  * <p>
48  * An implementation of the <code>Scheduler</code> interface that remotely
49  * proxies all method calls to the equivalent call on a given <code>QuartzScheduler</code>
50  * instance, via RMI.
51  * </p>
52  *
53  * @see org.quartz.Scheduler
54  * @see org.quartz.core.QuartzScheduler
55  * @see org.quartz.core.SchedulingContext
56  *
57  * @author James House
58  */

59 public class RemoteScheduler implements Scheduler {
60
61     /*
62      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63      *
64      * Data members.
65      *
66      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67      */

68
69     private RemotableQuartzScheduler rsched;
70
71     private SchedulingContext schedCtxt;
72
73     private String JavaDoc schedId;
74
75     private String JavaDoc rmiHost;
76
77     private int rmiPort;
78
79     /*
80      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81      *
82      * Constructors.
83      *
84      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85      */

86
87     /**
88      * <p>
89      * Construct a <code>RemoteScheduler</code> instance to proxy the given
90      * <code>RemoteableQuartzScheduler</code> instance, and with the given
91      * <code>SchedulingContext</code>.
92      * </p>
93      */

94     public RemoteScheduler(SchedulingContext schedCtxt, String JavaDoc schedId,
95             String JavaDoc host, int port) {
96
97         this.schedCtxt = schedCtxt;
98         this.schedId = schedId;
99         this.rmiHost = host;
100         this.rmiPort = port;
101     }
102
103     /*
104      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105      *
106      * Interface.
107      *
108      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109      */

110
111     protected RemotableQuartzScheduler getRemoteScheduler()
112         throws SchedulerException {
113         if (rsched != null) {
114             return rsched;
115         }
116
117         try {
118             Registry JavaDoc registry = LocateRegistry.getRegistry(rmiHost, rmiPort);
119
120             rsched = (RemotableQuartzScheduler) registry.lookup(schedId);
121
122         } catch (Exception JavaDoc e) {
123             SchedulerException initException = new SchedulerException(
124                     "Could not get handle to remote scheduler: "
125                             + e.getMessage(), e);
126             initException
127                     .setErrorCode(SchedulerException.ERR_COMMUNICATION_FAILURE);
128             throw initException;
129         }
130
131         return rsched;
132     }
133
134     protected SchedulerException invalidateHandleCreateException(String JavaDoc msg,
135             Exception JavaDoc cause) {
136         rsched = null;
137         SchedulerException ex = new SchedulerException(msg, cause);
138         ex.setErrorCode(SchedulerException.ERR_COMMUNICATION_FAILURE);
139         return ex;
140     }
141
142     /**
143      * <p>
144      * Returns the name of the <code>Scheduler</code>.
145      * </p>
146      */

147     public String JavaDoc getSchedulerName() throws SchedulerException {
148         try {
149             return getRemoteScheduler().getSchedulerName();
150         } catch (RemoteException JavaDoc re) {
151             throw invalidateHandleCreateException(
152                     "Error communicating with remote scheduler.", re);
153         }
154     }
155
156     /**
157      * <p>
158      * Returns the instance Id of the <code>Scheduler</code>.
159      * </p>
160      */

161     public String JavaDoc getSchedulerInstanceId() throws SchedulerException {
162         try {
163             return getRemoteScheduler().getSchedulerInstanceId();
164         } catch (RemoteException JavaDoc re) {
165             throw invalidateHandleCreateException(
166                     "Error communicating with remote scheduler.", re);
167         }
168     }
169
170     public SchedulerMetaData getMetaData() throws SchedulerException {
171         try {
172             RemotableQuartzScheduler sched = getRemoteScheduler();
173             return new SchedulerMetaData(getSchedulerName(),
174                     getSchedulerInstanceId(), getClass(), true, isStarted(),
175                     isInStandbyMode(), isShutdown(), sched.runningSince(),
176                     sched.numJobsExecuted(), sched.getJobStoreClass(),
177                     sched.supportsPersistence(), sched.getThreadPoolClass(),
178                     sched.getThreadPoolSize(), sched.getVersion());
179
180         } catch (RemoteException JavaDoc re) {
181             throw invalidateHandleCreateException(
182                     "Error communicating with remote scheduler.", re);
183         }
184
185     }
186
187     /**
188      * <p>
189      * Returns the <code>SchedulerContext</code> of the <code>Scheduler</code>.
190      * </p>
191      */

192     public SchedulerContext getContext() throws SchedulerException {
193         try {
194             return getRemoteScheduler().getSchedulerContext();
195         } catch (RemoteException JavaDoc re) {
196             throw invalidateHandleCreateException(
197                     "Error communicating with remote scheduler.", re);
198         }
199     }
200
201     ///////////////////////////////////////////////////////////////////////////
202
///
203
/// Schedululer State Management Methods
204
///
205
///////////////////////////////////////////////////////////////////////////
206

207     /**
208      * <p>
209      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
210      * </p>
211      */

212     public void start() throws SchedulerException {
213         try {
214             getRemoteScheduler().start();
215         } catch (RemoteException JavaDoc re) {
216             throw invalidateHandleCreateException(
217                     "Error communicating with remote scheduler.", re);
218         }
219     }
220
221     /**
222      * <p>
223      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
224      * </p>
225      */

226     public void standby() throws SchedulerException {
227         try {
228             getRemoteScheduler().standby();
229         } catch (RemoteException JavaDoc re) {
230             throw invalidateHandleCreateException(
231                     "Error communicating with remote scheduler.", re);
232         }
233     }
234
235     /**
236      * @see org.quartz.Scheduler#pause()
237      * @deprecated
238      */

239     public void pause() throws SchedulerException {
240         this.standby();
241     }
242     
243     
244
245     /**
246      * Whether the scheduler has been started.
247      *
248      * <p>
249      * Note: This only reflects whether <code>{@link #start()}</code> has ever
250      * been called on this Scheduler, so it will return <code>true</code> even
251      * if the <code>Scheduler</code> is currently in standby mode or has been
252      * since shutdown.
253      * </p>
254      *
255      * @see #start()
256      * @see #isShutdown()
257      * @see #isInStandbyMode()
258      */

259     public boolean isStarted() throws SchedulerException {
260         try {
261             return (getRemoteScheduler().runningSince() != null);
262         } catch (RemoteException JavaDoc re) {
263             throw invalidateHandleCreateException(
264                     "Error communicating with remote scheduler.", re);
265         }
266     }
267     
268     /**
269      * <p>
270      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
271      * </p>
272      */

273     public boolean isInStandbyMode() throws SchedulerException {
274         try {
275             return getRemoteScheduler().isInStandbyMode();
276         } catch (RemoteException JavaDoc re) {
277             throw invalidateHandleCreateException(
278                     "Error communicating with remote scheduler.", re);
279         }
280     }
281
282     public boolean isPaused() throws SchedulerException {
283         return this.isInStandbyMode();
284     }
285     /**
286      * <p>
287      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
288      * </p>
289      */

290     public void shutdown() throws SchedulerException {
291         try {
292             String JavaDoc schedulerName = getSchedulerName();
293             
294             getRemoteScheduler().shutdown();
295             
296             SchedulerRepository.getInstance().remove(schedulerName);
297         } catch (RemoteException JavaDoc re) {
298             throw invalidateHandleCreateException(
299                     "Error communicating with remote scheduler.", re);
300         }
301     }
302
303     /**
304      * <p>
305      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
306      * </p>
307      */

308     public void shutdown(boolean waitForJobsToComplete)
309         throws SchedulerException {
310         try {
311             String JavaDoc schedulerName = getSchedulerName();
312             
313             getRemoteScheduler().shutdown(waitForJobsToComplete);
314
315             SchedulerRepository.getInstance().remove(schedulerName);
316         } catch (RemoteException JavaDoc re) {
317             throw invalidateHandleCreateException(
318                     "Error communicating with remote scheduler.", re);
319         }
320     }
321
322     /**
323      * <p>
324      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
325      * </p>
326      */

327     public boolean isShutdown() throws SchedulerException {
328         try {
329             return getRemoteScheduler().isShutdown();
330         } catch (RemoteException JavaDoc re) {
331             throw invalidateHandleCreateException(
332                     "Error communicating with remote scheduler.", re);
333         }
334     }
335
336     /**
337      * <p>
338      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
339      * </p>
340      */

341     public List JavaDoc getCurrentlyExecutingJobs() throws SchedulerException {
342         try {
343             return getRemoteScheduler().getCurrentlyExecutingJobs();
344         } catch (RemoteException JavaDoc re) {
345             throw invalidateHandleCreateException(
346                     "Error communicating with remote scheduler.", re);
347         }
348     }
349
350     ///////////////////////////////////////////////////////////////////////////
351
///
352
/// Scheduling-related Methods
353
///
354
///////////////////////////////////////////////////////////////////////////
355

356     /**
357      * <p>
358      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
359      * passing the <code>SchedulingContext</code> associated with this
360      * instance.
361      * </p>
362      */

363     public Date JavaDoc scheduleJob(JobDetail jobDetail, Trigger trigger)
364         throws SchedulerException {
365         try {
366             return getRemoteScheduler().scheduleJob(schedCtxt, jobDetail,
367                     trigger);
368         } catch (RemoteException JavaDoc re) {
369             throw invalidateHandleCreateException(
370                     "Error communicating with remote scheduler.", re);
371         }
372     }
373
374     /**
375      * <p>
376      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
377      * passing the <code>SchedulingContext</code> associated with this
378      * instance.
379      * </p>
380      */

381     public Date JavaDoc scheduleJob(Trigger trigger) throws SchedulerException {
382         try {
383             return getRemoteScheduler().scheduleJob(schedCtxt, trigger);
384         } catch (RemoteException JavaDoc re) {
385             throw invalidateHandleCreateException(
386                     "Error communicating with remote scheduler.", re);
387         }
388     }
389
390     /**
391      * <p>
392      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
393      * passing the <code>SchedulingContext</code> associated with this
394      * instance.
395      * </p>
396      */

397     public void addJob(JobDetail jobDetail, boolean replace)
398         throws SchedulerException {
399         try {
400             getRemoteScheduler().addJob(schedCtxt, jobDetail, replace);
401         } catch (RemoteException JavaDoc re) {
402             throw invalidateHandleCreateException(
403                     "Error communicating with remote scheduler.", re);
404         }
405     }
406
407     /**
408      * <p>
409      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
410      * passing the <code>SchedulingContext</code> associated with this
411      * instance.
412      * </p>
413      */

414     public boolean deleteJob(String JavaDoc jobName, String JavaDoc groupName)
415         throws SchedulerException {
416         try {
417             return getRemoteScheduler()
418                     .deleteJob(schedCtxt, jobName, groupName);
419         } catch (RemoteException JavaDoc re) {
420             throw invalidateHandleCreateException(
421                     "Error communicating with remote scheduler.", re);
422         }
423     }
424
425     /**
426      * <p>
427      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
428      * passing the <code>SchedulingContext</code> associated with this
429      * instance.
430      * </p>
431      */

432     public boolean unscheduleJob(String JavaDoc triggerName, String JavaDoc groupName)
433         throws SchedulerException {
434         try {
435             return getRemoteScheduler().unscheduleJob(schedCtxt, triggerName,
436                     groupName);
437         } catch (RemoteException JavaDoc re) {
438             throw invalidateHandleCreateException(
439                     "Error communicating with remote scheduler.", re);
440         }
441     }
442
443     /**
444      * <p>
445      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
446      * passing the <code>SchedulingContext</code> associated with this
447      * instance.
448      * </p>
449      */

450     public Date JavaDoc rescheduleJob(String JavaDoc triggerName,
451             String JavaDoc groupName, Trigger newTrigger) throws SchedulerException {
452         try {
453             return getRemoteScheduler().rescheduleJob(schedCtxt, triggerName,
454                     groupName, newTrigger);
455         } catch (RemoteException JavaDoc re) {
456             throw invalidateHandleCreateException(
457                     "Error communicating with remote scheduler.", re);
458         }
459     }
460     
461     
462     /**
463      * <p>
464      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
465      * passing the <code>SchedulingContext</code> associated with this
466      * instance.
467      * </p>
468      */

469     public void triggerJob(String JavaDoc jobName, String JavaDoc groupName)
470         throws SchedulerException {
471         triggerJob(jobName, groupName, null);
472     }
473     
474     /**
475      * <p>
476      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
477      * passing the <code>SchedulingContext</code> associated with this
478      * instance.
479      * </p>
480      */

481     public void triggerJob(String JavaDoc jobName, String JavaDoc groupName, JobDataMap data)
482         throws SchedulerException {
483         try {
484             getRemoteScheduler().triggerJob(schedCtxt, jobName, groupName, data);
485         } catch (RemoteException JavaDoc re) {
486             throw invalidateHandleCreateException(
487                     "Error communicating with remote scheduler.", re);
488         }
489     }
490
491     /**
492      * <p>
493      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
494      * passing the <code>SchedulingContext</code> associated with this
495      * instance.
496      * </p>
497      */

498     public void triggerJobWithVolatileTrigger(String JavaDoc jobName, String JavaDoc groupName)
499         throws SchedulerException {
500         triggerJobWithVolatileTrigger(jobName, groupName, null);
501     }
502     
503     /**
504      * <p>
505      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
506      * passing the <code>SchedulingContext</code> associated with this
507      * instance.
508      * </p>
509      */

510     public void triggerJobWithVolatileTrigger(String JavaDoc jobName, String JavaDoc groupName, JobDataMap data)
511         throws SchedulerException {
512         try {
513             getRemoteScheduler().triggerJobWithVolatileTrigger(schedCtxt,
514                     jobName, groupName, data);
515         } catch (RemoteException JavaDoc re) {
516             throw invalidateHandleCreateException(
517                     "Error communicating with remote scheduler.", re);
518         }
519     }
520
521     /**
522      * <p>
523      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
524      * passing the <code>SchedulingContext</code> associated with this
525      * instance.
526      * </p>
527      */

528     public void pauseTrigger(String JavaDoc triggerName, String JavaDoc groupName)
529         throws SchedulerException {
530         try {
531             getRemoteScheduler()
532                     .pauseTrigger(schedCtxt, triggerName, groupName);
533         } catch (RemoteException JavaDoc re) {
534             throw invalidateHandleCreateException(
535                     "Error communicating with remote scheduler.", re);
536         }
537     }
538
539     /**
540      * <p>
541      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
542      * passing the <code>SchedulingContext</code> associated with this
543      * instance.
544      * </p>
545      */

546     public void pauseTriggerGroup(String JavaDoc groupName) throws SchedulerException {
547         try {
548             getRemoteScheduler().pauseTriggerGroup(schedCtxt, groupName);
549         } catch (RemoteException JavaDoc re) {
550             throw invalidateHandleCreateException(
551                     "Error communicating with remote scheduler.", re);
552         }
553     }
554
555     /**
556      * <p>
557      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
558      * passing the <code>SchedulingContext</code> associated with this
559      * instance.
560      * </p>
561      */

562     public void pauseJob(String JavaDoc jobName, String JavaDoc groupName)
563         throws SchedulerException {
564         try {
565             getRemoteScheduler().pauseJob(schedCtxt, jobName, groupName);
566         } catch (RemoteException JavaDoc re) {
567             throw invalidateHandleCreateException(
568                     "Error communicating with remote scheduler.", re);
569         }
570     }
571
572     /**
573      * <p>
574      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
575      * passing the <code>SchedulingContext</code> associated with this
576      * instance.
577      * </p>
578      */

579     public void pauseJobGroup(String JavaDoc groupName) throws SchedulerException {
580         try {
581             getRemoteScheduler().pauseJobGroup(schedCtxt, groupName);
582         } catch (RemoteException JavaDoc re) {
583             throw invalidateHandleCreateException(
584                     "Error communicating with remote scheduler.", re);
585         }
586     }
587
588     /**
589      * <p>
590      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
591      * passing the <code>SchedulingContext</code> associated with this
592      * instance.
593      * </p>
594      */

595     public void resumeTrigger(String JavaDoc triggerName, String JavaDoc groupName)
596         throws SchedulerException {
597         try {
598             getRemoteScheduler().resumeTrigger(schedCtxt, triggerName,
599                     groupName);
600         } catch (RemoteException JavaDoc re) {
601             throw invalidateHandleCreateException(
602                     "Error communicating with remote scheduler.", re);
603         }
604     }
605
606     /**
607      * <p>
608      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
609      * passing the <code>SchedulingContext</code> associated with this
610      * instance.
611      * </p>
612      */

613     public void resumeTriggerGroup(String JavaDoc groupName) throws SchedulerException {
614         try {
615             getRemoteScheduler().resumeTriggerGroup(schedCtxt, groupName);
616         } catch (RemoteException JavaDoc re) {
617             throw invalidateHandleCreateException(
618                     "Error communicating with remote scheduler.", re);
619         }
620     }
621
622     /**
623      * <p>
624      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
625      * passing the <code>SchedulingContext</code> associated with this
626      * instance.
627      * </p>
628      */

629     public void resumeJob(String JavaDoc jobName, String JavaDoc groupName)
630         throws SchedulerException {
631         try {
632             getRemoteScheduler().resumeJob(schedCtxt, jobName, groupName);
633         } catch (RemoteException JavaDoc re) {
634             throw invalidateHandleCreateException(
635                     "Error communicating with remote scheduler.", re);
636         }
637     }
638
639     /**
640      * <p>
641      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
642      * passing the <code>SchedulingContext</code> associated with this
643      * instance.
644      * </p>
645      */

646     public void resumeJobGroup(String JavaDoc groupName) throws SchedulerException {
647         try {
648             getRemoteScheduler().resumeJobGroup(schedCtxt, groupName);
649         } catch (RemoteException JavaDoc re) {
650             throw invalidateHandleCreateException(
651                     "Error communicating with remote scheduler.", re);
652         }
653     }
654
655     /**
656      * <p>
657      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
658      * passing the <code>SchedulingContext</code> associated with this
659      * instance.
660      * </p>
661      */

662     public void pauseAll() throws SchedulerException {
663         try {
664             getRemoteScheduler().pauseAll(schedCtxt);
665         } catch (RemoteException JavaDoc re) {
666             throw invalidateHandleCreateException(
667                     "Error communicating with remote scheduler.", re);
668         }
669     }
670
671     /**
672      * <p>
673      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
674      * passing the <code>SchedulingContext</code> associated with this
675      * instance.
676      * </p>
677      */

678     public void resumeAll() throws SchedulerException {
679         try {
680             getRemoteScheduler().resumeAll(schedCtxt);
681         } catch (RemoteException JavaDoc re) {
682             throw invalidateHandleCreateException(
683                     "Error communicating with remote scheduler.", re);
684         }
685     }
686
687     /**
688      * <p>
689      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
690      * passing the <code>SchedulingContext</code> associated with this
691      * instance.
692      * </p>
693      */

694     public String JavaDoc[] getJobGroupNames() throws SchedulerException {
695         try {
696             return getRemoteScheduler().getJobGroupNames(schedCtxt);
697         } catch (RemoteException JavaDoc re) {
698             throw invalidateHandleCreateException(
699                     "Error communicating with remote scheduler.", re);
700         }
701     }
702
703     /**
704      * <p>
705      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
706      * passing the <code>SchedulingContext</code> associated with this
707      * instance.
708      * </p>
709      */

710     public String JavaDoc[] getJobNames(String JavaDoc groupName) throws SchedulerException {
711         try {
712             return getRemoteScheduler().getJobNames(schedCtxt, groupName);
713         } catch (RemoteException JavaDoc re) {
714             throw invalidateHandleCreateException(
715                     "Error communicating with remote scheduler.", re);
716         }
717     }
718
719     /**
720      * <p>
721      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
722      * passing the <code>SchedulingContext</code> associated with this
723      * instance.
724      * </p>
725      */

726     public Trigger[] getTriggersOfJob(String JavaDoc jobName, String JavaDoc groupName)
727         throws SchedulerException {
728         try {
729             return getRemoteScheduler().getTriggersOfJob(schedCtxt, jobName,
730                     groupName);
731         } catch (RemoteException JavaDoc re) {
732             throw invalidateHandleCreateException(
733                     "Error communicating with remote scheduler.", re);
734         }
735     }
736
737     /**
738      * <p>
739      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
740      * passing the <code>SchedulingContext</code> associated with this
741      * instance.
742      * </p>
743      */

744     public String JavaDoc[] getTriggerGroupNames() throws SchedulerException {
745         try {
746             return getRemoteScheduler().getTriggerGroupNames(schedCtxt);
747         } catch (RemoteException JavaDoc re) {
748             throw invalidateHandleCreateException(
749                     "Error communicating with remote scheduler.", re);
750         }
751     }
752
753     /**
754      * <p>
755      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
756      * passing the <code>SchedulingContext</code> associated with this
757      * instance.
758      * </p>
759      */

760     public String JavaDoc[] getTriggerNames(String JavaDoc groupName) throws SchedulerException {
761         try {
762             return getRemoteScheduler().getTriggerNames(schedCtxt, groupName);
763         } catch (RemoteException JavaDoc re) {
764             throw invalidateHandleCreateException(
765                     "Error communicating with remote scheduler.", re);
766         }
767     }
768
769     /**
770      * <p>
771      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
772      * passing the <code>SchedulingContext</code> associated with this
773      * instance.
774      * </p>
775      */

776     public JobDetail getJobDetail(String JavaDoc jobName, String JavaDoc jobGroup)
777         throws SchedulerException {
778         try {
779             return getRemoteScheduler().getJobDetail(schedCtxt, jobName,
780                     jobGroup);
781         } catch (RemoteException JavaDoc re) {
782             throw invalidateHandleCreateException(
783                     "Error communicating with remote scheduler.", re);
784         }
785     }
786
787     /**
788      * <p>
789      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
790      * passing the <code>SchedulingContext</code> associated with this
791      * instance.
792      * </p>
793      */

794     public Trigger getTrigger(String JavaDoc triggerName, String JavaDoc triggerGroup)
795         throws SchedulerException {
796         try {
797             return getRemoteScheduler().getTrigger(schedCtxt, triggerName,
798                     triggerGroup);
799         } catch (RemoteException JavaDoc re) {
800             throw invalidateHandleCreateException(
801                     "Error communicating with remote scheduler.", re);
802         }
803     }
804
805     /**
806      * <p>
807      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
808      * passing the <code>SchedulingContext</code> associated with this
809      * instance.
810      * </p>
811      */

812     public int getTriggerState(String JavaDoc triggerName, String JavaDoc triggerGroup)
813         throws SchedulerException {
814         try {
815             return getRemoteScheduler().getTriggerState(schedCtxt, triggerName,
816                     triggerGroup);
817         } catch (RemoteException JavaDoc re) {
818             throw invalidateHandleCreateException(
819                     "Error communicating with remote scheduler.", re);
820         }
821     }
822
823     /**
824      * <p>
825      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
826      * passing the <code>SchedulingContext</code> associated with this
827      * instance.
828      * </p>
829      */

830     public void addCalendar(String JavaDoc calName, Calendar calendar, boolean replace, boolean updateTriggers)
831         throws SchedulerException {
832         try {
833             getRemoteScheduler().addCalendar(schedCtxt, calName, calendar,
834                     replace, updateTriggers);
835         } catch (RemoteException JavaDoc re) {
836             throw invalidateHandleCreateException(
837                     "Error communicating with remote scheduler.", re);
838         }
839     }
840
841     /**
842      * <p>
843      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
844      * passing the <code>SchedulingContext</code> associated with this
845      * instance.
846      * </p>
847      */

848     public boolean deleteCalendar(String JavaDoc calName) throws SchedulerException {
849         try {
850             return getRemoteScheduler().deleteCalendar(schedCtxt, calName);
851         } catch (RemoteException JavaDoc re) {
852             throw invalidateHandleCreateException(
853                     "Error communicating with remote scheduler.", re);
854         }
855     }
856
857     /**
858      * <p>
859      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
860      * passing the <code>SchedulingContext</code> associated with this
861      * instance.
862      * </p>
863      */

864     public Calendar getCalendar(String JavaDoc calName) throws SchedulerException {
865         try {
866             return getRemoteScheduler().getCalendar(schedCtxt, calName);
867         } catch (RemoteException JavaDoc re) {
868             throw invalidateHandleCreateException(
869                     "Error communicating with remote scheduler.", re);
870         }
871     }
872
873     /**
874      * <p>
875      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
876      * passing the <code>SchedulingContext</code> associated with this
877      * instance.
878      * </p>
879      */

880     public String JavaDoc[] getCalendarNames() throws SchedulerException {
881         try {
882             return getRemoteScheduler().getCalendarNames(schedCtxt);
883         } catch (RemoteException JavaDoc re) {
884             throw invalidateHandleCreateException(
885                     "Error communicating with remote scheduler.", re);
886         }
887     }
888
889     ///////////////////////////////////////////////////////////////////////////
890
///
891
/// Listener-related Methods
892
///
893
///////////////////////////////////////////////////////////////////////////
894

895     /**
896      * <p>
897      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
898      * </p>
899      */

900     public void addGlobalJobListener(JobListener jobListener)
901         throws SchedulerException {
902         throw new SchedulerException(
903                 "Operation not supported for remote schedulers.",
904                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
905     }
906
907     /**
908      * <p>
909      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
910      * </p>
911      */

912     public void addJobListener(JobListener jobListener)
913         throws SchedulerException {
914         throw new SchedulerException(
915                 "Operation not supported for remote schedulers.",
916                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
917     }
918
919     /**
920      * <p>
921      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
922      * </p>
923      * @deprecated Use <code>{@link #removeGlobalJobListener(String)}</code>
924      */

925     public boolean removeGlobalJobListener(JobListener jobListener)
926         throws SchedulerException {
927         throw new SchedulerException(
928                 "Operation not supported for remote schedulers.",
929                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
930     }
931
932     /**
933      * <p>
934      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
935      * </p>
936      */

937     public boolean removeGlobalJobListener(String JavaDoc name)
938         throws SchedulerException {
939         throw new SchedulerException(
940                 "Operation not supported for remote schedulers.",
941                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
942     }
943
944     /**
945      * <p>
946      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
947      * </p>
948      */

949     public boolean removeJobListener(String JavaDoc name) throws SchedulerException {
950         throw new SchedulerException(
951                 "Operation not supported for remote schedulers.",
952                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
953     }
954
955     /**
956      * <p>
957      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
958      * </p>
959      */

960     public List JavaDoc getGlobalJobListeners() throws SchedulerException {
961         throw new SchedulerException(
962                 "Operation not supported for remote schedulers.",
963                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
964     }
965
966     /**
967      * <p>
968      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
969      * </p>
970      */

971     public Set JavaDoc getJobListenerNames() throws SchedulerException {
972         throw new SchedulerException(
973                 "Operation not supported for remote schedulers.",
974                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
975     }
976
977     /**
978      * <p>
979      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
980      * </p>
981      */

982     public JobListener getGlobalJobListener(String JavaDoc name) throws SchedulerException {
983         throw new SchedulerException(
984                 "Operation not supported for remote schedulers.",
985                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
986     }
987     
988     /**
989      * <p>
990      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
991      * </p>
992      */

993     public JobListener getJobListener(String JavaDoc name) throws SchedulerException {
994         throw new SchedulerException(
995                 "Operation not supported for remote schedulers.",
996                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
997     }
998
999     /**
1000     * <p>
1001     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1002     * </p>
1003     */

1004    public void addGlobalTriggerListener(TriggerListener triggerListener)
1005        throws SchedulerException {
1006        throw new SchedulerException(
1007                "Operation not supported for remote schedulers.",
1008                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1009    }
1010
1011    /**
1012     * <p>
1013     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1014     * </p>
1015     */

1016    public void addTriggerListener(TriggerListener triggerListener)
1017        throws SchedulerException {
1018        throw new SchedulerException(
1019                "Operation not supported for remote schedulers.",
1020                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1021    }
1022
1023    /**
1024     * <p>
1025     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1026     * </p>
1027     * @deprecated Use <code>{@link #removeGlobalTriggerListener(String)}</code>
1028     */

1029    public boolean removeGlobalTriggerListener(TriggerListener triggerListener)
1030        throws SchedulerException {
1031        throw new SchedulerException(
1032                "Operation not supported for remote schedulers.",
1033                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1034    }
1035
1036    /**
1037     * <p>
1038     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1039     * </p>
1040     */

1041    public boolean removeGlobalTriggerListener(String JavaDoc name)
1042        throws SchedulerException {
1043        throw new SchedulerException(
1044                "Operation not supported for remote schedulers.",
1045                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1046    }
1047
1048    /**
1049     * <p>
1050     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1051     * </p>
1052     */

1053    public boolean removeTriggerListener(String JavaDoc name) throws SchedulerException {
1054        throw new SchedulerException(
1055                "Operation not supported for remote schedulers.",
1056                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1057    }
1058
1059    /**
1060     * <p>
1061     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1062     * </p>
1063     */

1064    public List JavaDoc getGlobalTriggerListeners() throws SchedulerException {
1065        throw new SchedulerException(
1066                "Operation not supported for remote schedulers.",
1067                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1068    }
1069
1070    /**
1071     * <p>
1072     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1073     * </p>
1074     */

1075    public Set JavaDoc getTriggerListenerNames() throws SchedulerException {
1076        throw new SchedulerException(
1077                "Operation not supported for remote schedulers.",
1078                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1079    }
1080
1081    /**
1082     * <p>
1083     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1084     * </p>
1085     */

1086    public TriggerListener getGlobalTriggerListener(String JavaDoc name)
1087        throws SchedulerException {
1088        throw new SchedulerException(
1089                "Operation not supported for remote schedulers.",
1090                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1091    }
1092
1093    /**
1094     * <p>
1095     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1096     * </p>
1097     */

1098    public TriggerListener getTriggerListener(String JavaDoc name)
1099        throws SchedulerException {
1100        throw new SchedulerException(
1101                "Operation not supported for remote schedulers.",
1102                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1103    }
1104
1105    /**
1106     * <p>
1107     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1108     * </p>
1109     */

1110    public void addSchedulerListener(SchedulerListener schedulerListener)
1111        throws SchedulerException {
1112        throw new SchedulerException(
1113                "Operation not supported for remote schedulers.",
1114                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1115    }
1116
1117    /**
1118     * <p>
1119     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1120     * </p>
1121     */

1122    public boolean removeSchedulerListener(SchedulerListener schedulerListener)
1123        throws SchedulerException {
1124        throw new SchedulerException(
1125                "Operation not supported for remote schedulers.",
1126                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1127    }
1128
1129    /**
1130     * <p>
1131     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1132     * </p>
1133     */

1134    public List JavaDoc getSchedulerListeners() throws SchedulerException {
1135        throw new SchedulerException(
1136                "Operation not supported for remote schedulers.",
1137                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1138    }
1139
1140    /**
1141     * @see org.quartz.Scheduler#getPausedTriggerGroups()
1142     */

1143    public Set JavaDoc getPausedTriggerGroups() throws SchedulerException {
1144        try {
1145            return getRemoteScheduler().getPausedTriggerGroups(schedCtxt);
1146        } catch (RemoteException JavaDoc re) {
1147            throw invalidateHandleCreateException(
1148                    "Error communicating with remote scheduler.", re);
1149        }
1150    }
1151
1152    /**
1153     * @see org.quartz.Scheduler#interrupt(java.lang.String, java.lang.String)
1154     */

1155    public boolean interrupt(String JavaDoc jobName, String JavaDoc groupName) throws UnableToInterruptJobException {
1156        try {
1157            return getRemoteScheduler().interrupt(schedCtxt, jobName, groupName);
1158        } catch (RemoteException JavaDoc re) {
1159            throw new UnableToInterruptJobException(invalidateHandleCreateException(
1160                    "Error communicating with remote scheduler.", re));
1161        } catch (SchedulerException se) {
1162            throw new UnableToInterruptJobException(se);
1163        }
1164    }
1165
1166    /**
1167     * @see org.quartz.Scheduler#setJobFactory(org.quartz.spi.JobFactory)
1168     */

1169    public void setJobFactory(JobFactory factory) throws SchedulerException {
1170        throw new SchedulerException(
1171                "Operation not supported for remote schedulers.",
1172                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1173    }
1174}
1175
Popular Tags