KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright 2004-2006 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 package org.quartz.impl;
18
19 import java.util.Date JavaDoc;
20 import java.util.List JavaDoc;
21 import java.util.Set JavaDoc;
22
23 import javax.management.AttributeList JavaDoc;
24 import javax.management.MalformedObjectNameException JavaDoc;
25 import javax.management.ObjectName JavaDoc;
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.SchedulingContext;
40 import org.quartz.spi.JobFactory;
41
42 /**
43  * <p>
44  * An implementation of the <code>Scheduler</code> interface that remotely
45  * proxies all method calls to the equivalent call on a given <code>QuartzScheduler</code>
46  * instance, via JMX.
47  * </p>
48  *
49  * <p>
50  * A user must create a subclass to implement the actual connection to the remote
51  * MBeanServer using their application specific connector.
52  * For example <code>{@link org.quartz.ee.jmx.jboss.JBoss4RMIRemoteMBeanScheduler}</code>.
53  * </p>
54  * @see org.quartz.Scheduler
55  * @see org.quartz.core.QuartzScheduler
56  * @see org.quartz.core.SchedulingContext
57  */

58 public abstract class RemoteMBeanScheduler implements Scheduler {
59
60     /*
61      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62      *
63      * Data members.
64      *
65      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66      */

67
68     private SchedulingContext schedulingContext;
69
70     private ObjectName JavaDoc schedulerObjectName;
71     
72     /*
73      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74      *
75      * Constructors.
76      *
77      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78      */

79
80     public RemoteMBeanScheduler() {
81     }
82     
83     /*
84      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85      *
86      * Properties.
87      *
88      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89      */

90     
91     /**
92      * Get the name under which the Scheduler MBean is registered on the
93      * remote MBean server.
94      */

95     protected ObjectName JavaDoc getSchedulerObjectName() {
96         return schedulerObjectName;
97     }
98
99     /**
100      * Set the name under which the Scheduler MBean is registered on the
101      * remote MBean server.
102      */

103     public void setSchedulerObjectName(String JavaDoc schedulerObjectName) throws SchedulerException {
104         try {
105             this.schedulerObjectName = new ObjectName JavaDoc(schedulerObjectName);
106         } catch (MalformedObjectNameException JavaDoc e) {
107             throw new SchedulerException("Failed to parse Scheduler MBean name: " + schedulerObjectName, e);
108         }
109     }
110
111     /**
112      * Set the name under which the Scheduler MBean is registered on the
113      * remote MBean server.
114      */

115     public void setSchedulerObjectName(ObjectName JavaDoc schedulerObjectName) throws SchedulerException {
116         this.schedulerObjectName = schedulerObjectName;
117     }
118
119     /**
120      * Set the scheduling context of this proxy.
121      */

122     public void setSchedulingContext(SchedulingContext schedulingContext) {
123         this.schedulingContext = schedulingContext;
124     }
125
126     
127     
128     /*
129      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130      *
131      * Abstract methods.
132      *
133      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134      */

135
136     /**
137      * Initialize this RemoteMBeanScheduler instance, connecting to the
138      * remote MBean server.
139      */

140     public abstract void initialize() throws SchedulerException;
141
142     /**
143      * Get the given attribute of the remote Scheduler MBean.
144      */

145     protected abstract Object JavaDoc getAttribute(
146             String JavaDoc attribute) throws SchedulerException;
147         
148     /**
149      * Get the given attributes of the remote Scheduler MBean.
150      */

151     protected abstract AttributeList JavaDoc getAttributes(String JavaDoc[] attributes)
152         throws SchedulerException;
153     
154     /**
155      * Invoke the given operation on the remote Scheduler MBean.
156      */

157     protected abstract Object JavaDoc invoke(
158         String JavaDoc operationName,
159         Object JavaDoc[] params,
160         String JavaDoc[] signature) throws SchedulerException;
161         
162
163     /*
164      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
165      *
166      * Interface.
167      *
168      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169      */

170
171     /**
172      * <p>
173      * Returns the name of the <code>Scheduler</code>.
174      * </p>
175      */

176     public String JavaDoc getSchedulerName() throws SchedulerException {
177         return (String JavaDoc)getAttribute("schedulerName");
178     }
179
180     /**
181      * <p>
182      * Returns the instance Id of the <code>Scheduler</code>.
183      * </p>
184      */

185     public String JavaDoc getSchedulerInstanceId() throws SchedulerException {
186         return (String JavaDoc)getAttribute("schedulerInstanceId");
187     }
188
189     public SchedulerMetaData getMetaData() throws SchedulerException {
190         AttributeList JavaDoc attributeList =
191             getAttributes(
192                 new String JavaDoc[] {
193                     "schedulerName",
194                     "schedulerInstanceId",
195                     "inStandbyMode",
196                     "shutdown",
197                     "jobStoreClass",
198                     "threadPoolClass",
199                     "threadPoolSize",
200                     "version"
201                 });
202         
203         return new SchedulerMetaData(
204                 (String JavaDoc)attributeList.get(0),
205                 (String JavaDoc)attributeList.get(1),
206                 getClass(), true, isStarted(),
207                 ((Boolean JavaDoc)attributeList.get(2)).booleanValue(),
208                 ((Boolean JavaDoc)attributeList.get(3)).booleanValue(),
209                 (Date JavaDoc)invoke("runningSince", new Object JavaDoc[] {}, new String JavaDoc[] {}),
210                 ((Integer JavaDoc)invoke("numJobsExecuted", new Object JavaDoc[] {}, new String JavaDoc[] {})).intValue(),
211                 (Class JavaDoc)attributeList.get(4),
212                 ((Boolean JavaDoc)invoke("supportsPersistence", new Object JavaDoc[] {}, new String JavaDoc[] {})).booleanValue(),
213                 (Class JavaDoc)attributeList.get(5),
214                 ((Integer JavaDoc)attributeList.get(6)).intValue(),
215                 (String JavaDoc)attributeList.get(7));
216     }
217
218     /**
219      * <p>
220      * Returns the <code>SchedulerContext</code> of the <code>Scheduler</code>.
221      * </p>
222      */

223     public SchedulerContext getContext() throws SchedulerException {
224         return (SchedulerContext)getAttribute("schedulerContext");
225     }
226
227     ///////////////////////////////////////////////////////////////////////////
228
///
229
/// Schedululer State Management Methods
230
///
231
///////////////////////////////////////////////////////////////////////////
232

233     /**
234      * <p>
235      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
236      * </p>
237      */

238     public void start() throws SchedulerException {
239         invoke("start", new Object JavaDoc[] {}, new String JavaDoc[] {});
240     }
241
242     /**
243      * <p>
244      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
245      * </p>
246      */

247     public void standby() throws SchedulerException {
248         invoke("standby", new Object JavaDoc[] {}, new String JavaDoc[] {});
249     }
250
251     /**
252      * @see org.quartz.Scheduler#pause()
253      * @deprecated
254      */

255     public void pause() throws SchedulerException {
256         standby();
257     }
258     
259
260     /**
261      * Whether the scheduler has been started.
262      *
263      * <p>
264      * Note: This only reflects whether <code>{@link #start()}</code> has ever
265      * been called on this Scheduler, so it will return <code>true</code> even
266      * if the <code>Scheduler</code> is currently in standby mode or has been
267      * since shutdown.
268      * </p>
269      *
270      * @see #start()
271      * @see #isShutdown()
272      * @see #isInStandbyMode()
273      */

274     public boolean isStarted() throws SchedulerException {
275         return (invoke("runningSince", new Object JavaDoc[] {}, new String JavaDoc[] {}) != null);
276     }
277     
278     /**
279      * <p>
280      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
281      * </p>
282      */

283     public boolean isInStandbyMode() throws SchedulerException {
284         return ((Boolean JavaDoc)getAttribute("inStandbyMode")).booleanValue();
285     }
286
287     /**
288      * @see org.quartz.Scheduler#isInStandbyMode()
289      * @deprecated
290      */

291     public boolean isPaused() throws SchedulerException {
292         return isInStandbyMode();
293     }
294
295     /**
296      * <p>
297      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
298      * </p>
299      */

300     public void shutdown() throws SchedulerException {
301         // Have to get the scheduler name before we actually call shutdown.
302
String JavaDoc schedulerName = getSchedulerName();
303         
304         invoke("shutdown", new Object JavaDoc[] {}, new String JavaDoc[] {});
305         SchedulerRepository.getInstance().remove(schedulerName);
306     }
307
308     /**
309      * <p>
310      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
311      * </p>
312      */

313     public void shutdown(boolean waitForJobsToComplete)
314         throws SchedulerException {
315         // Have to get the scheduler name before we actually call shutdown.
316
String JavaDoc schedulerName = getSchedulerName();
317         
318         invoke(
319             "shutdown",
320             new Object JavaDoc[] { toBoolean(waitForJobsToComplete) },
321             new String JavaDoc[] { boolean.class.getName() });
322         
323         SchedulerRepository.getInstance().remove(schedulerName);
324     }
325
326     /**
327      * <p>
328      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
329      * </p>
330      */

331     public boolean isShutdown() throws SchedulerException {
332         return ((Boolean JavaDoc)getAttribute("shutdown")).booleanValue();
333     }
334
335     /**
336      * <p>
337      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
338      * </p>
339      */

340     public List JavaDoc getCurrentlyExecutingJobs() throws SchedulerException {
341         return (List JavaDoc)invoke("getCurrentlyExecutingJobs", new Object JavaDoc[] {}, new String JavaDoc[] {});
342     }
343
344     ///////////////////////////////////////////////////////////////////////////
345
///
346
/// Scheduling-related Methods
347
///
348
///////////////////////////////////////////////////////////////////////////
349

350     /**
351      * <p>
352      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
353      * passing the <code>SchedulingContext</code> associated with this
354      * instance.
355      * </p>
356      */

357     public Date JavaDoc scheduleJob(JobDetail jobDetail, Trigger trigger)
358         throws SchedulerException {
359         return (Date JavaDoc)invoke(
360                 "scheduleJob",
361                 new Object JavaDoc[] { schedulingContext, jobDetail, trigger },
362                 new String JavaDoc[] { SchedulingContext.class.getName(), JobDetail.class.getName(), Trigger.class.getName() });
363     }
364
365     /**
366      * <p>
367      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
368      * passing the <code>SchedulingContext</code> associated with this
369      * instance.
370      * </p>
371      */

372     public Date JavaDoc scheduleJob(Trigger trigger) throws SchedulerException {
373         return (Date JavaDoc)invoke(
374                 "scheduleJob",
375                 new Object JavaDoc[] { schedulingContext, trigger },
376                 new String JavaDoc[] { SchedulingContext.class.getName(), Trigger.class.getName() });
377     }
378
379     /**
380      * <p>
381      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
382      * passing the <code>SchedulingContext</code> associated with this
383      * instance.
384      * </p>
385      */

386     public void addJob(JobDetail jobDetail, boolean replace)
387         throws SchedulerException {
388         invoke(
389             "addJob",
390             new Object JavaDoc[] { schedulingContext, jobDetail, toBoolean(replace) },
391             new String JavaDoc[] { SchedulingContext.class.getName(), JobDetail.class.getName(), boolean.class.getName() });
392     }
393
394     /**
395      * <p>
396      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
397      * passing the <code>SchedulingContext</code> associated with this
398      * instance.
399      * </p>
400      */

401     public boolean deleteJob(String JavaDoc jobName, String JavaDoc groupName)
402         throws SchedulerException {
403         return ((Boolean JavaDoc)invoke(
404                 "deleteJob",
405                 new Object JavaDoc[] { schedulingContext, jobName, groupName},
406                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() })).booleanValue();
407     }
408
409     /**
410      * <p>
411      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
412      * passing the <code>SchedulingContext</code> associated with this
413      * instance.
414      * </p>
415      */

