KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jresearch > gossip > scheduler > listeners > TriggerListener


1 /*
2  * $Id: TriggerListener.java,v 1.3 2005/06/07 12:32:17 bel70 Exp $
3  *
4  * ***** BEGIN LICENSE BLOCK *****
5  * The contents of this file are subject to the Mozilla Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License
8  * at http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific language governing rights and
13  * limitations under the License.
14  *
15  * The Original Code is JGossip forum code.
16  *
17  * The Initial Developer of the Original Code is the JResearch, Org.
18  * Portions created by the Initial Developer are Copyright (C) 2004
19  * the Initial Developer. All Rights Reserved.
20  *
21  * Contributor(s):
22  * Alexey Pavlov <alexnet@users.sourceforge.net>
23  *
24  * ***** END LICENSE BLOCK ***** */

25 package org.jresearch.gossip.scheduler.listeners;
26
27 import org.jresearch.gossip.exception.SystemException;
28 import org.jresearch.gossip.log.avalon.JGossipLog;
29 import org.quartz.JobExecutionContext;
30 import org.quartz.Trigger;
31
32 /**
33  * TriggerListener
34  *
35  * @author <a HREF="alexnet@sourceforge.net">A. Pavlov</a>
36  * @version $version$ $Date: 2005/06/07 12:32:17 $
37  */

38 public class TriggerListener implements org.quartz.TriggerListener {
39
40     /**
41      * @see org.quartz.TriggerListener#getName()
42      */

43     public String JavaDoc getName() {
44         return "Misfired Trigger Listener";
45     }
46
47     /**
48      * @see org.quartz.TriggerListener#triggerFired(org.quartz.Trigger,
49      * org.quartz.JobExecutionContext)
50      */

51     public void triggerFired(Trigger trigger, JobExecutionContext ctx) {
52     }
53
54     /**
55      * @see org.quartz.TriggerListener#vetoJobExecution(org.quartz.Trigger,
56      * org.quartz.JobExecutionContext)
57      */

58     public boolean vetoJobExecution(Trigger trigger, JobExecutionContext ctx) {
59         return false;
60     }
61
62     /**
63      * @see org.quartz.TriggerListener#triggerMisfired(org.quartz.Trigger)
64      */

65     public void triggerMisfired(Trigger trigger) {
66
67         StringBuffer JavaDoc message = new StringBuffer JavaDoc();
68         message.append("Trigger[").append(trigger.getName()).append(
69                 "], description[").append(trigger.getDescription()).append(
70                 "], volatile[").append(trigger.isVolatile()).append(
71                 "] misfered:\n").append("\tMay fire again[").append(
72                 trigger.mayFireAgain()).append("], next firing time[").append(
73                 trigger.getNextFireTime()).append("], misfire instructions[")
74                 .append(trigger.getMisfireInstruction()).append("].\n\tJob [")
75                 .append(trigger.getJobName()).append("], description[").append(
76                         trigger.getFullJobName()).append("], instance[")
77                 .append(trigger.getFireInstanceId()).append("].");
78         try {
79             JGossipLog.getInstance().getAppLogger().warn(message.toString());
80         } catch (SystemException e) {
81             e.printStackTrace();
82         }
83
84     }
85
86     /**
87      * @see org.quartz.TriggerListener#triggerComplete(org.quartz.Trigger,
88      * org.quartz.JobExecutionContext, int)
89      */

90     public void triggerComplete(Trigger trigger, JobExecutionContext ctx,
91             int triggerInstructionCodetriggerInstructionCode) {
92     }
93
94 }
95
Popular Tags