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            public static final String RECEIVER_KEY = "RECEIVER_KEY";
081    
082            public static final String SCHEDULER = "SCHEDULER";
083    
084            public static final String SCRIPT = "SCRIPT";
085    
086            public static final String START_TIME = "START_TIME";
087    
088            public static final String STORAGE_TYPE = "STORAGE_TYPE";
089    
090            public void delete(String groupName) throws SchedulerException;
091    
092            public void delete(String jobName, String groupName)
093                    throws SchedulerException;
094    
095            @MessagingProxy(mode = ProxyMode.SYNC)
096            public SchedulerResponse getScheduledJob(String jobName, String groupName)
097                    throws SchedulerException;
098    
099            @MessagingProxy(mode = ProxyMode.SYNC)
100            public List<SchedulerResponse> getScheduledJobs() throws SchedulerException;
101    
102            @MessagingProxy(mode = ProxyMode.SYNC)
103            public List<SchedulerResponse> getScheduledJobs(String groupName)
104                    throws SchedulerException;
105    
106            public void pause(String groupName) throws SchedulerException;
107    
108            public void pause(String jobName, String groupName)
109                    throws SchedulerException;
110    
111            public void resume(String groupName) throws SchedulerException;
112    
113            public void resume(String jobName, String groupName)
114                    throws SchedulerException;
115    
116            public void schedule(
117                            Trigger trigger, String description, String destinationName,
118                            Message message)
119                    throws SchedulerException;
120    
121            @MessagingProxy(local = true, mode = ProxyMode.SYNC)
122            public void shutdown() throws SchedulerException;
123    
124            @MessagingProxy(local = true, mode = ProxyMode.SYNC)
125            public void start() throws SchedulerException;
126    
127            public void suppressError(String jobName, String groupName)
128                    throws SchedulerException;
129    
130            @MessagingProxy(mode = ProxyMode.SYNC)
131            public void unschedule(String groupName) throws SchedulerException;
132    
133            @MessagingProxy(mode = ProxyMode.SYNC)
134            public void unschedule(String jobName, String groupName)
135                    throws SchedulerException;
136    
137            public void update(Trigger trigger) throws SchedulerException;
138    
139    }