416     public boolean unscheduleJob(String JavaDoc triggerName, String JavaDoc groupName)
417         throws SchedulerException {
418         return ((Boolean JavaDoc)invoke(
419                 "unscheduleJob",
420                 new Object JavaDoc[] { schedulingContext, triggerName, groupName},
421                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() })).booleanValue();
422     }
423
424     /**
425      * <p>
426      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
427      * passing the <code>SchedulingContext</code> associated with this
428      * instance.
429      * </p>
430      */

431     public Date JavaDoc rescheduleJob(String JavaDoc triggerName,
432             String JavaDoc groupName, Trigger newTrigger) throws SchedulerException {
433         return (Date JavaDoc)invoke(
434                 "unscheduleJob",
435                 new Object JavaDoc[] { schedulingContext, triggerName, groupName, newTrigger},
436                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName(), Trigger.class.getName() });
437     }
438     
439     
440     /**
441      * <p>
442      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
443      * passing the <code>SchedulingContext</code> associated with this
444      * instance.
445      * </p>
446      */

447     public void triggerJob(String JavaDoc jobName, String JavaDoc groupName)
448         throws SchedulerException {
449         triggerJob(jobName, groupName, null);
450     }
451     
452     /**
453      * <p>
454      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
455      * passing the <code>SchedulingContext</code> associated with this
456      * instance.
457      * </p>
458      */

