1
22
23 package com.liferay.portal.kernel.scheduler;
24
25 import com.liferay.portal.kernel.scheduler.messaging.SchedulerRequest;
26
27 import java.util.Date;
28 import java.util.List;
29
30
35 public class SchedulerEngineUtil {
36
37 public static List<SchedulerRequest> getScheduledJobs(String groupName)
38 throws SchedulerException {
39
40 return _instance._getScheduledJobs(groupName);
41 }
42
43 public static void init(SchedulerEngine defaultScheduler) {
44 _instance._init(defaultScheduler);
45 }
46
47 public static void schedule(
48 String groupName, long interval, Date startDate, Date endDate,
49 String description, String destinationName, String messageBody)
50 throws SchedulerException {
51
52 _instance._schedule(
53 groupName, interval, startDate, endDate, description,
54 destinationName, messageBody);
55 }
56
57 public static void schedule(
58 String groupName, String cronText, Date startDate, Date endDate,
59 String description, String destinationName, String messageBody)
60 throws SchedulerException {
61
62 _instance._schedule(
63 groupName, cronText, startDate, endDate, description,
64 destinationName, messageBody);
65 }
66
67 public static void shutdown() throws SchedulerException {
68 _instance._shutdown();
69 }
70
71 public static void start() throws SchedulerException {
72 _instance._start();
73 }
74
75 public static void unschedule(String jobName, String groupName)
76 throws SchedulerException {
77
78 _instance._unschedule(jobName, groupName);
79 }
80
81 private List<SchedulerRequest> _getScheduledJobs(String groupName)
82 throws SchedulerException {
83
84 return _schedulerEngine.getScheduledJobs(groupName);
85 }
86
87 private void _init(SchedulerEngine schedulerEngine) {
88 _schedulerEngine = schedulerEngine;
89 }
90
91 private void _schedule(
92 String groupName, long interval, Date startDate, Date endDate,
93 String description, String destinationName, String messageBody)
94 throws SchedulerException {
95
96 _schedulerEngine.schedule(
97 groupName, interval, startDate, endDate, description,
98 destinationName, messageBody);
99 }
100
101 private void _schedule(
102 String groupName, String cronText, Date startDate, Date endDate,
103 String description, String destinationName, String messageBody)
104 throws SchedulerException {
105
106 _schedulerEngine.schedule(
107 groupName, cronText, startDate, endDate, description,
108 destinationName, messageBody);
109 }
110
111 private void _shutdown() throws SchedulerException {
112 _schedulerEngine.shutdown();
113 }
114
115 private void _start() throws SchedulerException {
116 _schedulerEngine.start();
117 }
118
119 private void _unschedule(String jobName, String groupName)
120 throws SchedulerException {
121
122 _schedulerEngine.unschedule(jobName, groupName);
123 }
124
125 private static SchedulerEngineUtil _instance = new SchedulerEngineUtil();
126
127 private SchedulerEngine _schedulerEngine;
128
129 }