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.messaging.proxy.MessagingProxy;
019    import com.liferay.portal.kernel.messaging.proxy.ProxyMode;
020    import com.liferay.portal.kernel.scheduler.messaging.SchedulerResponse;
021    import com.liferay.portal.kernel.util.GetterUtil;
022    import com.liferay.portal.kernel.util.PropsKeys;
023    import com.liferay.portal.kernel.util.PropsUtil;
024    
025    import java.util.List;
026    
027    /**
028     * @author Michael C. Han
029     * @author Bruno Farache
030     * @author Shuyang Zhou
031     * @author Tina Tian
032     */
033    public interface SchedulerEngine {
034    
035            public static final String AUDIT_ACTION = "AUDIT_ACTION";
036    
037            public static final String CONTEXT_PATH = "CONTEXT_PATH";
038    
039            public static final String DESCRIPTION = "DESCRIPTION";
040    
041            public static final int DESCRIPTION_MAX_LENGTH = GetterUtil.getInteger(
042                    PropsUtil.get(PropsKeys.SCHEDULER_DESCRIPTION_MAX_LENGTH));
043    
044            public static final String DESTINATION_NAME = "DESTINATION_NAME";
045    
046            public static final String DISABLE = "DISABLE";
047    
048            public static final String END_TIME = "END_TIME";
049    
050            public static final String EXCEPTIONS_MAX_SIZE = "EXCEPTIONS_MAX_SIZE";
051    
052            public static final String FINAL_FIRE_TIME = "FINAL_FIRE_TIME";
053    
054            public static final String GROUP_NAME = "GROUP_NAME";
055    
056            public static final int GROUP_NAME_MAX_LENGTH = GetterUtil.getInteger(
057                    PropsUtil.get(PropsKeys.SCHEDULER_GROUP_NAME_MAX_LENGTH));
058    
059            public static final String JOB_NAME = "JOB_NAME";
060    
061            public static final int JOB_NAME_MAX_LENGTH = GetterUtil.getInteger(
062                    PropsUtil.get(PropsKeys.SCHEDULER_JOB_NAME_MAX_LENGTH));
063    
064            public static final String JOB_STATE = "JOB_STATE";
065    
066            public static final String LANGUAGE = "LANGUAGE";
067    
068            public static final String MESSAGE = "MESSAGE";
069    
070            public static final String MESSAGE_LISTENER_CLASS_NAME =
071                    "MESSAGE_LISTENER_CLASS_NAME";
072    
073            public static final String MESSAGE_LISTENER_UUID = "MESSAGE_LISTENER_UUID";
074    
075            public static final String NEXT_FIRE_TIME = "NEXT_FIRE_TIME";
076    
077            public static final String PORTLET_ID = "PORTLET_ID";
078    
079            public static final String PREVIOUS_FIRE_TIME = "PREVIOUS_FIRE_TIME";
080    
081            public static final String RECEIVER_KEY = "RECEIVER_KEY";
082    
083            public static final String SCRIPT = "SCRIPT";
084    
085            public static final String START_TIME = "START_TIME";
086    
087            public static final String STORAGE_TYPE = "STORAGE_TYPE";
088    
089            public void delete(String groupName) throws SchedulerException;
090    
091            public void delete(String jobName, String groupName)
092                    throws SchedulerException;
093    
094            @MessagingProxy(mode = ProxyMode.SYNC)
095            public SchedulerResponse getScheduledJob(String jobName, String groupName)
096                    throws SchedulerException;
097    
098            @MessagingProxy(mode = ProxyMode.SYNC)
099            public List<SchedulerResponse> getScheduledJobs()
100                    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(mode = ProxyMode.SYNC)
122            public void shutdown() throws SchedulerException;
123    
124            @MessagingProxy(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    }