001    /**
002     * Copyright (c) 2000-2012 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_UUID = "MESSAGE_LISTENER_UUID";
071    
072            public static final String NEXT_FIRE_TIME = "NEXT_FIRE_TIME";
073    
074            public static final String PREVIOUS_FIRE_TIME = "PREVIOUS_FIRE_TIME";
075    
076            public static final String RECEIVER_KEY = "RECEIVER_KEY";
077    
078            public static final String SCRIPT = "SCRIPT";
079    
080            public static final String START_TIME = "START_TIME";
081    
082            public static final String STORAGE_TYPE = "STORAGE_TYPE";
083    
084            public void delete(String groupName) throws SchedulerException;
085    
086            public void delete(String jobName, String groupName)
087                    throws SchedulerException;
088    
089            @MessagingProxy(mode = ProxyMode.SYNC)
090            public SchedulerResponse getScheduledJob(String jobName, String groupName)
091                    throws SchedulerException;
092    
093            @MessagingProxy(mode = ProxyMode.SYNC)
094            public List<SchedulerResponse> getScheduledJobs()
095                    throws SchedulerException;
096    
097            @MessagingProxy(mode = ProxyMode.SYNC)
098            public List<SchedulerResponse> getScheduledJobs(String groupName)
099                    throws SchedulerException;
100    
101            public void pause(String groupName) throws SchedulerException;
102    
103            public void pause(String jobName, String groupName)
104                    throws SchedulerException;
105    
106            public void resume(String groupName) throws SchedulerException;
107    
108            public void resume(String jobName, String groupName)
109                    throws SchedulerException;
110    
111            public void schedule(
112                            Trigger trigger, String description, String destinationName,
113                            Message message)
114                    throws SchedulerException;
115    
116            @MessagingProxy(mode = ProxyMode.SYNC)
117            public void shutdown() throws SchedulerException;
118    
119            @MessagingProxy(mode = ProxyMode.SYNC)
120            public void start() throws SchedulerException;
121    
122            public void suppressError(String jobName, String groupName)
123                    throws SchedulerException;
124    
125            @MessagingProxy(mode = ProxyMode.SYNC)
126            public void unschedule(String groupName) throws SchedulerException;
127    
128            @MessagingProxy(mode = ProxyMode.SYNC)
129            public void unschedule(String jobName, String groupName)
130                    throws SchedulerException;
131    
132            public void update(Trigger trigger) throws SchedulerException;
133    
134    }