001    package railo.runtime.schedule;
002    
003    import java.io.IOException;
004    
005    import railo.commons.io.log.LogAndSource;
006    
007    /**
008     * Scheduler interface
009     */
010    public interface Scheduler {
011    
012        /** 
013         * returns a schedule tasks matching given name or throws a exception
014         * @param name Task name of Schedule Task to get
015         * @return matching task
016         * @throws ScheduleException
017         */
018        public abstract ScheduleTask getScheduleTask(String name)
019                throws ScheduleException;
020    
021        /** 
022         * returns all schedule tasks valid or not
023         * @return all tasks
024         */
025        public abstract ScheduleTask[] getAllScheduleTasks();
026    
027        /** 
028         * returns a schedule tasks matching given name or null
029         * @param name Task name of Schedule Task to get
030         * @param defaultValue 
031         * @return matching task
032         */
033        public abstract ScheduleTask getScheduleTask(String name,
034                ScheduleTask defaultValue);
035    
036        /**
037         * Adds a Task to the scheduler
038         * @param task
039         * @param allowOverwrite
040         * @throws ScheduleException
041         * @throws IOException
042         */
043        public abstract void addScheduleTask(ScheduleTask task,
044                boolean allowOverwrite) throws ScheduleException, IOException;
045    
046        /**
047         * removes a task from scheduler
048         * @param name name of the task to remove
049         * @param throwWhenNotExist define if method throws a exception if task doesn't exist
050         * @throws IOException
051         * @throws ScheduleException
052         */
053        public abstract void removeScheduleTask(String name,
054                boolean throwWhenNotExist) throws IOException, ScheduleException;
055    
056        /**
057         * runs a scheduler task
058         * @param name
059         * @param throwWhenNotExist
060         * @throws IOException
061         * @throws ScheduleException
062         */
063        public abstract void runScheduleTask(String name, boolean throwWhenNotExist)
064                throws IOException, ScheduleException;
065    
066        /**
067         * execute all containing tasks
068         * @deprecated task are self controlled no longer controlled by a controller thread
069         */
070        public abstract void execute();
071    
072        /**
073         * @return Returns the nextExecutionTime.
074         * @deprecated task are self controlled no longer controlled by a controller thread
075         */
076        public abstract long getNextExecutionTime();
077    
078        /**
079         * @return Returns the logFile.
080         */
081        public abstract LogAndSource getLogger();   
082    }