EMMA Coverage Report (generated Thu Jan 24 13:37:04 CST 2013)
[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-2009 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        public final Object getObject() throws Exception {
59                Assert.isTrue(StringUtils.hasText(name), "The job must have an id.");
60                FlowJob flowJob = new FlowJob(name);
61 
62                if (restartable != null) {
63                        flowJob.setRestartable(restartable);
64                }
65 
66                if (jobRepository != null) {
67                        flowJob.setJobRepository(jobRepository);
68                }
69 
70                if (jobParametersValidator != null) {
71                        flowJob.setJobParametersValidator(jobParametersValidator);
72                }
73 
74                if (jobExecutionListeners != null) {
75                        flowJob.setJobExecutionListeners(jobExecutionListeners);
76                }
77 
78                if (jobParametersIncrementer != null) {
79                        flowJob.setJobParametersIncrementer(jobParametersIncrementer);
80                }
81 
82                if (flow != null) {
83                        flowJob.setFlow(flow);
84                }
85 
86                flowJob.afterPropertiesSet();
87                return flowJob;
88        }
89 
90        public void setRestartable(Boolean restartable) {
91                this.restartable = restartable;
92        }
93 
94        public void setJobRepository(JobRepository jobRepository) {
95                this.jobRepository = jobRepository;
96        }
97        
98        public void setJobParametersValidator(JobParametersValidator jobParametersValidator) {
99                this.jobParametersValidator = jobParametersValidator;
100        }
101 
102        public JobRepository getJobRepository() {
103                return this.jobRepository;
104        }
105 
106        public void setJobExecutionListeners(JobExecutionListener[] jobExecutionListeners) {
107                this.jobExecutionListeners = jobExecutionListeners;
108        }
109 
110        public void setJobParametersIncrementer(JobParametersIncrementer jobParametersIncrementer) {
111                this.jobParametersIncrementer = jobParametersIncrementer;
112        }
113 
114        public void setFlow(Flow flow) {
115                this.flow = flow;
116        }
117 
118        public Class<FlowJob> getObjectType() {
119                return FlowJob.class;
120        }
121 
122        public boolean isSingleton() {
123                return true;
124        }
125        
126        public boolean isEagerInit() {
127                return true;
128        }
129        
130        public boolean isPrototype() {
131                return false;
132        }
133 
134}

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