Revision 5012
Added by daigle over 15 years ago
lib/style/skins/sanparks/sanparks-scw.css | ||
---|---|---|
1 |
/* |
|
2 |
* '$RCSfile$' |
|
3 |
* Purpose: Default style sheet for KNB project web pages |
|
4 |
* Using this stylesheet rather than placing styles directly in |
|
5 |
* the KNB web documents allows us to globally change the |
|
6 |
* formatting styles of the entire site in one easy place. |
|
7 |
* Copyright: 2000 Regents of the University of California and the |
|
8 |
* National Center for Ecological Analysis and Synthesis |
|
9 |
* Authors: Matt Jones |
|
10 |
* |
|
11 |
* '$Author: daigle $' |
|
12 |
* '$Date: 2008-07-06 21:25:34 -0700 (Sun, 06 Jul 2008) $' |
|
13 |
* '$Revision: 4080 $' |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or modify |
|
16 |
* it under the terms of the GNU General Public License as published by |
|
17 |
* the Free Software Foundation; either version 2 of the License, or |
|
18 |
* (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
28 |
*/ |
|
29 |
|
|
30 |
/********************************************************************** |
|
31 |
* simple calendar widgit settings. See: |
|
32 |
* style/common/widgits/simple-calendar-widget.js |
|
33 |
* for a full list of possible css settings. |
|
34 |
**********************************************************************/ |
|
35 |
|
|
36 |
table.scw { |
|
37 |
background-color: #124325; |
|
38 |
} |
|
39 |
|
|
40 |
td.scwCells { |
|
41 |
background-color: #7BB865; |
|
42 |
} |
|
43 |
|
|
44 |
td.scwCells:hover,td.scwCellsHover { |
|
45 |
background-color: #ECCE00; |
|
46 |
} |
|
47 |
|
|
48 |
td.scwInputDate { |
|
49 |
background-color: #124325; |
|
50 |
color: #7BB865; |
|
51 |
} |
|
52 |
|
|
53 |
td.scwInputDate:hover,td.scwInputDateHover { |
|
54 |
background-color: #ECCE00; |
|
55 |
color: #000000; |
|
56 |
} |
|
57 |
|
|
58 |
td.scwCellsWeekend { |
|
59 |
background-color: #7BB865; |
|
60 |
color: #000000; |
|
61 |
} |
|
62 |
|
|
63 |
td.scwCellsWeekend:hover,td.scwCellsWeekendHover { |
|
64 |
background-color: #ECCE00; |
|
65 |
} |
|
66 |
|
|
67 |
td.scwCellsExMonth { |
|
68 |
color: #000000; |
|
69 |
} |
|
70 |
|
|
71 |
td.scwCellsExMonth:hover,td.scwCellsExMonthHover { |
|
72 |
background-color: #ECCE00; |
|
73 |
} |
|
74 |
|
|
75 |
td.scwNow { |
|
76 |
background-color: #124325; |
|
77 |
} |
|
78 |
|
|
79 |
td.scwNow:hover { |
|
80 |
color: #ECCE00; |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 | 0 |
lib/style/skins/sanparks/sanparks-scheduled-jobs.css | ||
---|---|---|
50 | 50 |
.content-subsection { |
51 | 51 |
vertical-align: middle; |
52 | 52 |
margin: 0px 0px 0px 195px; |
53 |
width: 750px;
|
|
53 |
width: 800px;
|
|
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
.content-subsection-header { |
... | ... | |
173 | 173 |
* tpc search result specific settings |
174 | 174 |
**********************************************************************/ |
175 | 175 |
|
176 |
.col { |
|
177 |
padding-left: 5px; |
|
178 |
} |
|
179 |
|
|
176 | 180 |
.col1 { |
177 | 181 |
width: 210px; |
178 | 182 |
text-align: left; |
... | ... | |
188 | 192 |
} |
189 | 193 |
|
190 | 194 |
.col4 { |
191 |
width: 80px;
|
|
195 |
width: 60px;
|
|
192 | 196 |
} |
193 | 197 |
|
194 | 198 |
.col5 { |
195 |
width: 80px; |
|
199 |
width: 70px; |
|
200 |
} |
|
201 |
|
|
202 |
.col6 { |
|
203 |
width: 110px; |
|
196 | 204 |
border-right: none; |
197 | 205 |
} |
lib/style/common/scheduledWorkflowResultset.xsl | ||
---|---|---|
42 | 42 |
<div class="col col2">Status</div> |
43 | 43 |
<div class="col col3">Start Time</div> |
44 | 44 |
<div class="col col4">Interval</div> |
45 |
<div class="col col5">Action</div> |
|
45 |
<div class="col col5">Run Count</div> |
|
46 |
<div class="col col6">Action</div> |
|
46 | 47 |
</div> |
47 | 48 |
<!-- div>jobs: <xsl:number value="count(scheduledWorkflowResultset/scheduledJob)" /> </div --> |
48 | 49 |
<!-- This tests to see if there are returned documents, |
... | ... | |
70 | 71 |
<xsl:value-of select='./intervalValue' /><xsl:value-of select='./intervalUnit' /> |
71 | 72 |
</div> |
72 | 73 |
<div class="col col5"> |
74 |
1 of 10 |
|
75 |
</div> |
|
76 |
<div class="col col6"> |
|
73 | 77 |
<a> |
74 | 78 |
<xsl:choose> |
75 | 79 |
<xsl:when test="./status = 'scheduled'"> |
lib/style/common/scheduleWorkflowRunSection.jsp | ||
---|---|---|
91 | 91 |
<div class="field-suffix"><%= TimeZone.getDefault().getDisplayName(true, TimeZone.SHORT) %> (mm/dd/yyyy hh:mm:ss)</div> |
92 | 92 |
</div> |
93 | 93 |
<div class="form-input-row"> |
94 |
<div class="field-label" id='start-time-label' >End Time: </div> |
|
95 |
<input class="date-input" name='endtime' id='endtime' /> |
|
96 |
<div class="field-suffix"><%= TimeZone.getDefault().getDisplayName(true, TimeZone.SHORT) %> (mm/dd/yyyy hh:mm:ss) (optional)</div> |
|
97 |
</div> |
|
98 |
<div class="form-input-row"> |
|
94 | 99 |
<div class="field-label" id='interval-label' >Interval: </div> |
95 | 100 |
<input class="int-input" name='intervalvalue' id='intervalvalue' /> |
96 | 101 |
<select class="dropdown-input" name='intervalunit'> |
src/upgrade-db-to-1.9.2-postgres.sql | ||
---|---|---|
12 | 12 |
group_name VARCHAR(512) NOT NULL, |
13 | 13 |
class_name VARCHAR(1024) NOT NULL, |
14 | 14 |
start_time TIMESTAMP NOT NULL, |
15 |
end_time TIMESTAMP, |
|
15 | 16 |
interval_value INT NOT NULL, |
16 | 17 |
interval_unit VARCHAR(8) NOT NULL, |
17 | 18 |
CONSTRAINT scheduled_job_pk PRIMARY KEY (id), |
src/edu/ucsb/nceas/metacat/workflow/WorkflowJob.java | ||
---|---|---|
39 | 39 |
import org.kepler.executionWS.KeplerWebServiceLocator; |
40 | 40 |
import org.kepler.executionWS.KeplerWebServicePortType; |
41 | 41 |
|
42 |
import edu.ucsb.nceas.metacat.scheduler.ScheduledJobAccess; |
|
43 |
import edu.ucsb.nceas.metacat.scheduler.ScheduledJobDAO; |
|
44 |
import edu.ucsb.nceas.metacat.scheduler.ScheduledJobParamDAO; |
|
45 |
|
|
42 | 46 |
public class WorkflowJob implements InterruptableJob { |
43 | 47 |
|
44 | 48 |
private static Logger logMetacat = Logger.getLogger(WorkflowJob.class); |
... | ... | |
63 | 67 |
throw new JobExecutionException("WorkflowJob.execute - Could not get job data map from job detail"); |
64 | 68 |
} |
65 | 69 |
|
70 |
String jobName = jobDetail.getName(); |
|
71 |
|
|
72 |
ScheduledJobAccess jobAccess = new ScheduledJobAccess(); |
|
73 |
ScheduledJobDAO jobDAO = jobAccess.getJobByName(jobName); |
|
74 |
|
|
75 |
if(jobDAO == null) { |
|
76 |
String errorMessage = "WorkflowJob.execute - Could not retrieve job info from " |
|
77 |
+ "database for job: " + jobName; |
|
78 |
logMetacat.error(errorMessage); |
|
79 |
throw new JobExecutionException(errorMessage); |
|
80 |
} |
|
81 |
|
|
66 | 82 |
// the kar lsid must be part of the job data map |
67 |
String karLSID = jobDataMap.getString("karid"); |
|
83 |
ScheduledJobParamDAO jobParamDAO = jobDAO.getAllJobParams().get("karid"); |
|
84 |
if (jobParamDAO == null) { |
|
85 |
throw new JobExecutionException("WorkflowJob.execute - Could not get job param named karid from " |
|
86 |
+ "job data map for job: " + jobName); |
|
87 |
} |
|
88 |
String karLSID = jobParamDAO.getValue(); |
|
68 | 89 |
if (karLSID == null) { |
69 |
throw new JobExecutionException("WorkflowJob.execute - Could not get kar LSID from job data map");
|
|
90 |
throw new JobExecutionException("WorkflowJob.execute - Could not get kar LSID for job: " + jobName);
|
|
70 | 91 |
} |
71 | 92 |
|
72 | 93 |
// Locate service |
73 |
logMetacat.debug("WorkflowJob.execute - Getting serviceLocator");
|
|
94 |
logMetacat.debug("WorkflowJob.execute - Getting kepler webservice Locator");
|
|
74 | 95 |
KeplerWebServiceLocator serviceLocator = new KeplerWebServiceLocator(); |
75 | 96 |
|
76 | 97 |
// get endpoint service |
77 |
logMetacat.debug("WorkflowJob.execute - Getting service"); |
|
98 |
logMetacat.debug("WorkflowJob.execute - Getting kepler webservice");
|
|
78 | 99 |
KeplerWebServicePortType serviceEndpoint = serviceLocator.getKeplerWebServiceHttpSoap11Endpoint(); |
79 | 100 |
|
80 | 101 |
// call execute against remote endpoint |
81 | 102 |
logMetacat.debug("WorkflowJob.execute - Executing with kar lsid:" + karLSID); |
82 |
String status = serviceEndpoint.execute(karLSID); |
|
83 |
//String status = serviceEndpoint.getStatus(karLSID); |
|
103 |
String status = serviceEndpoint.execute(karLSID); |
|
84 | 104 |
logMetacat.debug("WorkflowJob.execute - Status: " + status); |
85 | 105 |
|
86 | 106 |
} catch (RemoteException re) { |
src/edu/ucsb/nceas/metacat/workflow/WorkflowScheduler.java | ||
---|---|---|
106 | 106 |
|
107 | 107 |
String delays[] = params.get("delay"); |
108 | 108 |
String startTimes[] = params.get("starttime"); |
109 |
String endTimes[] = params.get("endtime"); |
|
109 | 110 |
HashMap<String, String> jobParams = new HashMap<String, String>(); |
110 | 111 |
Calendar startCal = null; |
112 |
Calendar endCal = null; |
|
111 | 113 |
|
112 | 114 |
try { |
113 | 115 |
SchedulerService schedulerService = SchedulerService.getInstance(); |
... | ... | |
121 | 123 |
// if delay and starttime were not provided, set date to now. |
122 | 124 |
startCal = Calendar.getInstance(); |
123 | 125 |
} |
126 |
|
|
127 |
// get end time. null is fine. |
|
128 |
if (endTimes != null && endTimes.length > 0) { |
|
129 |
endCal = DateUtil.humanReadableToCalendar(endTimes[0], "MM/dd/yyyy HH:mm:ss"); |
|
130 |
} |
|
124 | 131 |
|
125 | 132 |
// interval value must exist |
126 | 133 |
String intervalValues[] = params.get("intervalvalue"); |
... | ... | |
139 | 146 |
} |
140 | 147 |
String intervalUnit = intervalUnits[0]; |
141 | 148 |
|
142 |
// workflow id unit must exist. Add to job params
|
|
149 |
// workflow id must exist. Add to job params |
|
143 | 150 |
String workflowids[] = params.get("workflowid"); |
144 | 151 |
if (workflowids == null || workflowids.length == 0) { |
145 | 152 |
throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - workflowid field must be populated " |
... | ... | |
168 | 175 |
+ Calendar.getInstance().getTimeInMillis(); |
169 | 176 |
|
170 | 177 |
// Schedule the job |
171 |
String xmlResult = schedulerService.scheduleJob(jobName, startCal, intervalValue, intervalUnit, |
|
178 |
String xmlResult = schedulerService.scheduleJob(jobName, startCal, endCal, intervalValue, intervalUnit,
|
|
172 | 179 |
WORKFLOW_JOB_CLASS, WORKFLOW_JOB_GROUP, jobParams, username, groups); |
173 | 180 |
|
174 | 181 |
// if there is a forwardto param on the request, then send the user to the page |
src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobDAO.java | ||
---|---|---|
45 | 45 |
private String _groupName; |
46 | 46 |
private String _className; |
47 | 47 |
private Timestamp _startTime; |
48 |
private Timestamp _endTime; |
|
48 | 49 |
private int _intervalValue; |
49 | 50 |
private String _intervalUnit; |
50 | 51 |
private HashMap<String, ScheduledJobParamDAO> _jobParams = new HashMap<String, ScheduledJobParamDAO>(); |
... | ... | |
99 | 100 |
_startTime = startTime; |
100 | 101 |
} |
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 |
|
|
102 | 113 |
// get the interval value |
103 | 114 |
public int getIntervalValue() { |
104 | 115 |
return _intervalValue; |
src/edu/ucsb/nceas/metacat/scheduler/SchedulerService.java | ||
---|---|---|
150 | 150 |
Calendar startTimeCal = Calendar.getInstance(); |
151 | 151 |
startTimeCal.setTime(jobDAO.getStartTime()); |
152 | 152 |
|
153 |
// convert the start time to a calendar object |
|
154 |
Calendar endTimeCal = Calendar.getInstance(); |
|
155 |
endTimeCal.setTime(jobDAO.getEndTime()); |
|
156 |
|
|
153 | 157 |
// extract the job parameters from their data objects and put into a string map |
154 | 158 |
HashMap<String, String> jobParams = new HashMap<String, String>(); |
155 | 159 |
HashMap<String, ScheduledJobParamDAO> jobParamDAOs = jobDAO.getAllJobParams(); |
... | ... | |
158 | 162 |
} |
159 | 163 |
|
160 | 164 |
// schedule the job |
161 |
return scheduleJob(jobDAO.getName(), startTimeCal, jobDAO.getIntervalValue(), jobDAO.getIntervalUnit(), |
|
162 |
jobDAO.getClassName(), jobDAO.getGroupName(), jobParams, username, groups); |
|
165 |
return scheduleJob(jobDAO.getName(), startTimeCal, endTimeCal, jobDAO.getIntervalValue(), |
|
166 |
jobDAO.getIntervalUnit(), jobDAO.getClassName(), jobDAO.getGroupName(), |
|
167 |
jobParams, username, groups); |
|
163 | 168 |
} |
164 | 169 |
|
165 | 170 |
/** |
... | ... | |
185 | 190 |
* the user's group name |
186 | 191 |
* @return a message saying that the job was scheduled |
187 | 192 |
*/ |
188 |
public String scheduleJob(String jobName, Calendar startCal, int intervalValue, String intervalUnit,
|
|
189 |
String jobClassName, String jobGroup, HashMap<String, String> jobParams, |
|
193 |
public String scheduleJob(String jobName, Calendar startCal, Calendar endCal, int intervalValue,
|
|
194 |
String intervalUnit, String jobClassName, String jobGroup, HashMap<String, String> jobParams,
|
|
190 | 195 |
String username, String[] groups) throws ServiceException { |
191 | 196 |
|
192 | 197 |
Class<Job> jobClass = null; |
... | ... | |
200 | 205 |
+ ", interval unit: " + intervalUnit); |
201 | 206 |
|
202 | 207 |
// start the job in the job scheduler |
203 |
startJob(jobName, startCal, intervalValue, intervalUnit, jobClass, jobGroup, |
|
208 |
startJob(jobName, startCal, endCal, intervalValue, intervalUnit, jobClass, jobGroup,
|
|
204 | 209 |
jobParams); |
205 | 210 |
|
206 | 211 |
// get a database access object and create the job in the database |
207 | 212 |
|
208 | 213 |
ScheduledJobAccess jobAccess = new ScheduledJobAccess(); |
209 |
jobAccess.createJob(jobName, jobName, jobGroup, jobClass, startCal, |
|
214 |
jobAccess.createJob(jobName, jobName, jobGroup, jobClass, startCal, endCal,
|
|
210 | 215 |
intervalValue, intervalUnit, jobParams); |
211 | 216 |
} catch (AccessException ae) { |
212 | 217 |
try { |
... | ... | |
316 | 321 |
Calendar startCal = Calendar.getInstance(); |
317 | 322 |
startCal.setTime(jobDAO.getStartTime()); |
318 | 323 |
|
324 |
Calendar endCal = Calendar.getInstance(); |
|
325 |
endCal.setTime(jobDAO.getEndTime()); |
|
326 |
|
|
319 | 327 |
HashMap<String, String> jobParams = new HashMap<String, String>(); |
320 | 328 |
HashMap<String, ScheduledJobParamDAO> jobParamDAOs = jobDAO.getAllJobParams(); |
321 | 329 |
for (String paramName : jobParamDAOs.keySet()) { |
... | ... | |
337 | 345 |
+ ", interval unit: " + jobDAO.getIntervalUnit()); |
338 | 346 |
|
339 | 347 |
// start the job in the scheduler |
340 |
startJob(jobDAO.getName(), startCal, jobDAO.getIntervalValue(), jobDAO.getIntervalUnit(), jobClass, jobDAO.getGroupName(), jobParams); |
|
348 |
startJob(jobDAO.getName(), startCal, endCal, jobDAO.getIntervalValue(), jobDAO.getIntervalUnit(), jobClass, jobDAO.getGroupName(), jobParams);
|
|
341 | 349 |
|
342 | 350 |
// update the status in the database |
343 | 351 |
jobDAO.setStatus(StatusUtil.SCHEDULED); |
... | ... | |
532 | 540 |
* @param groups |
533 | 541 |
* the user's group name |
534 | 542 |
*/ |
535 |
private void startJob(String jobName, Calendar startCal, int intervalValue, String intervalUnit, |
|
543 |
private void startJob(String jobName, Calendar startCal, Calendar endCal, int intervalValue, String intervalUnit,
|
|
536 | 544 |
Class<Job> jobClass, String jobGroup, HashMap<String, String> jobParams) throws ServiceException { |
537 | 545 |
|
538 | 546 |
JobDetail jobDetail = new JobDetail(jobName, jobGroup, jobClass); |
... | ... | |
544 | 552 |
switch (intervalChar) { |
545 | 553 |
case 's': |
546 | 554 |
case 'S': |
547 |
scheduleSecondlyJob(jobName, jobClass, startCal, intervalValue, jobGroup, jobDetail); |
|
555 |
scheduleSecondlyJob(jobName, jobClass, startCal, endCal, intervalValue, jobGroup, jobDetail);
|
|
548 | 556 |
break; |
549 | 557 |
case 'm': |
550 | 558 |
case 'M': |
551 |
scheduleMinutelyJob(jobName, jobClass, startCal, intervalValue, jobGroup, jobDetail); |
|
559 |
scheduleMinutelyJob(jobName, jobClass, startCal, endCal, intervalValue, jobGroup, jobDetail);
|
|
552 | 560 |
break; |
553 | 561 |
case 'h': |
554 | 562 |
case 'H': |
555 |
scheduleHourlyJob(jobName, jobClass, startCal, intervalValue, jobGroup, jobDetail); |
|
563 |
scheduleHourlyJob(jobName, jobClass, startCal, endCal, intervalValue, jobGroup, jobDetail);
|
|
556 | 564 |
break; |
557 | 565 |
case 'd': |
558 | 566 |
case 'D': |
559 |
scheduleDailyJob(jobName, jobClass, startCal, intervalValue, jobGroup, jobDetail); |
|
567 |
scheduleDailyJob(jobName, jobClass, startCal, endCal, intervalValue, jobGroup, jobDetail);
|
|
560 | 568 |
break; |
561 | 569 |
default: |
562 | 570 |
throw new ServiceException("SchedulerService.scheduleJob - Could not interpret interval unit: " |
... | ... | |
580 | 588 |
* @param jobDetail |
581 | 589 |
* the job detail object |
582 | 590 |
*/ |
583 |
private void scheduleSecondlyJob(String jobName, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException { |
|
591 |
private void scheduleSecondlyJob(String jobName, Class<Job> jobClass, Calendar startTime, Calendar endTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException {
|
|
584 | 592 |
|
585 | 593 |
Trigger trigger = TriggerUtils.makeSecondlyTrigger(interval); |
586 | 594 |
trigger.setName(jobName); |
587 | 595 |
trigger.setStartTime(startTime.getTime()); |
596 |
if (endTime != null) { |
|
597 |
trigger.setEndTime(endTime.getTime()); |
|
598 |
} |
|
588 | 599 |
|
589 | 600 |
try { |
590 | 601 |
sched.scheduleJob(jobDetail, trigger); |
... | ... | |
610 | 621 |
* @param jobDetail |
611 | 622 |
* the job detail object |
612 | 623 |
*/ |
613 |
private void scheduleMinutelyJob(String jobName, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException { |
|
624 |
private void scheduleMinutelyJob(String jobName, Class<Job> jobClass, Calendar startTime, Calendar endTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException {
|
|
614 | 625 |
|
615 | 626 |
Trigger trigger = TriggerUtils.makeMinutelyTrigger(interval); |
616 | 627 |
trigger.setName(jobName); |
617 | 628 |
trigger.setStartTime(startTime.getTime()); |
629 |
if (endTime != null) { |
|
630 |
trigger.setEndTime(endTime.getTime()); |
|
631 |
} |
|
618 | 632 |
|
619 | 633 |
try { |
620 | 634 |
sched.scheduleJob(jobDetail, trigger); |
... | ... | |
640 | 654 |
* @param jobDetail |
641 | 655 |
* the job detail object |
642 | 656 |
*/ |
643 |
private void scheduleHourlyJob(String jobName, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException { |
|
657 |
private void scheduleHourlyJob(String jobName, Class<Job> jobClass, Calendar startTime, Calendar endTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException {
|
|
644 | 658 |
|
645 | 659 |
Trigger trigger = TriggerUtils.makeHourlyTrigger(interval); |
646 | 660 |
trigger.setName(jobName); |
647 | 661 |
trigger.setStartTime(startTime.getTime()); |
662 |
if (endTime != null) { |
|
663 |
trigger.setEndTime(endTime.getTime()); |
|
664 |
} |
|
648 | 665 |
|
649 | 666 |
try { |
650 | 667 |
sched.scheduleJob(jobDetail, trigger); |
... | ... | |
670 | 687 |
* @param jobDetail |
671 | 688 |
* the job detail object |
672 | 689 |
*/ |
673 |
private void scheduleDailyJob(String jobName, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException { |
|
690 |
private void scheduleDailyJob(String jobName, Class<Job> jobClass, Calendar startTime, Calendar endTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException {
|
|
674 | 691 |
|
675 | 692 |
Trigger trigger = TriggerUtils.makeHourlyTrigger(interval * 24); |
676 | 693 |
trigger.setName(jobName); |
677 | 694 |
trigger.setStartTime(startTime.getTime()); |
695 |
if (endTime != null) { |
|
696 |
trigger.setEndTime(endTime.getTime()); |
|
697 |
} |
|
678 | 698 |
|
679 | 699 |
try { |
680 | 700 |
sched.scheduleJob(jobDetail, trigger); |
src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobAccess.java | ||
---|---|---|
214 | 214 |
} |
215 | 215 |
pstmt = conn.prepareStatement(sql); |
216 | 216 |
|
217 |
logMetacat.info("SQL getAllJobs - " + sql);
|
|
217 |
String sqlReport = "ScheduledJobAccess.getAllJobs - SQL: " + sql;
|
|
218 | 218 |
if (groupName != null) { |
219 | 219 |
pstmt.setString(1, groupName); |
220 | 220 |
|
221 |
logMetacat.info("SQL params: [" + groupName + "]");
|
|
221 |
sqlReport += " [" + groupName + "]";
|
|
222 | 222 |
} |
223 |
|
|
224 |
logMetacat.info(sqlReport); |
|
223 | 225 |
|
224 | 226 |
pstmt.execute(); |
225 | 227 |
|
... | ... | |
287 | 289 |
* a map of parameters that are associated with this job. |
288 | 290 |
*/ |
289 | 291 |
public void createJob(String name, String triggerName, String groupName, |
290 |
Class<Job> jobClass, Calendar startTime, int intervalValue, |
|
292 |
Class<Job> jobClass, Calendar startTime, Calendar endTime, int intervalValue,
|
|
291 | 293 |
String intervalUnit, HashMap<String, String> jobParams) |
292 | 294 |
throws AccessException { |
293 | 295 |
|
... | ... | |
299 | 301 |
jobDAO.setGroupName(groupName); |
300 | 302 |
jobDAO.setClassName(jobClass.getName()); |
301 | 303 |
jobDAO.setStartTime(new Timestamp(startTime.getTimeInMillis())); |
304 |
jobDAO.setEndTime(new Timestamp(endTime.getTimeInMillis())); |
|
302 | 305 |
jobDAO.setIntervalValue(intervalValue); |
303 | 306 |
jobDAO.setIntervalUnit(intervalUnit); |
304 | 307 |
|
... | ... | |
316 | 319 |
// First insert the job |
317 | 320 |
try { |
318 | 321 |
String sql = |
319 |
"INSERT INTO scheduled_job (date_created, date_updated, status, name, trigger_name, group_name, class_name, start_time, interval_value, interval_unit) " |
|
320 |
+ "VALUES(now(), now(), ?, ?, ?, ?, ?, ?, ?, ?)"; |
|
322 |
"INSERT INTO scheduled_job (date_created, date_updated, status, name, trigger_name, group_name, class_name, start_time, end_time, interval_value, interval_unit) "
|
|
323 |
+ "VALUES(now(), now(), ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
321 | 324 |
pstmt = conn.prepareStatement(sql); |
322 | 325 |
|
323 | 326 |
pstmt.setString(1, jobDAO.getStatus()); |
... | ... | |
326 | 329 |
pstmt.setString(4, jobDAO.getGroupName()); |
327 | 330 |
pstmt.setString(5, jobDAO.getClassName()); |
328 | 331 |
pstmt.setTimestamp(6, jobDAO.getStartTime()); |
329 |
pstmt.setInt(7, jobDAO.getIntervalValue()); |
|
330 |
pstmt.setString(8, jobDAO.getIntervalUnit()); |
|
332 |
pstmt.setTimestamp(7, jobDAO.getEndTime()); |
|
333 |
pstmt.setInt(8, jobDAO.getIntervalValue()); |
|
334 |
pstmt.setString(9, jobDAO.getIntervalUnit()); |
|
331 | 335 |
|
332 |
logMetacat.info("SQL createJob - " + sql); |
|
333 |
logMetacat.info("SQL params: [" + jobDAO.getStatus() + "," |
|
334 |
+ jobDAO.getName() + "," |
|
335 |
+ jobDAO.getTriggerName() + "," |
|
336 |
+ jobDAO.getGroupName() + "," |
|
337 |
+ jobDAO.getClassName() + ",(Timestamp)" |
|
338 |
+ jobDAO.getStartTime().toString() + "," |
|
339 |
+ jobDAO.getIntervalValue() + "," |
|
340 |
+ jobDAO.getIntervalUnit() + "]"); |
|
336 |
String sqlReport = "ScheduledJobAccess.createJob - SQL: " + sql |
|
337 |
+ " [" + jobDAO.getStatus() + "," |
|
338 |
+ jobDAO.getName() + "," |
|
339 |
+ jobDAO.getTriggerName() + "," |
|
340 |
+ jobDAO.getGroupName() + "," |
|
341 |
+ jobDAO.getClassName() + ",(Timestamp)" |
|
342 |
+ jobDAO.getStartTime().toString() + ","; |
|
343 |
if(jobDAO.getEndTime() == null) { |
|
344 |
sqlReport += "null,"; |
|
345 |
} else { |
|
346 |
sqlReport += jobDAO.getEndTime().toString() + ","; |
|
347 |
} |
|
348 |
sqlReport += jobDAO.getIntervalValue() + "," |
|
349 |
+ jobDAO.getIntervalUnit() + "]"; |
|
350 |
logMetacat.info(sqlReport); |
|
351 |
|
|
341 | 352 |
pstmt.execute(); |
342 | 353 |
|
343 | 354 |
} catch (SQLException sqle) { |
... | ... | |
399 | 410 |
pstmt.setString(1, jobDAO.getStatus()); |
400 | 411 |
pstmt.setLong(2, jobDAO.getId()); |
401 | 412 |
|
402 |
logMetacat.info("ScheduledJobAccess.deleteJob - " + sql); |
|
403 |
|
|
404 |
logMetacat.info("SQL params: [" + jobDAO.getStatus() + "," |
|
405 |
+ jobDAO.getId() + "]"); |
|
413 |
String sqlReport = "ScheduledJobAccess.deleteJob - SQL: " + sql |
|
414 |
+ " [" + jobDAO.getStatus() + "," + jobDAO.getId() + "]"; |
|
415 |
logMetacat.info(sqlReport); |
|
406 | 416 |
|
407 | 417 |
pstmt.execute(); |
408 | 418 |
} catch (SQLException sqle) { |
... | ... | |
442 | 452 |
jobDAO.setGroupName(resultSet.getString("group_name")); |
443 | 453 |
jobDAO.setClassName(resultSet.getString("class_name")); |
444 | 454 |
jobDAO.setStartTime(resultSet.getTimestamp("start_time")); |
455 |
jobDAO.setEndTime(resultSet.getTimestamp("end_time")); |
|
445 | 456 |
jobDAO.setIntervalValue(resultSet.getInt("interval_value")); |
446 | 457 |
jobDAO.setIntervalUnit(resultSet.getString("interval_unit")); |
447 | 458 |
|
Also available in: Unified diff
Added end time to workflow scheduler.