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         * pause the scheduler task
048         * @param name
049         * @param pause
050         * @param throwWhenNotExist
051         * @throws ScheduleException
052         * @throws IOException
053         */
054            public void pauseScheduleTask(String name, 
055                            boolean pause, boolean throwWhenNotExist) throws ScheduleException, IOException;
056    
057        /**
058         * removes a task from scheduler
059         * @param name name of the task to remove
060         * @param throwWhenNotExist define if method throws a exception if task doesn't exist
061         * @throws IOException
062         * @throws ScheduleException
063         */
064        public abstract void removeScheduleTask(String name,
065                boolean throwWhenNotExist) throws IOException, ScheduleException;
066    
067        /**
068         * runs a scheduler task
069         * @param name
070         * @param throwWhenNotExist
071         * @throws IOException
072         * @throws ScheduleException
073         */
074        public abstract void runScheduleTask(String name, boolean throwWhenNotExist)
075                throws IOException, ScheduleException;
076    
077        /**
078         * @return Returns the logFile.
079         */
080        public abstract LogAndSource getLogger();   
081    }