EMMA Coverage Report (generated Tue May 06 07:29:23 PDT 2008)
[all classes][org.springframework.batch.core.job]

COVERAGE SUMMARY FOR SOURCE FILE [AbstractJob.java]

nameclass, %method, %block, %line, %
AbstractJob.java100% (1/1)73%  (8/11)74%  (59/80)69%  (15.9/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractJob100% (1/1)73%  (8/11)74%  (59/80)69%  (15.9/23)
AbstractJob (String): void 0%   (0/1)0%   (0/14)0%   (0/5)
isRestartable (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
setRestartable (boolean): void 0%   (0/1)0%   (0/4)0%   (0/2)
AbstractJob (): void 100% (1/1)100% (11/11)100% (4/4)
addStep (Step): void 100% (1/1)100% (6/6)100% (2/2)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getSteps (): List 100% (1/1)100% (3/3)100% (1/1)
setBeanName (String): void 100% (1/1)100% (7/7)100% (3/3)
setName (String): void 100% (1/1)100% (4/4)100% (2/2)
setSteps (List): void 100% (1/1)100% (9/9)100% (3/3)
toString (): String 100% (1/1)100% (16/16)100% (1/1)

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.job;
18 
19import java.util.ArrayList;
20import java.util.List;
21 
22import org.springframework.batch.core.Job;
23import org.springframework.batch.core.Step;
24import org.springframework.beans.factory.BeanNameAware;
25import org.springframework.util.ClassUtils;
26 
27/**
28 * Batch domain object representing a job. Job is an explicit abstraction
29 * representing the configuration of a job specified by a developer. It should
30 * be noted that restart policy is applied to the job as a whole and not to a
31 * step.
32 * 
33 * @author Lucas Ward
34 * @author Dave Syer
35 */
36public abstract class AbstractJob implements BeanNameAware, Job {
37 
38        private List steps = new ArrayList();
39 
40        private String name;
41 
42        private boolean restartable = false;
43 
44        /**
45         * Default constructor.
46         */
47        public AbstractJob() {
48                super();
49        }
50 
51        /**
52         * Convenience constructor to immediately add name (which is mandatory but
53         * not final).
54         * 
55         * @param name
56         */
57        public AbstractJob(String name) {
58                super();
59                this.name = name;
60        }
61 
62        /**
63         * Set the name property if it is not already set. Because of the order of
64         * the callbacks in a Spring container the name property will be set first
65         * if it is present. Care is needed with bean definition inheritance - if a
66         * parent bean has a name, then its children need an explicit name as well,
67         * otherwise they will not be unique.
68         * 
69         * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
70         */
71        public void setBeanName(String name) {
72                if (this.name == null) {
73                        this.name = name;
74                }
75        }
76 
77        /**
78         * Set the name property. Always overrides the default value if this object
79         * is a Spring bean.
80         * 
81         * @see #setBeanName(java.lang.String)
82         */
83        public void setName(String name) {
84                this.name = name;
85        }
86 
87        /* (non-Javadoc)
88         * @see org.springframework.batch.core.domain.IJob#getName()
89         */
90        public String getName() {
91                return name;
92        }
93 
94        /* (non-Javadoc)
95         * @see org.springframework.batch.core.domain.IJob#getSteps()
96         */
97        public List getSteps() {
98                return steps;
99        }
100 
101        public void setSteps(List steps) {
102                this.steps.clear();
103                this.steps.addAll(steps);
104        }
105 
106        public void addStep(Step step) {
107                this.steps.add(step);
108        }
109 
110        public void setRestartable(boolean restartable) {
111                this.restartable = restartable;
112        }
113 
114        /* (non-Javadoc)
115         * @see org.springframework.batch.core.domain.IJob#isRestartable()
116         */
117        public boolean isRestartable() {
118                return restartable;
119        }
120 
121        public String toString() {
122                return ClassUtils.getShortName(getClass()) + ": [name=" + name + "]";
123        }
124}

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