459     public void triggerJob(String JavaDoc jobName, String JavaDoc groupName, JobDataMap data)
460         throws SchedulerException {
461         invoke(
462             "triggerJob",
463             new Object JavaDoc[] { schedulingContext, jobName, groupName, data},
464             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName(), JobDataMap.class.getName() });
465     }
466
467     /**
468      * <p>
469      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
470      * passing the <code>SchedulingContext</code> associated with this
471      * instance.
472      * </p>
473      */

474     public void triggerJobWithVolatileTrigger(String JavaDoc jobName, String JavaDoc groupName)
475         throws SchedulerException {
476         triggerJobWithVolatileTrigger(jobName, groupName, null);
477     }
478     
479     /**
480      * <p>
481      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
482      * passing the <code>SchedulingContext</code> associated with this
483      * instance.
484      * </p>
485      */

486     public void triggerJobWithVolatileTrigger(String JavaDoc jobName, String JavaDoc groupName, JobDataMap data)
487         throws SchedulerException {
488         invoke(
489             "triggerJobWithVolatileTrigger",
490             new Object JavaDoc[] { schedulingContext, jobName, groupName, data},
491             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName(), JobDataMap.class.getName() });
492     }
493
494     /**
495      * <p>
496      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
497      * passing the <code>SchedulingContext</code> associated with this
498      * instance.
499      * </p>
500      */

