1 |
4951
|
daigle
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
4971
|
daigle
|
* Purpose: A Class that holds the data from the scheduled_job
|
4 |
4951
|
daigle
|
* 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 |
4959
|
daigle
|
import java.util.HashMap;
|
32 |
4951
|
daigle
|
|
33 |
7475
|
leinfelder
|
import edu.ucsb.nceas.utilities.BaseDAO;
|
34 |
4951
|
daigle
|
|
35 |
7475
|
leinfelder
|
|
36 |
4951
|
daigle
|
public class ScheduledJobDAO extends BaseDAO {
|
37 |
|
|
|
38 |
4971
|
daigle
|
public static String SECONDLY = "s";
|
39 |
|
|
public static String MINUTELY = "m";
|
40 |
|
|
public static String HOURLY = "h";
|
41 |
|
|
public static String DAILY = "d";
|
42 |
|
|
public static String WEEKLY = "w";
|
43 |
4951
|
daigle
|
|
44 |
|
|
private String _name;
|
45 |
|
|
private String _triggerName;
|
46 |
|
|
private String _groupName;
|
47 |
|
|
private String _className;
|
48 |
|
|
private Timestamp _startTime;
|
49 |
5012
|
daigle
|
private Timestamp _endTime;
|
50 |
4959
|
daigle
|
private int _intervalValue;
|
51 |
|
|
private String _intervalUnit;
|
52 |
|
|
private HashMap<String, ScheduledJobParamDAO> _jobParams = new HashMap<String, ScheduledJobParamDAO>();
|
53 |
4951
|
daigle
|
|
54 |
4971
|
daigle
|
// get the name
|
55 |
4951
|
daigle
|
public String getName() {
|
56 |
|
|
return _name;
|
57 |
|
|
}
|
58 |
|
|
|
59 |
4971
|
daigle
|
// set the name
|
60 |
4951
|
daigle
|
public void setName(String name) {
|
61 |
|
|
_name = name;
|
62 |
|
|
}
|
63 |
|
|
|
64 |
4971
|
daigle
|
// get the trigger name
|
65 |
4951
|
daigle
|
public String getTriggerName() {
|
66 |
|
|
return _triggerName;
|
67 |
|
|
}
|
68 |
|
|
|
69 |
4971
|
daigle
|
// set the trigger name
|
70 |
4951
|
daigle
|
public void setTriggerName(String triggerName) {
|
71 |
|
|
_triggerName = triggerName;
|
72 |
|
|
}
|
73 |
|
|
|
74 |
4971
|
daigle
|
// get the group name
|
75 |
4951
|
daigle
|
public String getGroupName() {
|
76 |
|
|
return _groupName;
|
77 |
|
|
}
|
78 |
|
|
|
79 |
4971
|
daigle
|
// set the group name
|
80 |
4951
|
daigle
|
public void setGroupName(String groupName) {
|
81 |
|
|
_groupName = groupName;
|
82 |
|
|
}
|
83 |
|
|
|
84 |
4971
|
daigle
|
// get the class name
|
85 |
4951
|
daigle
|
public String getClassName() {
|
86 |
|
|
return _className;
|
87 |
|
|
}
|
88 |
|
|
|
89 |
4971
|
daigle
|
// set the class name
|
90 |
4951
|
daigle
|
public void setClassName(String className) {
|
91 |
|
|
_className = className;
|
92 |
|
|
}
|
93 |
|
|
|
94 |
4971
|
daigle
|
// get the start time
|
95 |
4951
|
daigle
|
public Timestamp getStartTime() {
|
96 |
|
|
return _startTime;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
4971
|
daigle
|
// set the start time
|
100 |
4951
|
daigle
|
public void setStartTime(Timestamp startTime) {
|
101 |
|
|
_startTime = startTime;
|
102 |
|
|
}
|
103 |
|
|
|
104 |
5012
|
daigle
|
// get the end time
|
105 |
|
|
public Timestamp getEndTime() {
|
106 |
|
|
return _endTime;
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
// set the end time
|
110 |
|
|
public void setEndTime(Timestamp endTime) {
|
111 |
|
|
_endTime = endTime;
|
112 |
|
|
}
|
113 |
|
|
|
114 |
4971
|
daigle
|
// get the interval value
|
115 |
4959
|
daigle
|
public int getIntervalValue() {
|
116 |
|
|
return _intervalValue;
|
117 |
4951
|
daigle
|
}
|
118 |
|
|
|
119 |
4971
|
daigle
|
// set the interval value
|
120 |
4959
|
daigle
|
public void setIntervalValue(int intervalValue) {
|
121 |
|
|
_intervalValue = intervalValue;
|
122 |
4951
|
daigle
|
}
|
123 |
4959
|
daigle
|
|
124 |
4971
|
daigle
|
// get the interval unit
|
125 |
4959
|
daigle
|
public String getIntervalUnit() {
|
126 |
|
|
return _intervalUnit;
|
127 |
|
|
}
|
128 |
|
|
|
129 |
4971
|
daigle
|
// set the interval unit
|
130 |
4959
|
daigle
|
public void setIntervalUnit(String intervalUnit) {
|
131 |
|
|
_intervalUnit = intervalUnit;
|
132 |
|
|
}
|
133 |
|
|
|
134 |
4971
|
daigle
|
// get the job param with the given key
|
135 |
4959
|
daigle
|
public ScheduledJobParamDAO getJobParam(String key) {
|
136 |
|
|
return _jobParams.get(key);
|
137 |
|
|
}
|
138 |
|
|
|
139 |
4971
|
daigle
|
// get all the job params for this job
|
140 |
4959
|
daigle
|
public HashMap<String, ScheduledJobParamDAO> getAllJobParams() {
|
141 |
|
|
return _jobParams;
|
142 |
|
|
}
|
143 |
|
|
|
144 |
4971
|
daigle
|
// add a job param to this job
|
145 |
4959
|
daigle
|
public void addJobParam(ScheduledJobParamDAO jobParamDAO) {
|
146 |
|
|
_jobParams.put(jobParamDAO.getKey(), jobParamDAO);
|
147 |
|
|
}
|
148 |
4951
|
daigle
|
}
|