EMMA Coverage Report (generated Fri Jan 30 13:20:29 EST 2009)
[all classes][org.springframework.batch.core.listener]

COVERAGE SUMMARY FOR SOURCE FILE [CompositeSkipListener.java]

nameclass, %method, %block, %line, %
CompositeSkipListener.java100% (1/1)80%  (4/5)90%  (46/51)88%  (14/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompositeSkipListener100% (1/1)80%  (4/5)90%  (46/51)88%  (14/16)
setListeners (SkipListener []): void 0%   (0/1)0%   (0/5)0%   (0/2)
CompositeSkipListener (): void 100% (1/1)100% (8/8)100% (2/2)
onSkipInRead (Throwable): void 100% (1/1)100% (16/16)100% (5/5)
onSkipInWrite (Object, Throwable): void 100% (1/1)100% (17/17)100% (5/5)
register (SkipListener): void 100% (1/1)100% (5/5)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.core.listener;
17 
18import java.util.Iterator;
19 
20import org.springframework.batch.core.SkipListener;
21import org.springframework.core.Ordered;
22 
23/**
24 * @author Dave Syer
25 * 
26 */
27public class CompositeSkipListener implements SkipListener {
28 
29        private OrderedComposite listeners = new OrderedComposite();
30 
31        /**
32         * Public setter for the listeners.
33         * 
34         * @param listeners
35         */
36        public void setListeners(SkipListener[] listeners) {
37                this.listeners.setItems(listeners);
38        }
39 
40        /**
41         * Register additional listener.
42         * 
43         * @param listener
44         */
45        public void register(SkipListener listener) {
46                listeners.add(listener);
47        }
48 
49        /**
50         * Call the registered listeners in order, respecting and prioritising those
51         * that implement {@link Ordered}.
52         * @see org.springframework.batch.core.SkipListener#onSkipInRead(java.lang.Throwable)
53         */
54        public void onSkipInRead(Throwable t) {
55                for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
56                        SkipListener listener = (SkipListener) iterator.next();
57                        listener.onSkipInRead(t);
58                }
59        }
60 
61        /**
62         * Call the registered listeners in order, respecting and prioritising those
63         * that implement {@link Ordered}.
64         * @see org.springframework.batch.core.SkipListener#onSkipInWrite(java.lang.Object,
65         * java.lang.Throwable)
66         */
67        public void onSkipInWrite(Object item, Throwable t) {
68                for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
69                        SkipListener listener = (SkipListener) iterator.next();
70                        listener.onSkipInWrite(item, t);
71                }
72        }
73}

[all classes][org.springframework.batch.core.listener]
EMMA 2.0.5312 (C) Vladimir Roubtsov