com.konakartadmin.utils
Class SqlAnalysis

java.lang.Object
  extended by com.konakartadmin.utils.SqlAnalysis

public class SqlAnalysis
extends java.lang.Object

Analyses the SQL collected in the specified input file For file that's specified must be a KonaKart log file that had the following log flags set: log4j.logger.org.apache.torque.util.BasePeer = DEBUG


Nested Class Summary
 class SqlAnalysis.SqlStatement
          Holds details of the SqlStatement
 
Field Summary
private static int DEFAULT_TOP_N
           
 java.lang.String endingText
          ending text
 java.lang.String inputFileName
          input file name
static org.apache.commons.logging.Log log
          logger
 long maxTime
          maximum time found for single query
 java.lang.String outputFileName
          output file name
 java.lang.String startText
          starting text
 int topN
          topN statements
(package private) static java.lang.String usage
           
 
Constructor Summary
SqlAnalysis()
           
 
Method Summary
 boolean analyseSql()
          Analyses the SQL collected in the specified input file
 java.lang.String getEndingText()
           
 java.lang.String getInputFileName()
           
 java.lang.String getOutputFileName()
           
 java.lang.String getStartText()
           
 int getTopN()
           
static void main(java.lang.String[] args)
           
 void setEndingText(java.lang.String endingText)
           
 void setInputFileName(java.lang.String inputFileName)
           
 void setOutputFileName(java.lang.String outputFileName)
           
 void setStartText(java.lang.String startText)
           
 void setTopN(int topN)
           
 void sqlAnalysis(java.lang.String[] args)
          Analyse the SQL logging in the specified file
private  void writeResults(java.io.BufferedWriter bw, java.util.Map<java.lang.String,SqlAnalysis.SqlStatement> sqlHash, java.lang.String headingMean, java.lang.String headingTotal)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static org.apache.commons.logging.Log log
logger


DEFAULT_TOP_N

private static final int DEFAULT_TOP_N
See Also:
Constant Field Values

usage

static final java.lang.String usage
See Also:
Constant Field Values

startText

public java.lang.String startText
starting text


endingText

public java.lang.String endingText
ending text


inputFileName

public java.lang.String inputFileName
input file name


outputFileName

public java.lang.String outputFileName
output file name


topN

public int topN
topN statements


maxTime

public long maxTime
maximum time found for single query

Constructor Detail

SqlAnalysis

public SqlAnalysis()
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args -

sqlAnalysis

public void sqlAnalysis(java.lang.String[] args)
Analyse the SQL logging in the specified file

Parameters:
args - command line arguments

analyseSql

public boolean analyseSql()
                   throws KKAdminException,
                          java.io.IOException
Analyses the SQL collected in the specified input file

Returns:
true if the file was parsed successfully otherwise false
Throws:
KKAdminException - if the file could not be found
java.io.IOException - if the files could not be read or written

writeResults

private void writeResults(java.io.BufferedWriter bw,
                          java.util.Map<java.lang.String,SqlAnalysis.SqlStatement> sqlHash,
                          java.lang.String headingMean,
                          java.lang.String headingTotal)
                   throws java.io.IOException
Throws:
java.io.IOException

getInputFileName

public java.lang.String getInputFileName()
Returns:
the inputFileName

setInputFileName

public void setInputFileName(java.lang.String inputFileName)
Parameters:
inputFileName - the inputFileName to set

getOutputFileName

public java.lang.String getOutputFileName()
Returns:
the outputFileName

setOutputFileName

public void setOutputFileName(java.lang.String outputFileName)
Parameters:
outputFileName - the outputFileName to set

getTopN

public int getTopN()
Returns:
the topN

setTopN

public void setTopN(int topN)
Parameters:
topN - the topN to set

getStartText

public java.lang.String getStartText()
Returns:
the startText

setStartText

public void setStartText(java.lang.String startText)
Parameters:
startText - the startText to set

getEndingText

public java.lang.String getEndingText()
Returns:
the endingText

setEndingText

public void setEndingText(java.lang.String endingText)
Parameters:
endingText - the endingText to set


Copyright © 2011 DS Data Systems UK Ltd.