001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.schedule; 020 021import java.io.IOException; 022 023import lucee.commons.io.log.LogAndSource; 024 025/** 026 * Scheduler interface 027 */ 028public interface Scheduler { 029 030 /** 031 * returns a schedule tasks matching given name or throws a exception 032 * @param name Task name of Schedule Task to get 033 * @return matching task 034 * @throws ScheduleException 035 */ 036 public abstract ScheduleTask getScheduleTask(String name) 037 throws ScheduleException; 038 039 /** 040 * returns all schedule tasks valid or not 041 * @return all tasks 042 */ 043 public abstract ScheduleTask[] getAllScheduleTasks(); 044 045 /** 046 * returns a schedule tasks matching given name or null 047 * @param name Task name of Schedule Task to get 048 * @param defaultValue 049 * @return matching task 050 */ 051 public abstract ScheduleTask getScheduleTask(String name, 052 ScheduleTask defaultValue); 053 054 /** 055 * Adds a Task to the scheduler 056 * @param task 057 * @param allowOverwrite 058 * @throws ScheduleException 059 * @throws IOException 060 */ 061 public abstract void addScheduleTask(ScheduleTask task, 062 boolean allowOverwrite) throws ScheduleException, IOException; 063 064 /** 065 * pause the scheduler task 066 * @param name 067 * @param pause 068 * @param throwWhenNotExist 069 * @throws ScheduleException 070 * @throws IOException 071 */ 072 public void pauseScheduleTask(String name, 073 boolean pause, boolean throwWhenNotExist) throws ScheduleException, IOException; 074 075 /** 076 * removes a task from scheduler 077 * @param name name of the task to remove 078 * @param throwWhenNotExist define if method throws a exception if task doesn't exist 079 * @throws IOException 080 * @throws ScheduleException 081 */ 082 public abstract void removeScheduleTask(String name, 083 boolean throwWhenNotExist) throws IOException, ScheduleException; 084 085 /** 086 * runs a scheduler task 087 * @param name 088 * @param throwWhenNotExist 089 * @throws IOException 090 * @throws ScheduleException 091 */ 092 public abstract void runScheduleTask(String name, boolean throwWhenNotExist) 093 throws IOException, ScheduleException; 094 095 /** 096 * @return Returns the logFile. 097 */ 098 public abstract LogAndSource getLogger();// FUTURE deprecated 099}