501     public void pauseTrigger(String JavaDoc triggerName, String JavaDoc groupName)
502         throws SchedulerException {
503         invoke(
504             "pauseTrigger",
505             new Object JavaDoc[] { schedulingContext, triggerName, groupName},
506             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() });
507     }
508
509     /**
510      * <p>
511      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
512      * passing the <code>SchedulingContext</code> associated with this
513      * instance.
514      * </p>
515      */

516     public void pauseTriggerGroup(String JavaDoc groupName) throws SchedulerException {
517         invoke(
518             "pauseTriggerGroup",
519             new Object JavaDoc[] { schedulingContext, groupName},
520             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName() });
521     }
522
523     /**
524      * <p>
525      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
526      * passing the <code>SchedulingContext</code> associated with this
527      * instance.
528      * </p>
529      */

530     public void pauseJob(String JavaDoc jobName, String JavaDoc groupName)
531         throws SchedulerException {
532         invoke(
533             "pauseJob",
534             new Object JavaDoc[] { schedulingContext, jobName, groupName},
535             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() });
536     }
537
538     /**
539      * <p>
540      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
541      * passing the <code>SchedulingContext</code> associated with this
542      * instance.
543      * </p>
544      */

545     public void pauseJobGroup(String JavaDoc groupName) throws SchedulerException {
546         invoke(
547             "pauseJobGroup",
548             new Object JavaDoc[] { schedulingContext, groupName},
549             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName() });
550     }
551
552     /**
553      * <p>
554      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
555      * passing the <code>SchedulingContext</code> associated with this
556      * instance.
557      * </p>
558      */

