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