EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[all classes][org.springframework.batch.item.jms]

COVERAGE SUMMARY FOR SOURCE FILE [JmsMethodInvocationRecoverer.java]

nameclass, %method, %block, %line, %
JmsMethodInvocationRecoverer.java100% (1/1)100% (3/3)81%  (34/42)70%  (7/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JmsMethodInvocationRecoverer100% (1/1)100% (3/3)81%  (34/42)70%  (7/10)
recover (Object [], Throwable): Object 100% (1/1)73%  (22/30)50%  (3/6)
JmsMethodInvocationRecoverer (): void 100% (1/1)100% (8/8)100% (2/2)
setJmsTemplate (JmsOperations): void 100% (1/1)100% (4/4)100% (2/2)

1/*
2 * Copyright 2006-2007 the original author or authors.
3 *
4 * Licensed under the Apache 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.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,
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 */
16package org.springframework.batch.item.jms;
17 
18import org.apache.commons.logging.Log;
19import org.apache.commons.logging.LogFactory;
20import org.springframework.retry.interceptor.MethodInvocationRecoverer;
21import org.springframework.jms.JmsException;
22import org.springframework.jms.core.JmsOperations;
23 
24/**
25 * @author Dave Syer
26 * 
27 */
28public class JmsMethodInvocationRecoverer<T> implements MethodInvocationRecoverer<T> {
29 
30        protected Log logger = LogFactory.getLog(getClass());
31 
32        private JmsOperations jmsTemplate;
33 
34        /**
35         * Setter for jms template.
36         * 
37         * @param jmsTemplate a {@link JmsOperations} instance
38         */
39        public void setJmsTemplate(JmsOperations jmsTemplate) {
40                this.jmsTemplate = jmsTemplate;
41        }
42 
43        /**
44         * Send one message per item in the arguments list using the default destination of
45         * the jms template. If the recovery is successful null is returned.
46         * 
47         * @see org.springframework.retry.interceptor.MethodInvocationRecoverer#recover(Object[],
48         * Throwable)
49         */
50    @Override
51        public T recover(Object[] items, Throwable cause) {
52                try {
53                        for (Object item : items) {
54                                jmsTemplate.convertAndSend(item);
55                        }
56                        return null;
57                }
58                catch (JmsException e) {
59                        logger.error("Could not recover because of JmsException.", e);
60                        throw e;
61                }
62        }
63 
64}

[all classes][org.springframework.batch.item.jms]
EMMA 2.0.5312 (C) Vladimir Roubtsov