559     public void resumeTrigger(String JavaDoc triggerName, String JavaDoc groupName)
560         throws SchedulerException {
561         invoke(
562             "resumeTrigger",
563             new Object JavaDoc[] { schedulingContext, triggerName, groupName},
564             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() });
565     }
566
567     /**
568      * <p>
569      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
570      * passing the <code>SchedulingContext</code> associated with this
571      * instance.
572      * </p>
573      */

574     public void resumeTriggerGroup(String JavaDoc groupName) throws SchedulerException {
575         invoke(
576             "resumeTriggerGroup",
577             new Object JavaDoc[] { schedulingContext, groupName},
578             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName() });
579     }
580
581     /**
582      * <p>
583      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
584      * passing the <code>SchedulingContext</code> associated with this
585      * instance.
586      * </p>
587      */

588     public void resumeJob(String JavaDoc jobName, String JavaDoc groupName)
589         throws SchedulerException {
590         invoke(
591             "resumeJob",
592             new Object JavaDoc[] { schedulingContext, jobName, groupName},
593             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() });
594     }
595
596     /**
597      * <p>
598      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
599      * passing the <code>SchedulingContext</code> associated with this
600      * instance.
601      * </p>
602      */

603     public void resumeJobGroup(String JavaDoc groupName) throws SchedulerException {
604         invoke(
605             "resumeJobGroup",
606             new Object JavaDoc[] { schedulingContext, groupName},
607             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName() });
608     }
609
610     /**
611      * <p>
612      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
613      * passing the <code>SchedulingContext</code> associated with this
614      * instance.
615      * </p>
616      */

617     public void pauseAll() throws SchedulerException {
618         invoke(
619             "pauseAll",
620             new Object JavaDoc[] { schedulingContext},
621             new String JavaDoc[] { SchedulingContext.class.getName() });
622     }
623
624     /**
625      * <p>
626      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
627      * passing the <code>SchedulingContext</code> associated with this
628      * instance.
629      * </p>
630      */

631     public void resumeAll() throws SchedulerException {
632         invoke(
633             "resumeAll",
634             new Object JavaDoc[] { schedulingContext},
635             new String JavaDoc[] { SchedulingContext.class.getName() });
636     }
637
638     /**
639      * <p>
640      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
641      * passing the <code>SchedulingContext</code> associated with this
642      * instance.
643      * </p>
644      */

645     public String JavaDoc[] getJobGroupNames() throws SchedulerException {
646         return (String JavaDoc[])invoke(
647                 "getJobGroupNames",
648                 new Object JavaDoc[] { schedulingContext},
649                 new String JavaDoc[] { SchedulingContext.class.getName() });
650     }
651
652     /**
653      * <p>
654      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
655      * passing the <code>SchedulingContext</code> associated with this
656      * instance.
657      * </p>
658      */

659     public String JavaDoc[] getJobNames(String JavaDoc groupName) throws SchedulerException {
660         return (String JavaDoc[])invoke(
661                 "getJobNames",
662                 new Object JavaDoc[] { schedulingContext, groupName },
663                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName() });
664     }
665
666     /**
667      * <p>
668      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
669      * passing the <code>SchedulingContext</code> associated with this
670      * instance.
671      * </p>
672      */

673     public Trigger[] getTriggersOfJob(String JavaDoc jobName, String JavaDoc groupName)
674         throws SchedulerException {
675         return (Trigger[])invoke(
676                 "getTriggersOfJob",
677                 new Object JavaDoc[] { schedulingContext, jobName, groupName },
678                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() });
679     }
680
681     /**
682      * <p>
683      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
684      * passing the <code>SchedulingContext</code> associated with this
685      * instance.
686      * </p>
687      */

