001: /*
002: * Copyright 2004-2005 OpenSymphony
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License. You may obtain a copy
006: * of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013: * License for the specific language governing permissions and limitations
014: * under the License.
015: *
016: */
017:
018: /*
019: * Previously Copyright (c) 2001-2004 James House
020: */
021: package org.quartz;
022:
023: /**
024: * <p>
025: * The interface to be implemented by classes that want to be informed when a
026: * <code>{@link Trigger}</code> fires. In general, applications that use a
027: * <code>Scheduler</code> will not have use for this mechanism.
028: * </p>
029: *
030: * @see Scheduler
031: * @see Trigger
032: * @see JobListener
033: * @see JobExecutionContext
034: *
035: * @author James House
036: */
037: public interface TriggerListener {
038:
039: /*
040: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
041: *
042: * Interface.
043: *
044: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
045: */
046:
047: /**
048: * <p>
049: * Get the name of the <code>TriggerListener</code>.
050: * </p>
051: */
052: String getName();
053:
054: /**
055: * <p>
056: * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
057: * has fired, and it's associated <code>{@link org.quartz.JobDetail}</code>
058: * is about to be executed.
059: * </p>
060: *
061: * <p>
062: * It is called before the <code>vetoJobExecution(..)</code> method of this
063: * interface.
064: * </p>
065: *
066: * @param trigger
067: * The <code>Trigger</code> that has fired.
068: * @param context
069: * The <code>JobExecutionContext</code> that will be passed to
070: * the <code>Job</code>'s<code>execute(xx)</code> method.
071: */
072: void triggerFired(Trigger trigger, JobExecutionContext context);
073:
074: /**
075: * <p>
076: * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
077: * has fired, and it's associated <code>{@link org.quartz.JobDetail}</code>
078: * is about to be executed.
079: * </p>
080: *
081: * <p>
082: * It is called after the <code>triggerFired(..)</code> method of this
083: * interface.
084: * </p>
085: *
086: * @param trigger
087: * The <code>Trigger</code> that has fired.
088: * @param context
089: * The <code>JobExecutionContext</code> that will be passed to
090: * the <code>Job</code>'s<code>execute(xx)</code> method.
091: */
092: boolean vetoJobExecution(Trigger trigger,
093: JobExecutionContext context);
094:
095: /**
096: * <p>
097: * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
098: * has misfired.
099: * </p>
100: *
101: * <p>
102: * Consideration should be given to how much time is spent in this method,
103: * as it will affect all triggers that are misfiring. If you have lots
104: * of triggers misfiring at once, it could be an issue it this method
105: * does a lot.
106: * </p>
107: *
108: * @param trigger
109: * The <code>Trigger</code> that has misfired.
110: */
111: void triggerMisfired(Trigger trigger);
112:
113: /**
114: * <p>
115: * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
116: * has fired, it's associated <code>{@link org.quartz.JobDetail}</code>
117: * has been executed, and it's <code>triggered(xx)</code> method has been
118: * called.
119: * </p>
120: *
121: * @param trigger
122: * The <code>Trigger</code> that was fired.
123: * @param context
124: * The <code>JobExecutionContext</code> that was passed to the
125: * <code>Job</code>'s<code>execute(xx)</code> method.
126: * @param triggerInstructionCode
127: * the result of the call on the <code>Trigger</code>'s<code>triggered(xx)</code>
128: * method.
129: */
130: void triggerComplete(Trigger trigger, JobExecutionContext context,
131: int triggerInstructionCode);
132:
133: }
|