EMMA Coverage Report (generated Fri Aug 21 15:59:46 BST 2009)
[all classes][org.springframework.batch.core.configuration.xml]

COVERAGE SUMMARY FOR SOURCE FILE [JobParserJobFactoryBean.java]

nameclass, %method, %block, %line, %
JobParserJobFactoryBean.java100% (1/1)83%  (10/12)88%  (77/88)88%  (28/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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