EMMA Coverage Report (generated Thu Jan 24 13:37:04 CST 2013)
[all classes][org.springframework.batch.core.configuration.support]

COVERAGE SUMMARY FOR SOURCE FILE [JobFactoryRegistrationListener.java]

nameclass, %method, %block, %line, %
JobFactoryRegistrationListener.java100% (1/1)100% (4/4)100% (47/47)100% (10/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JobFactoryRegistrationListener100% (1/1)100% (4/4)100% (47/47)100% (10/10)
JobFactoryRegistrationListener (): void 100% (1/1)100% (8/8)100% (2/2)
bind (JobFactory, Map): void 100% (1/1)100% (17/17)100% (3/3)
setJobRegistry (JobRegistry): void 100% (1/1)100% (4/4)100% (2/2)
unbind (JobFactory, Map): void 100% (1/1)100% (18/18)100% (3/3)

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 */
16 
17package org.springframework.batch.core.configuration.support;
18 
19import java.util.Map;
20 
21import org.apache.commons.logging.Log;
22import org.apache.commons.logging.LogFactory;
23import org.springframework.batch.core.configuration.JobFactory;
24import org.springframework.batch.core.configuration.JobRegistry;
25 
26/**
27 * Generic service that can bind and unbind a {@link JobFactory} in a
28 * {@link JobRegistry}.
29 * 
30 * @author Dave Syer
31 * 
32 */
33public class JobFactoryRegistrationListener {
34 
35        private Log logger = LogFactory.getLog(getClass());
36 
37        private JobRegistry jobRegistry;
38 
39        /**
40         * Public setter for a {@link JobRegistry} to use for all the bind and
41         * unbind events.
42         * 
43         * @param jobRegistry {@link JobRegistry}
44         */
45        public void setJobRegistry(JobRegistry jobRegistry) {
46                this.jobRegistry = jobRegistry;
47        }
48 
49        /**
50         * Take the {@link JobFactory} provided and register it with the
51         * {@link JobRegistry}.
52         * @param jobFactory a {@link JobFactory}
53         * @param params not needed by this listener.
54         * @throws Exception if there is a problem
55         */
56        public void bind(JobFactory jobFactory, Map<String, ?> params) throws Exception {
57                logger.info("Binding JobFactory: " + jobFactory.getJobName());
58                jobRegistry.register(jobFactory);
59        }
60 
61        /**
62         * Take the {@link JobFactory} provided and unregister it with the
63         * {@link JobRegistry}.
64         * @param jobFactory a {@link JobFactory}
65         * @param params not needed by this listener.
66         * @throws Exception if there is a problem
67         */
68        public void unbind(JobFactory jobFactory, Map<String, ?> params) throws Exception {
69                logger.info("Unbinding JobFactory: " + jobFactory.getJobName());
70                jobRegistry.unregister(jobFactory.getJobName());
71        }
72 
73}

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