Revision 5078
Added by daigle about 15 years ago
src/edu/ucsb/nceas/metacat/workflow/WorkflowSchedulerClient.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
import javax.servlet.http.HttpServletRequest; |
35 | 35 |
import javax.servlet.http.HttpServletResponse; |
36 |
import javax.servlet.ServletException; |
|
37 | 36 |
|
38 | 37 |
import org.apache.log4j.Logger; |
39 | 38 |
|
... | ... | |
93 | 92 |
String[] groups) throws MetacatSchedulerException { |
94 | 93 |
|
95 | 94 |
try { |
95 |
logMetacat.debug("WorkflowSchedulerClient.scheduleJob"); |
|
96 | 96 |
params.put("action", new String[] { "scheduleWorkflow" }); |
97 | 97 |
params.put("sessionid", new String[] { RequestUtil.getSessionData(request).getId() }); |
98 | 98 |
|
... | ... | |
124 | 124 |
+ "property error when scheduling job: " + pnfe.getMessage()); |
125 | 125 |
} catch (MetacatUtilException mue) { |
126 | 126 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.scheduleJob - " |
127 |
+ "Service issue when scheduling job: " + mue.getMessage()); |
|
128 |
} catch (IOException ioe) { |
|
129 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.scheduleJob - " |
|
130 |
+ "I/O issue when scheduling job: " + ioe.getMessage()); |
|
131 |
} catch (ServletException se) { |
|
132 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.scheduleJob - " |
|
133 |
+ "Servlet issue when scheduling job: " + se.getMessage()); |
|
127 |
+ "utility issue when scheduling job: " + mue.getMessage()); |
|
134 | 128 |
} catch (ErrorSendingErrorException esee) { |
135 | 129 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.scheduleJob - " |
136 | 130 |
+ "Issue sending error when scheduling job: " + esee.getMessage()); |
... | ... | |
155 | 149 |
Hashtable<String, String[]> params, String username, |
156 | 150 |
String[] groups) throws MetacatSchedulerException { |
157 | 151 |
try { |
152 |
logMetacat.debug("WorkflowSchedulerClient.unScheduleJob"); |
|
153 |
|
|
158 | 154 |
params.put("action", new String[] { "unscheduleWorkflow" }); |
159 | 155 |
params.put("sessionid", new String[] { RequestUtil.getSessionData(request).getId() }); |
160 | 156 |
|
... | ... | |
186 | 182 |
+ "property error when unscheduling job: " + pnfe.getMessage()); |
187 | 183 |
} catch (MetacatUtilException mue) { |
188 | 184 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.unScheduleJob - " |
189 |
+ "Service issue when unscheduling job: " + mue.getMessage()); |
|
190 |
} catch (IOException ioe) { |
|
191 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.unScheduleJob - " |
|
192 |
+ "I/O issue when unscheduling job: " + ioe.getMessage()); |
|
193 |
} catch (ServletException se) { |
|
194 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.unScheduleJob - " |
|
195 |
+ "Servlet issue when unscheduling job: " + se.getMessage()); |
|
185 |
+ "utility issue when unscheduling job: " + mue.getMessage()); |
|
196 | 186 |
} catch (ErrorSendingErrorException esee) { |
197 | 187 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.unScheduleJob - " |
198 | 188 |
+ "Issue sending error when unscheduling job: " + esee.getMessage()); |
... | ... | |
213 | 203 |
* @param groups |
214 | 204 |
* the user's group |
215 | 205 |
*/ |
206 |
@SuppressWarnings("unchecked") |
|
216 | 207 |
public void reScheduleJob(HttpServletRequest request, HttpServletResponse response, |
217 | 208 |
Hashtable<String, String[]> params, String username, |
218 | 209 |
String[] groups) throws MetacatSchedulerException { |
219 | 210 |
|
220 | 211 |
try { |
212 |
logMetacat.debug("WorkflowSchedulerClient.reScheduleJob"); |
|
213 |
|
|
221 | 214 |
params.put("action", new String[] { "rescheduleWorkflow" }); |
222 | 215 |
params.put("sessionid", new String[] { RequestUtil.getSessionData(request).getId() }); |
223 | 216 |
|
... | ... | |
228 | 221 |
|
229 | 222 |
if (forwardTos == null || forwardTos.length == 0) { |
230 | 223 |
ResponseUtil.sendSuccessXML(response, result); |
231 |
} else { |
|
232 |
String forwardTo = forwardTos[0]; |
|
233 |
String qformat = null; |
|
234 |
|
|
235 |
String qformats[] = params.get("qformat"); |
|
236 |
if (qformats == null || qformats.length == 0) { |
|
237 |
qformat = MetacatUtil.XMLFORMAT; |
|
238 |
} else { |
|
239 |
qformat = qformats[0]; |
|
240 |
} |
|
241 |
|
|
242 |
String destination = "/style/skins/" + qformat + "/" + forwardTo; |
|
243 |
|
|
244 |
RequestUtil.forwardRequest(request, response, destination, params); |
|
224 |
} else { |
|
225 |
RequestUtil.forwardRequest(request, response, params); |
|
245 | 226 |
} |
246 | 227 |
|
247 | 228 |
} catch (PropertyNotFoundException pnfe) { |
... | ... | |
249 | 230 |
+ "property error when rescheduling job: " + pnfe.getMessage()); |
250 | 231 |
} catch (MetacatUtilException mue) { |
251 | 232 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.reScheduleJob - " |
252 |
+ "Service issue when rescheduling job: " + mue.getMessage()); |
|
253 |
} catch (IOException ioe) { |
|
254 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.reScheduleJob - " |
|
255 |
+ "I/O issue when rescheduling job: " + ioe.getMessage()); |
|
256 |
} catch (ServletException se) { |
|
257 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.reScheduleJob - " |
|
258 |
+ "Servlet issue when rescheduling job: " + se.getMessage()); |
|
233 |
+ "utility issue when rescheduling job: " + mue.getMessage()); |
|
259 | 234 |
} catch (ErrorSendingErrorException esee) { |
260 | 235 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.reScheduleJob - " |
261 | 236 |
+ "Issue sending error when rescheduling job: " + esee.getMessage()); |
... | ... | |
269 | 244 |
Hashtable<String, String[]> params, String username, |
270 | 245 |
String[] groups) throws MetacatSchedulerException { |
271 | 246 |
try { |
247 |
logMetacat.debug("WorkflowSchedulerClient.deleteJob"); |
|
248 |
|
|
272 | 249 |
params.put("action", new String[] { "deleteScheduledWorkflow" }); |
273 | 250 |
params.put("sessionid", new String[] { RequestUtil.getSessionData(request).getId() }); |
274 | 251 |
|
... | ... | |
300 | 277 |
+ "property error when deleting job: " + pnfe.getMessage()); |
301 | 278 |
} catch (MetacatUtilException mue) { |
302 | 279 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.deleteJob - " |
303 |
+ "Service issue when deleting job: " + mue.getMessage()); |
|
304 |
} catch (IOException ioe) { |
|
305 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.deleteJob - " |
|
306 |
+ "I/O issue when deleting job: " + ioe.getMessage()); |
|
307 |
} catch (ServletException se) { |
|
308 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.deleteJob - " |
|
309 |
+ "Servlet issue when deleting job: " + se.getMessage()); |
|
280 |
+ "utility issue when deleting job: " + mue.getMessage()); |
|
310 | 281 |
} catch (ErrorSendingErrorException esee) { |
311 | 282 |
throw new MetacatSchedulerException("WorkflowSchedulerClient.deleteJob - " |
312 | 283 |
+ "Issue sending error when deleting job: " + esee.getMessage()); |
... | ... | |
331 | 302 |
Hashtable<String, String[]> params, String username, |
332 | 303 |
String[] groups) throws MetacatSchedulerException { |
333 | 304 |
|
334 |
try { |
|
305 |
try { |
|
306 |
logMetacat.debug("WorkflowSchedulerClient.getJobs"); |
|
335 | 307 |
params.put("action", new String[] { "getScheduledWorkflow" }); |
336 | 308 |
|
337 | 309 |
String schedulerUrl = PropertyService.getProperty("workflowScheduler.url"); |
Also available in: Unified diff
Change RequestUtil forwardRequest() method to throw MetacatUtilException.