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 DESCRIPTION = "DESCRIPTION";
038    
039            public static final int DESCRIPTION_MAX_LENGTH = GetterUtil.getInteger(
040                    PropsUtil.get(PropsKeys.SCHEDULER_DESCRIPTION_MAX_LENGTH));
041    
042            public static final String DESTINATION_NAME = "DESTINATION_NAME";
043    
044            public static final String DISABLE = "DISABLE";
045    
046            public static final String END_TIME = "END_TIME";
047    
048            public static final String EXCEPTIONS_MAX_SIZE = "EXCEPTIONS_MAX_SIZE";
049    
050            public static final String FINAL_FIRE_TIME = "FINAL_FIRE_TIME";
051    
052            public static final String GROUP_NAME = "GROUP_NAME";
053    
054            public static final int GROUP_NAME_MAX_LENGTH = GetterUtil.getInteger(
055                    PropsUtil.get(PropsKeys.SCHEDULER_GROUP_NAME_MAX_LENGTH));
056    
057            public static final String JOB_NAME = "JOB_NAME";
058    
059            public static final int JOB_NAME_MAX_LENGTH = GetterUtil.getInteger(
060                    PropsUtil.get(PropsKeys.SCHEDULER_JOB_NAME_MAX_LENGTH));
061    
062            public static final String JOB_STATE = "JOB_STATE";
063    
064            public static final String LANGUAGE = "LANGUAGE";
065    
066            public static final String MESSAGE = "MESSAGE";
067    
068            public static final String MESSAGE_LISTENER_CLASS_NAME =
069                    "MESSAGE_LISTENER_CLASS_NAME";
070    
071            public static final String MESSAGE_LISTENER_UUID = "MESSAGE_LISTENER_UUID";
072    
073            public static final String NEXT_FIRE_TIME = "NEXT_FIRE_TIME";
074    
075            public static final String PORTLET_ID = "PORTLET_ID";
076    
077            public static final String PREVIOUS_FIRE_TIME = "PREVIOUS_FIRE_TIME";
078    
079            public static final String RECEIVER_KEY = "RECEIVER_KEY";
080    
081            public static final String SCRIPT = "SCRIPT";
082    
083            public static final String START_TIME = "START_TIME";
084    
085            public static final String STORAGE_TYPE = "STORAGE_TYPE";
086    
087            public void delete(String groupName) throws SchedulerException;
088    
089            public void delete(String jobName, String groupName)
090                    throws SchedulerException;
091    
092            @MessagingProxy(mode = ProxyMode.SYNC)
093            public SchedulerResponse getScheduledJob(String jobName, String groupName)
094                    throws SchedulerException;
095    
096            @MessagingProxy(mode = ProxyMode.SYNC)
097            public List<SchedulerResponse> getScheduledJobs()
098                    throws SchedulerException;
099    
100            @MessagingProxy(mode = ProxyMode.SYNC)
101            public List<SchedulerResponse> getScheduledJobs(String groupName)
102                    throws SchedulerException;
103    
104            public void pause(String groupName) throws SchedulerException;
105    
106            public void pause(String jobName, String groupName)
107                    throws SchedulerException;
108    
109            public void resume(String groupName) throws SchedulerException;
110    
111            public void resume(String jobName, String groupName)
112                    throws SchedulerException;
113    
114            public void schedule(
115                            Trigger trigger, String description, String destinationName,
116                            Message message)
117                    throws SchedulerException;
118    
119            @MessagingProxy(local = true, mode = ProxyMode.SYNC)
120            public void shutdown() throws SchedulerException;
121    
122            @MessagingProxy(local = true, mode = ProxyMode.SYNC)
123            public void start() throws SchedulerException;
124    
125            public void suppressError(String jobName, String groupName)
126                    throws SchedulerException;
127    
128            @MessagingProxy(mode = ProxyMode.SYNC)
129            public void unschedule(String groupName) throws SchedulerException;
130    
131            @MessagingProxy(mode = ProxyMode.SYNC)
132            public void unschedule(String jobName, String groupName)
133                    throws SchedulerException;
134    
135            public void update(Trigger trigger) throws SchedulerException;
136    
137    }