1 package org.kuali.ole.sys.context;
2
3 import org.apache.commons.lang.StringUtils;
4
5
6
7
8
9
10
11
12
13
14
15 public class BatchStepTriggerParameters {
16
17 private String[] stepNames;
18 private String jobName;
19 private int stepIndex;
20 private long sleepInterval;
21
22 private BatchContainerDirectory batchContainerDirectory;
23
24
25
26
27
28
29
30
31
32
33 protected BatchStepTriggerParameters(String[] args) {
34 if (args.length < 1) {
35 System.err.println("ERROR: You must pass the name of the step to run on the command line.");
36 System.exit(8);
37 } else if (args.length < 2) {
38 System.err.println("ERROR: You must pass the name of the job to run on the command line.");
39 System.exit(8);
40 } else if (args.length < 3) {
41 System.err.println("ERROR: You must pass the index of the step in the job on the command line.");
42 System.exit(8);
43 } else if (args.length < 4) {
44 System.err.println("ERROR: You must pass the path of the directory in which to write and read result files on the command line.");
45 System.exit(8);
46 } else if (args.length < 5) {
47 System.err.println("ERROR: You must pass the amount of time (in seconds) to sleep while waiting for the step to run on the command line.");
48 System.exit(8);
49 }
50
51 if (args[0].indexOf(",") > 0) {
52 stepNames = StringUtils.split(args[0], ",");
53 }
54 else {
55 stepNames = new String[] { args[0] };
56 }
57
58 jobName = args[1];
59 stepIndex = Integer.parseInt(args[2]);
60 String directory = args[3];
61 sleepInterval = Long.parseLong(args[4]) * 1000;
62 batchContainerDirectory = new BatchContainerDirectory(directory);
63 }
64
65
66
67
68 protected String[] getStepNames() {
69 return stepNames;
70 }
71
72
73
74
75 protected String getJobName() {
76 return jobName;
77 }
78
79
80
81
82 protected int getStepIndex() {
83 return stepIndex;
84 }
85
86
87
88
89 protected long getSleepInterval() {
90 return sleepInterval;
91 }
92
93
94
95
96 protected BatchContainerDirectory getBatchContainerDirectory() {
97 return batchContainerDirectory;
98 }
99 }