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.messaging.MessageListener;
019    import com.liferay.portal.kernel.scheduler.messaging.SchedulerResponse;
020    import com.liferay.portal.kernel.util.ObjectValuePair;
021    
022    import java.util.Calendar;
023    import java.util.Date;
024    import java.util.List;
025    
026    import javax.portlet.PortletRequest;
027    
028    /**
029     * @author Michael C. Han
030     */
031    public interface SchedulerEngineHelper {
032    
033            public void addScriptingJob(
034                            Trigger trigger, StorageType storageType, String description,
035                            String language, String script, int exceptionsMaxSize)
036                    throws SchedulerException;
037    
038            public void auditSchedulerJobs(Message message, TriggerState triggerState)
039                    throws SchedulerException;
040    
041            public void delete(SchedulerEntry schedulerEntry, StorageType storageType)
042                    throws SchedulerException;
043    
044            public void delete(String groupName, StorageType storageType)
045                    throws SchedulerException;
046    
047            public void delete(
048                            String jobName, String groupName, StorageType storageType)
049                    throws SchedulerException;
050    
051            public String getCronText(Calendar calendar, boolean timeZoneSensitive);
052    
053            public String getCronText(
054                    PortletRequest portletRequest, Calendar calendar,
055                    boolean timeZoneSensitive, int recurrenceType);
056    
057            public Date getEndTime(SchedulerResponse schedulerResponse);
058    
059            public Date getEndTime(
060                            String jobName, String groupName, StorageType storageType)
061                    throws SchedulerException;
062    
063            public Date getFinalFireTime(SchedulerResponse schedulerResponse);
064    
065            public Date getFinalFireTime(
066                            String jobName, String groupName, StorageType storageType)
067                    throws SchedulerException;
068    
069            public ObjectValuePair<Exception, Date>[] getJobExceptions(
070                    SchedulerResponse schedulerResponse);
071    
072            public ObjectValuePair<Exception, Date>[] getJobExceptions(
073                            String jobName, String groupName, StorageType storageType)
074                    throws SchedulerException;
075    
076            public TriggerState getJobState(SchedulerResponse schedulerResponse);
077    
078            public TriggerState getJobState(
079                            String jobName, String groupName, StorageType storageType)
080                    throws SchedulerException;
081    
082            public Date getNextFireTime(SchedulerResponse schedulerResponse);
083    
084            public Date getNextFireTime(
085                            String jobName, String groupName, StorageType storageType)
086                    throws SchedulerException;
087    
088            public Date getPreviousFireTime(SchedulerResponse schedulerResponse);
089    
090            public Date getPreviousFireTime(
091                            String jobName, String groupName, StorageType storageType)
092                    throws SchedulerException;
093    
094            public SchedulerResponse getScheduledJob(
095                            String jobName, String groupName, StorageType storageType)
096                    throws SchedulerException;
097    
098            public List<SchedulerResponse> getScheduledJobs() throws SchedulerException;
099    
100            public List<SchedulerResponse> getScheduledJobs(StorageType storageType)
101                    throws SchedulerException;
102    
103            public List<SchedulerResponse> getScheduledJobs(
104                            String groupName, StorageType storageType)
105                    throws SchedulerException;
106    
107            public Date getStartTime(SchedulerResponse schedulerResponse);
108    
109            public Date getStartTime(
110                            String jobName, String groupName, StorageType storageType)
111                    throws SchedulerException;
112    
113            public void pause(String groupName, StorageType storageType)
114                    throws SchedulerException;
115    
116            public void pause(String jobName, String groupName, StorageType storageType)
117                    throws SchedulerException;
118    
119            public void register(
120                    MessageListener messageListener, SchedulerEntry schedulerEntry,
121                    String destinationName);
122    
123            public void resume(String groupName, StorageType storageType)
124                    throws SchedulerException;
125    
126            public void resume(
127                            String jobName, String groupName, StorageType storageType)
128                    throws SchedulerException;
129    
130            public void schedule(
131                            Trigger trigger, StorageType storageType, String description,
132                            String destinationName, Message message, int exceptionsMaxSize)
133                    throws SchedulerException;
134    
135            public void schedule(
136                            Trigger trigger, StorageType storageType, String description,
137                            String destinationName, Object payload, int exceptionsMaxSize)
138                    throws SchedulerException;
139    
140            public void shutdown() throws SchedulerException;
141    
142            public void start() throws SchedulerException;
143    
144            public void suppressError(
145                            String jobName, String groupName, StorageType storageType)
146                    throws SchedulerException;
147    
148            public void unregister(MessageListener messageListener);
149    
150            public void unschedule(
151                            SchedulerEntry schedulerEntry, StorageType storageType)
152                    throws SchedulerException;
153    
154            public void unschedule(String groupName, StorageType storageType)
155                    throws SchedulerException;
156    
157            public void unschedule(
158                            String jobName, String groupName, StorageType storageType)
159                    throws SchedulerException;
160    
161            public void update(
162                            String jobName, String groupName, StorageType storageType,
163                            String description, String language, String script,
164                            int exceptionsMaxSize)
165                    throws SchedulerException;
166    
167            public void update(Trigger trigger, StorageType storageType)
168                    throws SchedulerException;
169    
170    }