001    package railo.runtime.debug;
002    
003    import java.io.IOException;
004    import java.util.List;
005    
006    import railo.runtime.PageContext;
007    import railo.runtime.PageSource;
008    import railo.runtime.config.Config;
009    import railo.runtime.db.SQL;
010    import railo.runtime.exp.CatchBlock;
011    import railo.runtime.exp.PageException;
012    import railo.runtime.type.Query;
013    import railo.runtime.type.Struct;
014    
015    /**
016     * debugger interface
017     */
018    public interface Debugger {
019    
020        /**
021         * reset the debug object
022         */
023        public abstract void reset();
024    
025        /**
026         * @param pc current PagContext
027         * @param source Page Source for the entry
028         * @return returns a single DebugEntry 
029         */
030        public DebugEntryTemplate getEntry(PageContext pc,PageSource source);
031    
032        /**
033         * @param pc current PagContext
034         * @param source Page Source for the entry
035         * @param key 
036         * @return returns a single DebugEntry with a key
037         */
038        public DebugEntryTemplate getEntry(PageContext pc,PageSource source, String key);
039        
040        /**
041         * returns a single DebugEntry for a specific postion (startPos,endPos in the PageSource)
042         * @param pc current PagContext
043         * @param source Page Source for the entry
044         * @param startPos start position in the file
045         * @param endPos end position in the file
046         * @return
047         */
048        public DebugEntryTemplatePart getEntry(PageContext pc,PageSource source, int startPos, int endPos);
049    
050        /**
051         * add new query execution time
052         * @param query 
053         * @param datasource 
054         * @param name
055         * @param sql
056         * @param recordcount
057         * @param src
058         * @param time 
059         */
060        public void addQuery(Query query,String datasource,String name,SQL sql, int recordcount, PageSource src,int time); // FUTURE deprecated
061        // FUTURE public void addQuery(Query query,DataSource datasource,String name,SQL sql, int recordcount, PageSource src,int time);
062        
063        // FUTURE add ans set method above to deprecated -> public void addQuery(Query query,String datasource,String name,SQL sql, int recordcount, PageSource src,long time);
064        
065        /**
066         * sets if toHTML print html output info or not
067         * @param output The output to set.
068         */
069        public abstract void setOutput(boolean output);
070    
071        /**
072         * @return Returns the queries.
073         */
074        public List<QueryEntry> getQueries();
075    
076        /**
077         * @param pc
078         * @throws IOException 
079         */
080        public void writeOut(PageContext pc) throws IOException;
081        
082        /**
083         * returns the Debugging Info
084         * @return debugging Info
085         */
086        public Struct getDebuggingData(PageContext pc) throws PageException;
087        
088    
089        public Struct getDebuggingData(PageContext pc, boolean addAddionalInfo) throws PageException;
090    
091            /**
092             * adds ne Timer info to debug
093             * @param label
094             * @param exe
095             */
096            public DebugTimer addTimer(String label, long exe, String template);
097     
098            /**
099             * add new Trace to debug
100             * @param type
101             * @param category
102             * @param text
103             * @param page
104             * @param varName
105             * @param varValue
106             * @return debug trace object
107             */
108            public DebugTrace addTrace(int type, String category, String text, PageSource page, String varName, String varValue);
109            
110            public DebugTrace addTrace(int type, String category, String text, String template,int line,String action,String varName,String varValue);
111                    
112    
113            public abstract DebugTrace[] getTraces();
114    
115            public abstract void addException(Config config,PageException pe);
116            public CatchBlock[] getExceptions();
117            
118            public void addImplicitAccess(String scope, String name);
119    
120            public ImplicitAccess[] getImplicitAccesses(int scope, String name);
121            
122    }