Project

General

Profile

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.utilities.BaseDAO;
34

    
35

    
36
public class ScheduledJobDAO extends BaseDAO {
37
	
38
	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

    
44
	private String _name;
45
	private String _triggerName;
46
	private String _groupName;
47
	private String _className;
48
	private Timestamp _startTime;
49
	private Timestamp _endTime;
50
	private int _intervalValue;
51
	private String _intervalUnit;
52
	private HashMap<String, ScheduledJobParamDAO> _jobParams = new HashMap<String, ScheduledJobParamDAO>();
53
	
54
	// get the name
55
	public String getName() {
56
		return _name;
57
	}
58
	
59
	// set the name
60
	public void setName(String name) {
61
		_name = name;
62
	}
63
	
64
	// get the trigger name
65
	public String getTriggerName() {
66
		return _triggerName;
67
	}
68
	
69
	// set the trigger name
70
	public void setTriggerName(String triggerName) {
71
		_triggerName = triggerName;
72
	}
73
	
74
	// get the group name
75
	public String getGroupName() {
76
		return _groupName;
77
	}
78
	
79
	// set the group name
80
	public void setGroupName(String groupName) {
81
		_groupName = groupName;
82
	}
83
	
84
	// get the class name
85
	public String getClassName() {
86
		return _className;
87
	}
88
	
89
	// set the class name
90
	public void setClassName(String className) {
91
		_className = className;
92
	}
93
	
94
	// get the start time
95
	public Timestamp getStartTime() {
96
		return _startTime;
97
	}
98
	
99
	// set the start time
100
	public void setStartTime(Timestamp startTime) {
101
		_startTime = startTime;
102
	}
103
	
104
	// 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
	// get the interval value
115
	public int getIntervalValue() {
116
		return _intervalValue;
117
	}
118
	
119
	// set the interval value
120
	public void setIntervalValue(int intervalValue) {
121
		_intervalValue = intervalValue;
122
	}
123
	
124
	// get the interval unit
125
	public String getIntervalUnit() {
126
		return _intervalUnit;
127
	}
128
	
129
	// set the interval unit
130
	public void setIntervalUnit(String intervalUnit) {
131
		_intervalUnit = intervalUnit;
132
	}
133
	
134
	// get the job param with the given key
135
	public ScheduledJobParamDAO getJobParam(String key) {
136
		return _jobParams.get(key);
137
	}
138
	
139
	// get all the job params for this job
140
	public HashMap<String, ScheduledJobParamDAO> getAllJobParams() {
141
		return _jobParams;
142
	}
143
	
144
	// add a job param to this job
145
	public void addJobParam(ScheduledJobParamDAO jobParamDAO) {
146
		_jobParams.put(jobParamDAO.getKey(), jobParamDAO);
147
	}
148
}
(4-4/7)