1
|
/**
|
2
|
* '$RCSfile$'
|
3
|
* Purpose: A Class that holds the data from the scheduled_job
|
4
|
* table in the database.
|
5
|
* Copyright: 2009 Regents of the University of California and the
|
6
|
* National Center for Ecological Analysis and Synthesis
|
7
|
* Authors: Michael Daigle
|
8
|
*
|
9
|
* '$Author: daigle $'
|
10
|
* '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
|
11
|
* '$Revision: 4854 $'
|
12
|
*
|
13
|
* This program is free software; you can redistribute it and/or modify
|
14
|
* it under the terms of the GNU General Public License as published by
|
15
|
* the Free Software Foundation; either version 2 of the License, or
|
16
|
* (at your option) any later version.
|
17
|
*
|
18
|
* This program is distributed in the hope that it will be useful,
|
19
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21
|
* GNU General Public License for more details.
|
22
|
*
|
23
|
* You should have received a copy of the GNU General Public License
|
24
|
* along with this program; if not, write to the Free Software
|
25
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
26
|
*/
|
27
|
|
28
|
package edu.ucsb.nceas.metacat.scheduler;
|
29
|
|
30
|
import java.sql.Timestamp;
|
31
|
import java.util.HashMap;
|
32
|
|
33
|
import edu.ucsb.nceas.metacat.shared.BaseDAO;
|
34
|
|
35
|
public class ScheduledJobDAO extends BaseDAO {
|
36
|
|
37
|
public static String SECONDLY = "s";
|
38
|
public static String MINUTELY = "m";
|
39
|
public static String HOURLY = "h";
|
40
|
public static String DAILY = "d";
|
41
|
public static String WEEKLY = "w";
|
42
|
|
43
|
private String _name;
|
44
|
private String _triggerName;
|
45
|
private String _groupName;
|
46
|
private String _className;
|
47
|
private Timestamp _startTime;
|
48
|
private Timestamp _endTime;
|
49
|
private int _intervalValue;
|
50
|
private String _intervalUnit;
|
51
|
private HashMap<String, ScheduledJobParamDAO> _jobParams = new HashMap<String, ScheduledJobParamDAO>();
|
52
|
|
53
|
// get the name
|
54
|
public String getName() {
|
55
|
return _name;
|
56
|
}
|
57
|
|
58
|
// set the name
|
59
|
public void setName(String name) {
|
60
|
_name = name;
|
61
|
}
|
62
|
|
63
|
// get the trigger name
|
64
|
public String getTriggerName() {
|
65
|
return _triggerName;
|
66
|
}
|
67
|
|
68
|
// set the trigger name
|
69
|
public void setTriggerName(String triggerName) {
|
70
|
_triggerName = triggerName;
|
71
|
}
|
72
|
|
73
|
// get the group name
|
74
|
public String getGroupName() {
|
75
|
return _groupName;
|
76
|
}
|
77
|
|
78
|
// set the group name
|
79
|
public void setGroupName(String groupName) {
|
80
|
_groupName = groupName;
|
81
|
}
|
82
|
|
83
|
// get the class name
|
84
|
public String getClassName() {
|
85
|
return _className;
|
86
|
}
|
87
|
|
88
|
// set the class name
|
89
|
public void setClassName(String className) {
|
90
|
_className = className;
|
91
|
}
|
92
|
|
93
|
// get the start time
|
94
|
public Timestamp getStartTime() {
|
95
|
return _startTime;
|
96
|
}
|
97
|
|
98
|
// set the start time
|
99
|
public void setStartTime(Timestamp startTime) {
|
100
|
_startTime = startTime;
|
101
|
}
|
102
|
|
103
|
// get the end time
|
104
|
public Timestamp getEndTime() {
|
105
|
return _endTime;
|
106
|
}
|
107
|
|
108
|
// set the end time
|
109
|
public void setEndTime(Timestamp endTime) {
|
110
|
_endTime = endTime;
|
111
|
}
|
112
|
|
113
|
// get the interval value
|
114
|
public int getIntervalValue() {
|
115
|
return _intervalValue;
|
116
|
}
|
117
|
|
118
|
// set the interval value
|
119
|
public void setIntervalValue(int intervalValue) {
|
120
|
_intervalValue = intervalValue;
|
121
|
}
|
122
|
|
123
|
// get the interval unit
|
124
|
public String getIntervalUnit() {
|
125
|
return _intervalUnit;
|
126
|
}
|
127
|
|
128
|
// set the interval unit
|
129
|
public void setIntervalUnit(String intervalUnit) {
|
130
|
_intervalUnit = intervalUnit;
|
131
|
}
|
132
|
|
133
|
// get the job param with the given key
|
134
|
public ScheduledJobParamDAO getJobParam(String key) {
|
135
|
return _jobParams.get(key);
|
136
|
}
|
137
|
|
138
|
// get all the job params for this job
|
139
|
public HashMap<String, ScheduledJobParamDAO> getAllJobParams() {
|
140
|
return _jobParams;
|
141
|
}
|
142
|
|
143
|
// add a job param to this job
|
144
|
public void addJobParam(ScheduledJobParamDAO jobParamDAO) {
|
145
|
_jobParams.put(jobParamDAO.getKey(), jobParamDAO);
|
146
|
}
|
147
|
}
|