-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
JobConfiguration.java
118 lines (98 loc) · 2.95 KB
/
JobConfiguration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.configuration;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.BeanNameAware;
/**
* Batch domain object representing a job configuration. JobConfiguration is an
* explicit abstraction representing the configuration of a job specified by a
* developer. It should be noted that restart policy is applied to the job as a
* whole and not to a step.
*
* @author Lucas Ward
* @author Dave Syer
*/
public class JobConfiguration implements BeanNameAware {
private List stepConfigurations = new ArrayList();
private String name;
private boolean restartable = false;
private int startLimit = Integer.MAX_VALUE;
/**
* Default constructor.
*/
public JobConfiguration() {
super();
}
/**
* Convenience constructor to immediately add name (which is mandatory but
* not final).
*
* @param name
*/
public JobConfiguration(String name) {
super();
this.name = name;
}
/**
* Set the name property if it is not already set. Because of the order of
* the callbacks in a Spring container the name property will be set first
* if it is present. Care is needed with bean definition inheritance - if a
* parent bean has a name, then its children need an explicit name as well,
* otherwise they will not be unique.
*
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
*/
public void setBeanName(String name) {
if (this.name==null) {
this.name = name;
}
}
/**
* Set the name property. Always overrides the default value if this object
* is a Spring bean.
*
* @see #setBeanName(java.lang.String)
*/
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public List getStepConfigurations() {
return stepConfigurations;
}
public void setSteps(List stepConfigurations) {
this.stepConfigurations.clear();
this.stepConfigurations.addAll(stepConfigurations);
}
public void addStep(StepConfiguration stepConfiguration) {
this.stepConfigurations.add(stepConfiguration);
}
public int getStartLimit() {
return startLimit;
}
public void setStartLimit(int startLimit) {
this.startLimit = startLimit;
}
public void setRestartable(boolean restartable) {
this.restartable = restartable;
}
public boolean isRestartable() {
return restartable;
}
}