| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| MessageServiceExecutorJobListener |
|
| 1.5;1.5 |
| 1 | /* | |
| 2 | * Copyright 2007 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 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, | |
| 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 org.kuali.rice.ksb.messaging.quartz; | |
| 17 | ||
| 18 | import org.kuali.rice.ksb.messaging.PersistedMessageBO; | |
| 19 | import org.kuali.rice.ksb.service.KSBServiceLocator; | |
| 20 | import org.kuali.rice.ksb.util.KSBConstants; | |
| 21 | import org.quartz.JobExecutionContext; | |
| 22 | import org.quartz.JobExecutionException; | |
| 23 | import org.quartz.JobListener; | |
| 24 | ||
| 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 (rice.collab@kuali.org) | |
| 30 | * | |
| 31 | */ | |
| 32 | 0 | 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 | 0 | 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 | 0 | } |
| 52 | ||
| 53 | /** | |
| 54 | * This overridden method ... | |
| 55 | * | |
| 56 | * @see org.quartz.JobListener#jobToBeExecuted(org.quartz.JobExecutionContext) | |
| 57 | */ | |
| 58 | public void jobToBeExecuted(JobExecutionContext context) { | |
| 59 | 0 | } |
| 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, JobExecutionException exception) { | |
| 67 | 0 | if (context.getJobInstance() instanceof MessageServiceExecutorJob && exception != null) { |
| 68 | 0 | PersistedMessageBO message = (PersistedMessageBO)context.getJobDetail().getJobDataMap().get(MessageServiceExecutorJob.MESSAGE_KEY); |
| 69 | 0 | message.setQueueStatus(KSBConstants.ROUTE_QUEUE_EXCEPTION); |
| 70 | 0 | KSBServiceLocator.getRouteQueueService().save(message); |
| 71 | } | |
| 72 | ||
| 73 | 0 | } |
| 74 | ||
| 75 | } |