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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.messaging.Message;
020    import com.liferay.portal.kernel.messaging.proxy.MessagingProxy;
021    import com.liferay.portal.kernel.messaging.proxy.ProxyMode;
022    import com.liferay.portal.kernel.scheduler.messaging.SchedulerResponse;
023    import com.liferay.portal.kernel.util.GetterUtil;
024    import com.liferay.portal.kernel.util.PropsKeys;
025    import com.liferay.portal.kernel.util.PropsUtil;
026    
027    import java.util.List;
028    
029    /**
030     * @author Michael C. Han
031     * @author Bruno Farache
032     * @author Shuyang Zhou
033     * @author Tina Tian
034     */
035    @ProviderType
036    public interface SchedulerEngine {
037    
038            public static final String DESCRIPTION = "DESCRIPTION";
039    
040            public static final int DESCRIPTION_MAX_LENGTH = GetterUtil.getInteger(
041                    PropsUtil.get(PropsKeys.SCHEDULER_DESCRIPTION_MAX_LENGTH));
042    
043            public static final String DESTINATION_NAME = "DESTINATION_NAME";
044    
045            public static final String DISABLE = "DISABLE";
046    
047            public static final String END_TIME = "END_TIME";
048    
049            public static final String EXCEPTIONS_MAX_SIZE = "EXCEPTIONS_MAX_SIZE";
050    
051            public static final String FINAL_FIRE_TIME = "FINAL_FIRE_TIME";
052    
053            public static final String GROUP_NAME = "GROUP_NAME";
054    
055            public static final int GROUP_NAME_MAX_LENGTH = GetterUtil.getInteger(
056                    PropsUtil.get(PropsKeys.SCHEDULER_GROUP_NAME_MAX_LENGTH));
057    
058            public static final String JOB_NAME = "JOB_NAME";
059    
060            public static final int JOB_NAME_MAX_LENGTH = GetterUtil.getInteger(
061                    PropsUtil.get(PropsKeys.SCHEDULER_JOB_NAME_MAX_LENGTH));
062    
063            public static final String JOB_STATE = "JOB_STATE";
064    
065            public static final String LANGUAGE = "LANGUAGE";
066    
067            public static final String MESSAGE = "MESSAGE";
068    
069            public static final String MESSAGE_LISTENER_CLASS_NAME =
070                    "MESSAGE_LISTENER_CLASS_NAME";
071    
072            public static final String MESSAGE_LISTENER_UUID = "MESSAGE_LISTENER_UUID";
073    
074            public static final String NEXT_FIRE_TIME = "NEXT_FIRE_TIME";
075    
076            public static final String PORTLET_ID = "PORTLET_ID";
077    
078            public static final String PREVIOUS_FIRE_TIME = "PREVIOUS_FIRE_TIME";
079    
080            /**
081             * @deprecated As of 7.0.0
082             */
083            public static final String RECEIVER_KEY = "RECEIVER_KEY";
084    
085            public static final String SCHEDULER = "SCHEDULER";
086    
087            public static final String SCRIPT = "SCRIPT";
088    
089            public static final String START_TIME = "START_TIME";
090    
091            public static final String STORAGE_TYPE = "STORAGE_TYPE";
092    
093            public void delete(String groupName, StorageType storageType)
094                    throws SchedulerException;
095    
096            public void delete(
097                            String jobName, String groupName, StorageType storageType)
098                    throws SchedulerException;
099    
100            @MessagingProxy(mode = ProxyMode.SYNC)
101            public SchedulerResponse getScheduledJob(
102                            String jobName, String groupName, StorageType storageType)
103                    throws SchedulerException;
104    
105            @MessagingProxy(mode = ProxyMode.SYNC)
106            public List<SchedulerResponse> getScheduledJobs() throws SchedulerException;
107    
108            @MessagingProxy(mode = ProxyMode.SYNC)
109            public List<SchedulerResponse> getScheduledJobs(StorageType storageType)
110                    throws SchedulerException;
111    
112            @MessagingProxy(mode = ProxyMode.SYNC)
113            public List<SchedulerResponse> getScheduledJobs(
114                            String groupName, StorageType storageType)
115                    throws SchedulerException;
116    
117            public void pause(String groupName, StorageType storageType)
118                    throws SchedulerException;
119    
120            public void pause(String jobName, String groupName, StorageType storageType)
121                    throws SchedulerException;
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, String description, String destinationName,
132                            Message message, StorageType storageType)
133                    throws SchedulerException;
134    
135            @MessagingProxy(local = true, mode = ProxyMode.SYNC)
136            public void shutdown() throws SchedulerException;
137    
138            @MessagingProxy(local = true, mode = ProxyMode.SYNC)
139            public void start() throws SchedulerException;
140    
141            public void suppressError(
142                            String jobName, String groupName, StorageType storageType)
143                    throws SchedulerException;
144    
145            @MessagingProxy(mode = ProxyMode.SYNC)
146            public void unschedule(String groupName, StorageType storageType)
147                    throws SchedulerException;
148    
149            @MessagingProxy(mode = ProxyMode.SYNC)
150            public void unschedule(
151                            String jobName, String groupName, StorageType storageType)
152                    throws SchedulerException;
153    
154            public void update(Trigger trigger, StorageType storageType)
155                    throws SchedulerException;
156    
157    }