001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.scheduler;
016    
017    import com.liferay.portal.kernel.messaging.Message;
018    import com.liferay.portal.kernel.scheduler.messaging.SchedulerResponse;
019    import com.liferay.portal.kernel.util.ObjectValuePair;
020    
021    import java.util.Calendar;
022    import java.util.Date;
023    import java.util.List;
024    
025    import javax.portlet.PortletRequest;
026    
027    /**
028     * @author Michael C. Han
029     */
030    public interface SchedulerEngineHelper {
031    
032            public void addJob(
033                            Trigger trigger, StorageType storageType, String description,
034                            String destinationName, Message message,
035                            String messageListenerClassName, String portletId,
036                            int exceptionsMaxSize)
037                    throws SchedulerException;
038    
039            public void addJob(
040                            Trigger trigger, StorageType storageType, String description,
041                            String destinationName, Object payload,
042                            String messageListenerClassName, String portletId,
043                            int exceptionsMaxSize)
044                    throws SchedulerException;
045    
046            public void addScriptingJob(
047                            Trigger trigger, StorageType storageType, String description,
048                            String language, String script, int exceptionsMaxSize)
049                    throws SchedulerException;
050    
051            public void auditSchedulerJobs(Message message, TriggerState triggerState)
052                    throws SchedulerException;
053    
054            public void delete(SchedulerEntry schedulerEntry, StorageType storageType)
055                    throws SchedulerException;
056    
057            public void delete(String groupName, StorageType storageType)
058                    throws SchedulerException;
059    
060            public void delete(
061                            String jobName, String groupName, StorageType storageType)
062                    throws SchedulerException;
063    
064            public String getCronText(Calendar calendar, boolean timeZoneSensitive);
065    
066            public String getCronText(
067                    PortletRequest portletRequest, Calendar calendar,
068                    boolean timeZoneSensitive, int recurrenceType);
069    
070            public Date getEndTime(SchedulerResponse schedulerResponse);
071    
072            public Date getEndTime(
073                            String jobName, String groupName, StorageType storageType)
074                    throws SchedulerException;
075    
076            public Date getFinalFireTime(SchedulerResponse schedulerResponse);
077    
078            public Date getFinalFireTime(
079                            String jobName, String groupName, StorageType storageType)
080                    throws SchedulerException;
081    
082            public ObjectValuePair<Exception, Date>[] getJobExceptions(
083                    SchedulerResponse schedulerResponse);
084    
085            public ObjectValuePair<Exception, Date>[] getJobExceptions(
086                            String jobName, String groupName, StorageType storageType)
087                    throws SchedulerException;
088    
089            public TriggerState getJobState(SchedulerResponse schedulerResponse);
090    
091            public TriggerState getJobState(
092                            String jobName, String groupName, StorageType storageType)
093                    throws SchedulerException;
094    
095            public Date getNextFireTime(SchedulerResponse schedulerResponse);
096    
097            public Date getNextFireTime(
098                            String jobName, String groupName, StorageType storageType)
099                    throws SchedulerException;
100    
101            public Date getPreviousFireTime(SchedulerResponse schedulerResponse);
102    
103            public Date getPreviousFireTime(
104                            String jobName, String groupName, StorageType storageType)
105                    throws SchedulerException;
106    
107            public SchedulerResponse getScheduledJob(
108                            String jobName, String groupName, StorageType storageType)
109                    throws SchedulerException;
110    
111            public List<SchedulerResponse> getScheduledJobs() throws SchedulerException;
112    
113            public List<SchedulerResponse> getScheduledJobs(StorageType storageType)
114                    throws SchedulerException;
115    
116            public List<SchedulerResponse> getScheduledJobs(
117                            String groupName, StorageType storageType)
118                    throws SchedulerException;
119    
120            public Date getStartTime(SchedulerResponse schedulerResponse);
121    
122            public Date getStartTime(
123                            String jobName, String groupName, StorageType storageType)
124                    throws SchedulerException;
125    
126            public boolean isClusteredSchedulerEngine();
127    
128            public void pause(String groupName, StorageType storageType)
129                    throws SchedulerException;
130    
131            public void pause(String jobName, String groupName, StorageType storageType)
132                    throws SchedulerException;
133    
134            public void resume(String groupName, StorageType storageType)
135                    throws SchedulerException;
136    
137            public void resume(
138                            String jobName, String groupName, StorageType storageType)
139                    throws SchedulerException;
140    
141            public void schedule(
142                            SchedulerEntry schedulerEntry, StorageType storageType,
143                            String portletId, int exceptionsMaxSize)
144                    throws SchedulerException;
145    
146            public void schedule(
147                            Trigger trigger, StorageType storageType, String description,
148                            String destinationName, Message message, int exceptionsMaxSize)
149                    throws SchedulerException;
150    
151            public void schedule(
152                            Trigger trigger, StorageType storageType, String description,
153                            String destinationName, Object payload, int exceptionsMaxSize)
154                    throws SchedulerException;
155    
156            public void shutdown() throws SchedulerException;
157    
158            public void start() throws SchedulerException;
159    
160            public void suppressError(
161                            String jobName, String groupName, StorageType storageType)
162                    throws SchedulerException;
163    
164            public void unschedule(
165                            SchedulerEntry schedulerEntry, StorageType storageType)
166                    throws SchedulerException;
167    
168            public void unschedule(String groupName, StorageType storageType)
169                    throws SchedulerException;
170    
171            public void unschedule(
172                            String jobName, String groupName, StorageType storageType)
173                    throws SchedulerException;
174    
175            public void update(
176                            String jobName, String groupName, StorageType storageType,
177                            String description, String language, String script,
178                            int exceptionsMaxSize)
179                    throws SchedulerException;
180    
181            public void update(Trigger trigger, StorageType storageType)
182                    throws SchedulerException;
183    
184    }