001    /**
002     * Copyright (c) 2000-2013 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()
112                    throws SchedulerException;
113    
114            public List<SchedulerResponse> getScheduledJobs(StorageType storageType)
115                    throws SchedulerException;
116    
117            public List<SchedulerResponse> getScheduledJobs(
118                            String groupName, StorageType storageType)
119                    throws SchedulerException;
120    
121            public Date getStartTime(SchedulerResponse schedulerResponse);
122    
123            public Date getStartTime(
124                            String jobName, String groupName, StorageType storageType)
125                    throws SchedulerException;
126    
127            public void initialize() throws SchedulerException;
128    
129            public String namespaceGroupName(String groupName, StorageType storageType);
130    
131            public void pause(String groupName, StorageType storageType)
132                    throws SchedulerException;
133    
134            public void pause(String jobName, String groupName, StorageType storageType)
135                    throws SchedulerException;
136    
137            public void resume(String groupName, StorageType storageType)
138                    throws SchedulerException;
139    
140            public void resume(
141                            String jobName, String groupName, StorageType storageType)
142                    throws SchedulerException;
143    
144            public void schedule(
145                            SchedulerEntry schedulerEntry, StorageType storageType,
146                            String portletId, int exceptionsMaxSize)
147                    throws SchedulerException;
148    
149            public void schedule(
150                            Trigger trigger, StorageType storageType, String description,
151                            String destinationName, Message message, int exceptionsMaxSize)
152                    throws SchedulerException;
153    
154            public void schedule(
155                            Trigger trigger, StorageType storageType, String description,
156                            String destinationName, Object payload, int exceptionsMaxSize)
157                    throws SchedulerException;
158    
159            public void shutdown() throws SchedulerException;
160    
161            public void start() throws SchedulerException;
162    
163            public void suppressError(
164                            String jobName, String groupName, StorageType storageType)
165                    throws SchedulerException;
166    
167            public void unschedule(
168                            SchedulerEntry schedulerEntry, StorageType storageType)
169                    throws SchedulerException;
170    
171            public void unschedule(String groupName, StorageType storageType)
172                    throws SchedulerException;
173    
174            public void unschedule(
175                            String jobName, String groupName, StorageType storageType)
176                    throws SchedulerException;
177    
178            public void update(
179                            String jobName, String groupName, StorageType storageType,
180                            String description, String language, String script,
181                            int exceptionsMaxSize)
182                    throws SchedulerException;
183    
184            public void update(Trigger trigger, StorageType storageType)
185                    throws SchedulerException;
186    
187            public void updateMemorySchedulerClusterMaster()
188                    throws SchedulerException;
189    
190    }