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 boolean isClusteredSchedulerEngine();
114    
115            public void pause(String groupName, StorageType storageType)
116                    throws SchedulerException;
117    
118            public void pause(String jobName, String groupName, StorageType storageType)
119                    throws SchedulerException;
120    
121            public void register(
122                    MessageListener messageListener, SchedulerEntry schedulerEntry,
123                    String destinationName);
124    
125            public void resume(String groupName, StorageType storageType)
126                    throws SchedulerException;
127    
128            public void resume(
129                            String jobName, String groupName, StorageType storageType)
130                    throws SchedulerException;
131    
132            public void schedule(
133                            Trigger trigger, StorageType storageType, String description,
134                            String destinationName, Message message, int exceptionsMaxSize)
135                    throws SchedulerException;
136    
137            public void schedule(
138                            Trigger trigger, StorageType storageType, String description,
139                            String destinationName, Object payload, int exceptionsMaxSize)
140                    throws SchedulerException;
141    
142            public void shutdown() throws SchedulerException;
143    
144            public void start() throws SchedulerException;
145    
146            public void suppressError(
147                            String jobName, String groupName, StorageType storageType)
148                    throws SchedulerException;
149    
150            public void unregister(MessageListener messageListener);
151    
152            public void unschedule(
153                            SchedulerEntry schedulerEntry, StorageType storageType)
154                    throws SchedulerException;
155    
156            public void unschedule(String groupName, StorageType storageType)
157                    throws SchedulerException;
158    
159            public void unschedule(
160                            String jobName, String groupName, StorageType storageType)
161                    throws SchedulerException;
162    
163            public void update(
164                            String jobName, String groupName, StorageType storageType,
165                            String description, String language, String script,
166                            int exceptionsMaxSize)
167                    throws SchedulerException;
168    
169            public void update(Trigger trigger, StorageType storageType)
170                    throws SchedulerException;
171    
172    }