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.spooler;
020
021import lucee.runtime.exp.PageException;
022import lucee.runtime.type.Query;
023
024public interface SpoolerEngine {
025        
026        /**
027         * return the label of the engine
028         * @return the label
029         */
030        public String getLabel();
031        
032        /**
033         * adds a task to the engine
034         * @param task
035         */
036        public void add(SpoolerTask task);
037        
038
039        /**
040         * remove that task from Spooler
041         * @param task
042         */
043        public void remove(SpoolerTask task);
044
045        /**
046         * remove a task that match given id
047         * @param id
048         */
049        public void remove(String id);
050
051        /**
052         * execute task by id and return error throwed by task
053         * @param id
054         * @throws SpoolerException
055         */
056        public PageException execute(String id);
057        
058        /**
059         * execute task and return error throwed by task
060         * @param task
061         * @throws SpoolerException
062         */
063        public PageException execute(SpoolerTask task);
064        
065        public Query getOpenTasksAsQuery(int startrow, int maxrow) throws PageException;
066
067        public Query getClosedTasksAsQuery(int startrow, int maxrow) throws PageException;
068
069        public Query getAllTasksAsQuery(int startrow, int maxrow) throws PageException;
070        
071        public int getOpenTaskCount();
072        
073        public int getClosedTaskCount();
074        
075        
076
077
078        //public void setLabel(String label);
079        //public void setPersisDirectory(Resource persisDirectory);
080        //public void setLog(Log log);
081        //public void setConfig(Config config);
082}