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 CONTEXT_PATH = "CONTEXT_PATH";
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 int GROUP_NAME_MAX_LENGTH = GetterUtil.getInteger(
053                    PropsUtil.get(PropsKeys.SCHEDULER_GROUP_NAME_MAX_LENGTH));
054    
055            public static final int JOB_NAME_MAX_LENGTH = GetterUtil.getInteger(
056                    PropsUtil.get(PropsKeys.SCHEDULER_JOB_NAME_MAX_LENGTH));
057    
058            public static final String JOB_STATE = "JOB_STATE";
059    
060            public static final String LANGUAGE = "LANGUAGE";
061    
062            public static final String MESSAGE = "MESSAGE";
063    
064            public static final String MESSAGE_LISTENER_UUID = "MESSAGE_LISTENER_UUID";
065    
066            public static final String NEXT_FIRE_TIME = "NEXT_FIRE_TIME";
067    
068            public static final String PREVIOUS_FIRE_TIME = "PREVIOUS_FIRE_TIME";
069    
070            public static final String RECEIVER_KEY = "RECEIVER_KEY";
071    
072            public static final String SCRIPT = "SCRIPT";
073    
074            public static final String START_TIME = "START_TIME";
075    
076            public static final String STORAGE_TYPE = "STORAGE_TYPE";
077    
078            public void delete(String groupName) throws SchedulerException;
079    
080            public void delete(String jobName, String groupName)
081                    throws SchedulerException;
082    
083            @MessagingProxy(mode = ProxyMode.SYNC)
084            public SchedulerResponse getScheduledJob(String jobName, String groupName)
085                    throws SchedulerException;
086    
087            @MessagingProxy(mode = ProxyMode.SYNC)
088            public List<SchedulerResponse> getScheduledJobs()
089                    throws SchedulerException;
090    
091            @MessagingProxy(mode = ProxyMode.SYNC)
092            public List<SchedulerResponse> getScheduledJobs(String groupName)
093                    throws SchedulerException;
094    
095            public void pause(String groupName) throws SchedulerException;
096    
097            public void pause(String jobName, String groupName)
098                    throws SchedulerException;
099    
100            public void resume(String groupName) throws SchedulerException;
101    
102            public void resume(String jobName, String groupName)
103                    throws SchedulerException;
104    
105            public void schedule(
106                            Trigger trigger, String description, String destinationName,
107                            Message message)
108                    throws SchedulerException;
109    
110            @MessagingProxy(mode = ProxyMode.SYNC)
111            public void shutdown() throws SchedulerException;
112    
113            @MessagingProxy(mode = ProxyMode.SYNC)
114            public void start() throws SchedulerException;
115    
116            public void suppressError(String jobName, String groupName)
117                    throws SchedulerException;
118    
119            @MessagingProxy(mode = ProxyMode.SYNC)
120            public void unschedule(String groupName) throws SchedulerException;
121    
122            @MessagingProxy(mode = ProxyMode.SYNC)
123            public void unschedule(String jobName, String groupName)
124                    throws SchedulerException;
125    
126            public void update(Trigger trigger) throws SchedulerException;
127    
128    }