def readGrinderOutFile(self, summaryData, reportDir):
     # reset the test directory
     # TODO this logic does not belong in a method named 'readGrinderOutFile' !
     if path.isdir(reportDir):
         logger.warn("Deleting previous report directory '" + reportDir + "'.")
         shutil.rmtree(reportDir)
     if path.isfile(reportDir):
         logger.warn("Pre-existing file '" + reportDir + "' collides with report dir name.  Deleting.")
         os.remove(reportDir)
     os.mkdir(reportDir)
     templates = MavenUtilities.getCurrentDir() + os.sep + classpathtool.GA_NAME + os.sep + "templates" 
     shutil.copytree(templates, reportDir + os.sep + "templates")
     analyzerPlugin = ga.constants.VORPAL.getPlugin("analyzer")
     # add the configured response time thresholds to the analyzer columns
     if CONFIG.useThresholds and len(CONFIG.rtimeThresholds) > 0:
         numberFormat = NumberFormat.getNumberInstance()
         list = CONFIG.rtimeThresholds            
         thresholds = list[:len(list) - 1]
         # the first group
         colName = "under %s sec" % numberFormat.format(thresholds[0])
         analyzerPlugin.addColumnName(colName)
         # the middle groups
         if len(thresholds) > 1:
             for i in range(len(thresholds) - 1):
                 colName = "%s to %s sec" % (numberFormat.format(thresholds[i]), numberFormat.format(thresholds[i + 1]))
                 analyzerPlugin.addColumnName(colName)
         # the last group
         name = "over %s sec" % numberFormat.format(thresholds[len(thresholds) - 1])
         analyzerPlugin.addColumnName(name)
     logger.warn("Starting log analysis.")
     for line in summaryData.getTestDataLines():
         if CONFIG.isShowTransactionData():
             if line.startswith("Test") or line.startswith("(Test"):
                 row = self.getRow(line)
                 logger.debug("Adding row name %s" % row.getTxName())
                 analyzerPlugin.addDataRow(row)
         if line.startswith("Totals"):
             analyzerPlugin.setTotalsRow(self.getRow(line, True))
# You should have received a copy of the GNU General Public License
# along with Grinder Analyzer; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import os
import classpathtool 

from org.jtmb.grinderAnalyzer import Configuration
from org.jtmb.velocityMerger import VelocityMerger
from org.apache.log4j import *
from org.apache.log4j import PropertyConfigurator

from java.util import Properties

from com.fides import MavenUtilities


def _getProperties_():
    # vPlugin.analyzer=org.jtmb.grinderAnalyzer.HTTPTestPlugin
    props = CONFIG.startupProperties
    props.put("vPlugin.analyzer", "org.jtmb.grinderAnalyzer.GAVelocityPlugin")
    return props

CONFIG_FILE = MavenUtilities.getCurrentDir() + os.sep + classpathtool.GA_NAME + os.sep + "conf/analyzer.properties"

# Log4j must be configured before the VelocityMerger classes
# are instantiated.
PropertyConfigurator.configure(CONFIG_FILE)
CONFIG=Configuration(CONFIG_FILE)
VORPAL=VelocityMerger(_getProperties_())
import os
import sys

from com.fides import MavenUtilities


# Ensure we're on jython and not cpython
if os.name != 'java':
    print "FATAL: cpython is not supported. This program must be invoked with jython 2.2.1 or later."
    sys.exit(1)


# Try to find the grinder analyzer dir.
GA_NAME="jython"

fullCurrentDir = MavenUtilities.getCurrentDir()+os.sep+GA_NAME

#set from java
cdir=os.path.split(fullCurrentDir)[1]

if cdir.find(GA_NAME) != 0:
#    if not fullCurrentDir.endswith("grinderAnalyzer/scripts"):
        print "FATAL: This program can only be run from within the %s directory." %GA_NAME
        print "Current dir: %s, cdir: %s" %(os.getcwd(),cdir)
        sys.exit(1)

# Set the classpath
libDir=fullCurrentDir+os.sep+"lib"

# Import modules from plugin jar file
commons_collection_jar = MavenUtilities.getPluginAbsolutePath(