688     public String JavaDoc[] getTriggerGroupNames() throws SchedulerException {
689         return (String JavaDoc[])invoke(
690                 "getTriggerGroupNames",
691                 new Object JavaDoc[] { schedulingContext},
692                 new String JavaDoc[] { SchedulingContext.class.getName() });
693     }
694
695     /**
696      * <p>
697      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
698      * passing the <code>SchedulingContext</code> associated with this
699      * instance.
700      * </p>
701      */

702     public String JavaDoc[] getTriggerNames(String JavaDoc groupName) throws SchedulerException {
703         return (String JavaDoc[])invoke(
704                 "getTriggerNames",
705                 new Object JavaDoc[] { schedulingContext, groupName },
706                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName() });
707     }
708
709     /**
710      * <p>
711      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
712      * passing the <code>SchedulingContext</code> associated with this
713      * instance.
714      * </p>
715      */

716     public JobDetail getJobDetail(String JavaDoc jobName, String JavaDoc jobGroup)
717         throws SchedulerException {
718         return (JobDetail)invoke(
719                 "getJobDetail",
720                 new Object JavaDoc[] { schedulingContext, jobName, jobGroup },
721                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() });
722     }
723
724     /**
725      * <p>
726      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
727      * passing the <code>SchedulingContext</code> associated with this
728      * instance.
729      * </p>
730      */

731     public Trigger getTrigger(String JavaDoc triggerName, String JavaDoc triggerGroup)
732         throws SchedulerException {
733         return (Trigger)invoke(
734                 "getTrigger",
735                 new Object JavaDoc[] { schedulingContext, triggerName, triggerGroup },
736                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() });
737     }
738
739     /**
740      * <p>
741      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
742      * passing the <code>SchedulingContext</code> associated with this
743      * instance.
744      * </p>
745      */

746     public int getTriggerState(String JavaDoc triggerName, String JavaDoc triggerGroup)
747         throws SchedulerException {
748         return ((Integer JavaDoc)invoke(
749                 "getTriggerState",
750                 new Object JavaDoc[] { schedulingContext, triggerName, triggerGroup },
751                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() })).intValue();
752     }
753
754     /**
755      * <p>
756      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
757      * passing the <code>SchedulingContext</code> associated with this
758      * instance.
759      * </p>
760      */

761     public void addCalendar(String JavaDoc calName, Calendar calendar, boolean replace, boolean updateTriggers)
762         throws SchedulerException {
763         invoke(
764             "addCalendar",
765             new Object JavaDoc[] { schedulingContext, calName, calendar, toBoolean(replace), toBoolean(updateTriggers) },
766             new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(),
767                     Calendar.class.getName(), boolean.class.getName(), boolean.class.getName() });
768     }
769
770     /**
771      * <p>
772      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
773      * passing the <code>SchedulingContext</code> associated with this
774      * instance.
775      * </p>
776      */

777     public boolean deleteCalendar(String JavaDoc calName) throws SchedulerException {
778         return ((Boolean JavaDoc)invoke(
779                 "getTriggerState",
780                 new Object JavaDoc[] { schedulingContext, calName },
781                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName() })).booleanValue();
782     }
783
784     /**
785      * <p>
786      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
787      * passing the <code>SchedulingContext</code> associated with this
788      * instance.
789      * </p>
790      */

791     public Calendar getCalendar(String JavaDoc calName) throws SchedulerException {
792         return (Calendar)invoke(
793                 "getCalendar",
794                 new Object JavaDoc[] { schedulingContext, calName },
795                 new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName() });
796     }
797
798     /**
799      * <p>
800      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
801      * passing the <code>SchedulingContext</code> associated with this
802      * instance.
803      * </p>
804      */

