01: package com.sun.portal.fabric.tasks.scheduler;
02:
03: import java.util.logging.Logger;
04: import java.util.logging.Level;
05: import java.util.ArrayList;
06:
07: import com.sun.portal.admin.common.context.PSConfigContext;
08: import com.sun.portal.log.common.PortalLogger;
09:
10: import com.sun.portal.fabric.util.os.OSTasksFactory;
11: import com.sun.portal.fabric.util.os.OSTasks;
12:
13: public class SchedulerTask {
14:
15: private static Logger logger = PortalLogger
16: .getLogger(SchedulerTask.class);
17: private OSTasks osTasks;
18:
19: public SchedulerTask(PSConfigContext cc) {
20: OSTasksFactory osTasksFactory = OSTasksFactory.getInstance();
21: osTasks = osTasksFactory.getOSTasks(cc);
22: }
23:
24: public void schedule(ArrayList actions) {
25: for (int i = 0; i < actions.size(); i++) {
26: String action = (String) actions.get(i);
27:
28: try {
29: osTasks.scheduling(action, "schedule");
30: } catch (Exception e) {
31: logger.log(Level.SEVERE, e.toString());
32: }
33: }
34: }
35:
36: public void unschedule(ArrayList actions) {
37: for (int i = 0; i < actions.size(); i++) {
38: String action = (String) actions.get(i);
39:
40: try {
41: osTasks.scheduling(action, "unschedule");
42: } catch (Exception e) {
43: logger.log(Level.SEVERE, e.toString());
44: }
45: }
46: }
47:
48: public ArrayList getSchedules(String command) {
49: try {
50: return osTasks.getSchedules(command);
51: } catch (Exception e) {
52: logger.log(Level.SEVERE, e.toString());
53: return new ArrayList();
54: }
55: }
56:
57: }
|