01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package edu.iu.uis.eden.messaging.quartz;
17:
18: import org.kuali.bus.services.KSBServiceLocator;
19: import org.kuali.rice.RiceConstants;
20: import org.quartz.JobExecutionContext;
21: import org.quartz.JobExecutionException;
22: import org.quartz.JobListener;
23:
24: import edu.iu.uis.eden.messaging.PersistedMessage;
25:
26: /**
27: * This is a description of what this class does - rkirkend don't forget to fill this in.
28: *
29: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
30: *
31: */
32: public class MessageServiceExecutorJobListener implements JobListener {
33:
34: public static final String NAME = "MessageServiceExecutorJobListener";
35:
36: /**
37: * This overridden method ...
38: *
39: * @see org.quartz.JobListener#getName()
40: */
41: public String getName() {
42: return NAME;
43: }
44:
45: /**
46: * This overridden method ...
47: *
48: * @see org.quartz.JobListener#jobExecutionVetoed(org.quartz.JobExecutionContext)
49: */
50: public void jobExecutionVetoed(JobExecutionContext context) {
51: }
52:
53: /**
54: * This overridden method ...
55: *
56: * @see org.quartz.JobListener#jobToBeExecuted(org.quartz.JobExecutionContext)
57: */
58: public void jobToBeExecuted(JobExecutionContext context) {
59: }
60:
61: /**
62: * This overridden method ...
63: *
64: * @see org.quartz.JobListener#jobWasExecuted(org.quartz.JobExecutionContext, org.quartz.JobExecutionException)
65: */
66: public void jobWasExecuted(JobExecutionContext context,
67: JobExecutionException exception) {
68: if (context.getJobInstance() instanceof MessageServiceExecutorJob
69: && exception != null) {
70: PersistedMessage message = (PersistedMessage) context
71: .getJobDetail().getJobDataMap().get(
72: MessageServiceExecutorJob.MESSAGE_KEY);
73: message.setQueueStatus(RiceConstants.ROUTE_QUEUE_EXCEPTION);
74: KSBServiceLocator.getRouteQueueService().save(message);
75: }
76:
77: }
78:
79: }
|