KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > examples > example14 > TriggerEchoJob


1 /*
2  * Copyright 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.examples.example14;
18
19 import org.apache.commons.logging.Log;
20 import org.apache.commons.logging.LogFactory;
21 import org.quartz.Job;
22 import org.quartz.JobExecutionContext;
23 import org.quartz.JobExecutionException;
24
25 /**
26  * This is just a simple job that echos the name of the Trigger
27  * that fired it.
28  */

29 public class TriggerEchoJob implements Job {
30
31     private static final Log LOG = LogFactory.getLog(TriggerEchoJob.class);
32
33     /**
34      * Empty constructor for job initilization
35      *
36      * <p>
37      * Quartz requires a public empty constructor so that the
38      * scheduler can instantiate the class whenever it needs.
39      * </p>
40      */

41     public TriggerEchoJob() {
42     }
43
44     /**
45      * <p>
46      * Called by the <code>{@link org.quartz.Scheduler}</code> when a
47      * <code>{@link org.quartz.Trigger}</code> fires that is associated with
48      * the <code>Job</code>.
49      * </p>
50      *
51      * @throws JobExecutionException
52      * if there is an exception while executing the job.
53      */

54     public void execute(JobExecutionContext context)
55         throws JobExecutionException {
56         LOG.info("TRIGGER: " + context.getTrigger().getName());
57     }
58
59 }
Popular Tags