805     public String JavaDoc[] getCalendarNames() throws SchedulerException {
806         return (String JavaDoc[])invoke(
807                 "getCalendarNames",
808                 new Object JavaDoc[] { schedulingContext },
809                 new String JavaDoc[] { SchedulingContext.class.getName() });
810     }
811
812     ///////////////////////////////////////////////////////////////////////////
813
///
814
/// Listener-related Methods
815
///
816
///////////////////////////////////////////////////////////////////////////
817

818     /**
819      * <p>
820      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
821      * </p>
822      */

823     public void addGlobalJobListener(JobListener jobListener)
824         throws SchedulerException {
825         throw new SchedulerException(
826                 "Operation not supported for remote schedulers.",
827                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
828     }
829
830     /**
831      * <p>
832      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
833      * </p>
834      */

835     public void addJobListener(JobListener jobListener)
836         throws SchedulerException {
837         throw new SchedulerException(
838                 "Operation not supported for remote schedulers.",
839                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
840     }
841
842     /**
843      * <p>
844      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
845      * </p>
846      * @deprecated Use <code>{@link #removeGlobalJobListener(String)}</code>
847      */

848     public boolean removeGlobalJobListener(JobListener jobListener)
849         throws SchedulerException {
850         throw new SchedulerException(
851                 "Operation not supported for remote schedulers.",
852                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
853     }
854
855     /**
856      * <p>
857      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
858      * </p>
859      */

860     public boolean removeGlobalJobListener(String JavaDoc name)
861         throws SchedulerException {
862         throw new SchedulerException(
863                 "Operation not supported for remote schedulers.",
864                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
865     }
866
867     /**
868      * <p>
869      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
870      * </p>
871      */

872     public boolean removeJobListener(String JavaDoc name) throws SchedulerException {
873         throw new SchedulerException(
874                 "Operation not supported for remote schedulers.",
875                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
876     }
877
878     /**
879      * <p>
880      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
881      * </p>
882      */

883     public List JavaDoc getGlobalJobListeners() throws SchedulerException {
884         throw new SchedulerException(
885                 "Operation not supported for remote schedulers.",
886                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
887     }
888
889     /**
890      * <p>
891      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
892      * </p>
893      */

894     public Set JavaDoc getJobListenerNames() throws SchedulerException {
895         throw new SchedulerException(
896                 "Operation not supported for remote schedulers.",
897                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
898     }
899
900     /**
901      * <p>
902      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
903      * </p>
904      */

905     public JobListener getGlobalJobListener(String JavaDoc name) throws SchedulerException {
906         throw new SchedulerException(
907                 "Operation not supported for remote schedulers.",
908                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
909     }
910     
911     /**
912      * <p>
913      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
914      * </p>
915      */

916     public JobListener getJobListener(String JavaDoc name) throws SchedulerException {
917         throw new SchedulerException(
918                 "Operation not supported for remote schedulers.",
919                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
920     }
921
922     /**
923      * <p>
924      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
925      * </p>
926      */

927     public void addGlobalTriggerListener(TriggerListener triggerListener)
928         throws SchedulerException {
929         throw new SchedulerException(
930                 "Operation not supported for remote schedulers.",
931                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
932     }
933
934     /**
935      * <p>
936      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
937      * </p>
938      */

939     public void addTriggerListener(TriggerListener triggerListener)
940         throws SchedulerException {
941         throw new SchedulerException(
942                 "Operation not supported for remote schedulers.",
943                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
944     }
945
946     /**
947      * <p>
948      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
949      * </p>
950      * @deprecated Use <code>{@link #removeGlobalTriggerListener(String)}</code>
951      */

952     public boolean removeGlobalTriggerListener(TriggerListener triggerListener)
953         throws SchedulerException {
954         throw new SchedulerException(
955                 "Operation not supported for remote schedulers.",
956                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
957     }
958
959     /**
960      * <p>
961      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
962      * </p>
963      */

964     public boolean removeGlobalTriggerListener(String JavaDoc name)
965         throws SchedulerException {
966         throw new SchedulerException(
967                 "Operation not supported for remote schedulers.",
968                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
969     }
970
971     /**
972      * <p>
973      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
974      * </p>
975      */

976     public boolean removeTriggerListener(String JavaDoc name) throws SchedulerException {
977         throw new SchedulerException(
978                 "Operation not supported for remote schedulers.",
979                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
980     }
981
982     /**
983      * <p>
984      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
985      * </p>
986      */

987     public List JavaDoc getGlobalTriggerListeners() throws SchedulerException {
988         throw new SchedulerException(
989                 "Operation not supported for remote schedulers.",
990                 SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
991     }
992
993     /**
994      * <p>
995      * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
996      * </p>
997      */

998     public Set JavaDoc getTriggerListenerNames() throws SchedulerException {
999         throw new SchedulerException(
1000                "Operation not supported for remote schedulers.",
1001                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1002    }
1003
1004    /**
1005     * <p>
1006     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1007     * </p>
1008     */

1009    public TriggerListener getGlobalTriggerListener(String JavaDoc name)
1010        throws SchedulerException {
1011        throw new SchedulerException(
1012                "Operation not supported for remote schedulers.",
1013                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1014    }
1015
1016    /**
1017     * <p>
1018     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1019     * </p>
1020     */

1021    public TriggerListener getTriggerListener(String JavaDoc name)
1022        throws SchedulerException {
1023        throw new SchedulerException(
1024                "Operation not supported for remote schedulers.",
1025                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1026    }
1027
1028    /**
1029     * <p>
1030     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1031     * </p>
1032     */

1033    public void addSchedulerListener(SchedulerListener schedulerListener)
1034        throws SchedulerException {
1035        throw new SchedulerException(
1036                "Operation not supported for remote schedulers.",
1037                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1038    }
1039
1040    /**
1041     * <p>
1042     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1043     * </p>
1044     */

1045    public boolean removeSchedulerListener(SchedulerListener schedulerListener)
1046        throws SchedulerException {
1047        throw new SchedulerException(
1048                "Operation not supported for remote schedulers.",
1049                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1050    }
1051
1052    /**
1053     * <p>
1054     * Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
1055     * </p>
1056     */

1057    public List JavaDoc getSchedulerListeners() throws SchedulerException {
1058        throw new SchedulerException(
1059                "Operation not supported for remote schedulers.",
1060                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1061    }
1062
1063    /**
1064     * @see org.quartz.Scheduler#getPausedTriggerGroups()
1065     */

1066    public Set JavaDoc getPausedTriggerGroups() throws SchedulerException {
1067        return (Set JavaDoc)invoke(
1068                "getPausedTriggerGroups",
1069                new Object JavaDoc[] { schedulingContext },
1070                new String JavaDoc[] { SchedulingContext.class.getName() });
1071    }
1072
1073    /**
1074     * @see org.quartz.Scheduler#interrupt(java.lang.String, java.lang.String)
1075     */

1076    public boolean interrupt(String JavaDoc jobName, String JavaDoc groupName) throws UnableToInterruptJobException {
1077        try {
1078            return ((Boolean JavaDoc)invoke(
1079                    "interrupt",
1080                    new Object JavaDoc[] { schedulingContext, jobName, groupName},
1081                    new String JavaDoc[] { SchedulingContext.class.getName(), String JavaDoc.class.getName(), String JavaDoc.class.getName() })).booleanValue();
1082        } catch (SchedulerException se) {
1083            throw new UnableToInterruptJobException(se);
1084        }
1085    }
1086
1087    /**
1088     * @see org.quartz.Scheduler#setJobFactory(org.quartz.spi.JobFactory)
1089     */

1090    public void setJobFactory(JobFactory factory) throws SchedulerException {
1091        throw new SchedulerException(
1092                "Operation not supported for remote schedulers.",
1093                SchedulerException.ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION);
1094    }
1095    
1096    protected Boolean JavaDoc toBoolean(boolean bool) {
1097        return (bool) ? Boolean.TRUE : Boolean.FALSE;
1098    }
1099}
1100
Popular Tags