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

COVERAGE SUMMARY FOR SOURCE FILE [JobParserJobFactoryBean.java]

nameclass, %method, %block, %line, %
JobParserJobFactoryBean.java100% (1/1)85%  (11/13)89%  (88/99)89%  (32/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JobParserJobFactoryBean100% (1/1)85%  (11/13)89%  (88/99)89%  (32/36)
isPrototype (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
setRestartable (Boolean): void 0%   (0/1)0%   (0/4)0%   (0/2)
getObject (): Object 100% (1/1)91%  (53/58)94%  (15/16)
JobParserJobFactoryBean (String): void 100% (1/1)100% (6/6)100% (3/3)
getJobRepository (): JobRepository 100% (1/1)100% (3/3)100% (1/1)
getObjectType (): Class 100% (1/1)100% (2/2)100% (1/1)
isEagerInit (): boolean 100% (1/1)100% (2/2)100% (1/1)
isSingleton (): boolean 100% (1/1)100% (2/2)100% (1/1)
setFlow (Flow): void 100% (1/1)100% (4/4)100% (2/2)
setJobExecutionListeners (JobExecutionListener []): void 100% (1/1)100% (4/4)100% (2/2)
setJobParametersIncrementer (JobParametersIncrementer): void 100% (1/1)100% (4/4)100% (2/2)
setJobParametersValidator (JobParametersValidator): void 100% (1/1)100% (4/4)100% (2/2)
setJobRepository (JobRepository): void 100% (1/1)100% (4/4)100% (2/2)

1/*
2 * Copyright 2006-2013 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.configuration.xml;
17 
18import org.springframework.batch.core.JobExecutionListener;
19import org.springframework.batch.core.JobParametersIncrementer;
20import org.springframework.batch.core.JobParametersValidator;
21import org.springframework.batch.core.job.flow.Flow;
22import org.springframework.batch.core.job.flow.FlowJob;
23import org.springframework.batch.core.repository.JobRepository;
24import org.springframework.beans.factory.FactoryBean;
25import org.springframework.beans.factory.SmartFactoryBean;
26import org.springframework.util.Assert;
27import org.springframework.util.StringUtils;
28 
29/**
30 * This {@link FactoryBean} is used by the batch namespace parser to create
31 * {@link FlowJob} objects. It stores all of the properties that are
32 * configurable on the <job/>.
33 *
34 * @author Dan Garrette
35 * @author Dave Syer
36 * @since 2.0.1
37 */
38class JobParserJobFactoryBean implements SmartFactoryBean {
39 
40        private String name;
41 
42        private Boolean restartable;
43 
44        private JobRepository jobRepository;
45 
46        private JobParametersValidator jobParametersValidator;
47 
48        private JobExecutionListener[] jobExecutionListeners;
49 
50        private JobParametersIncrementer jobParametersIncrementer;
51 
52        private Flow flow;
53 
54        public JobParserJobFactoryBean(String name) {
55                this.name = name;
56        }
57 
58        @Override
59        public final Object getObject() throws Exception {
60                Assert.isTrue(StringUtils.hasText(name), "The job must have an id.");
61                FlowJob flowJob = new FlowJob(name);
62 
63                if (restartable != null) {
64                        flowJob.setRestartable(restartable);
65                }
66 
67                if (jobRepository != null) {
68                        flowJob.setJobRepository(jobRepository);
69                }
70 
71                if (jobParametersValidator != null) {
72                        flowJob.setJobParametersValidator(jobParametersValidator);
73                }
74 
75                if (jobExecutionListeners != null) {
76                        flowJob.setJobExecutionListeners(jobExecutionListeners);
77                }
78 
79                if (jobParametersIncrementer != null) {
80                        flowJob.setJobParametersIncrementer(jobParametersIncrementer);
81                }
82 
83                if (flow != null) {
84                        flowJob.setFlow(flow);
85                }
86 
87                flowJob.afterPropertiesSet();
88                return flowJob;
89        }
90 
91        public void setRestartable(Boolean restartable) {
92                this.restartable = restartable;
93        }
94 
95        public void setJobRepository(JobRepository jobRepository) {
96                this.jobRepository = jobRepository;
97        }
98 
99        public void setJobParametersValidator(JobParametersValidator jobParametersValidator) {
100                this.jobParametersValidator = jobParametersValidator;
101        }
102 
103        public JobRepository getJobRepository() {
104                return this.jobRepository;
105        }
106 
107        public void setJobExecutionListeners(JobExecutionListener[] jobExecutionListeners) {
108                this.jobExecutionListeners = jobExecutionListeners;
109        }
110 
111        public void setJobParametersIncrementer(JobParametersIncrementer jobParametersIncrementer) {
112                this.jobParametersIncrementer = jobParametersIncrementer;
113        }
114 
115        public void setFlow(Flow flow) {
116                this.flow = flow;
117        }
118 
119        @Override
120        public Class<FlowJob> getObjectType() {
121                return FlowJob.class;
122        }
123 
124        @Override
125        public boolean isSingleton() {
126                return true;
127        }
128 
129        @Override
130        public boolean isEagerInit() {
131                return true;
132        }
133 
134        @Override
135        public boolean isPrototype() {
136                return false;
137        }
138 
139}

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