1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.batch;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.apache.log4j.Logger;
22 import org.kuali.rice.core.api.datetime.DateTimeService;
23 import org.kuali.rice.coreservice.framework.parameter.ParameterService;
24 import org.springframework.beans.factory.BeanNameAware;
25 import org.springframework.beans.factory.InitializingBean;
26
27 public abstract class AbstractStep extends InitiateDirectoryBase implements Step, BeanNameAware, InitializingBean, InitiateDirectory{
28
29 private static final Logger LOG = Logger.getLogger(AbstractStep.class);
30
31 protected String name;
32 protected ParameterService parameterService;
33 protected DateTimeService dateTimeService;
34 protected BatchInputFileType batchInputFileType = null;
35
36 protected boolean interrupted = false;
37
38
39
40
41
42
43 @Override
44 public void afterPropertiesSet() throws Exception {
45
46 prepareDirectories(getRequiredDirectoryNames());
47 }
48
49
50
51
52
53
54
55
56 @Override
57 public List<String> getRequiredDirectoryNames() {
58 List<String> requiredDirectoryList = new ArrayList<String>();
59 if (batchInputFileType != null){
60 LOG.info(batchInputFileType.getClass().getName() + " ==> " + batchInputFileType.getDirectoryPath());
61 requiredDirectoryList.add(batchInputFileType.getDirectoryPath());
62 }
63 return requiredDirectoryList;
64 }
65
66
67
68
69
70
71
72 @Override
73 public void setBeanName(String name) {
74 this.name = name;
75 }
76
77
78
79
80
81
82 @Override
83 public String getName() {
84 return name;
85 }
86
87 protected ParameterService getParameterService() {
88 return parameterService;
89 }
90
91 public void setParameterService(ParameterService parameterService) {
92 this.parameterService = parameterService;
93 }
94
95
96
97
98
99
100 protected DateTimeService getDateTimeService() {
101 return dateTimeService;
102 }
103
104
105
106
107
108
109 public void setDateTimeService(DateTimeService dateTimeService) {
110 this.dateTimeService = dateTimeService;
111 }
112
113
114
115
116
117
118
119 @Override
120 public boolean isInterrupted() {
121 return interrupted;
122 }
123
124 public BatchInputFileType getBatchInputFileType() {
125 return batchInputFileType;
126 }
127
128 public void setBatchInputFileType(BatchInputFileType batchInputFileType) {
129 this.batchInputFileType = batchInputFileType;
130 }
131
132
133
134
135
136
137
138
139 @Override
140 public void setInterrupted(boolean interrupted) {
141 this.interrupted = interrupted;
142 }
143
144
145
146
147
148
149 @Override
150 public void interrupt() {
151 this.interrupted = true;
152 }
153 }