FileDocCategorySizeDatePackage
Driver.javaAPI DocApache Lucene 2.1.03912Wed Feb 14 10:46:16 GMT 2007org.apache.lucene.benchmark

Driver

public class Driver extends Object
Sets up the

Fields Summary
private File
workingDir
private Benchmarker
benchmarker
private BenchmarkOptions
options
Constructors Summary
public Driver()

    
public Driver(Benchmarker benchmarker, BenchmarkOptions options)

        this.benchmarker = benchmarker;
        this.options = options;
    
public Driver(File workingDir, InputSource inputSource)
Creates a Driver using Digester

param
inputSource

        Digester digester = new Digester();
        digester.setValidating(false);
        digester.addObjectCreate("benchmark/benchmarker", "class", StandardBenchmarker.class);
        digester.addSetProperties("benchmark/benchmarker");
        digester.addSetNext("benchmark/benchmarker", "setBenchmarker");
        digester.addObjectCreate("benchmark/options", "class", BenchmarkOptions.class);
        digester.addSetProperties("benchmark/options");
        digester.addSetNext("benchmark/options", "setOptions");
        digester.push(this);
        digester.parse(inputSource);
        this.workingDir = workingDir;
    
Methods Summary
public BenchmarkergetBenchmarker()

        return benchmarker;
    
public BenchmarkOptionsgetOptions()

        return options;
    
public java.io.FilegetWorkingDir()

        return workingDir;
    
public static voidmain(java.lang.String[] args)


        if (args.length != 2)
        {
            printHelp(args);
            System.exit(0);
        }
        File workingDir = new File(args[0]);
        File configFile = new File(args[1]);
        if (configFile.exists())
        {
            //Setup
            try
            {
                Driver driver = new Driver(workingDir, new InputSource(new FileReader(configFile)));
                driver.run();
            }
            catch (Exception e)
            {
                e.printStackTrace(System.err);
            }
        }

    
private static voidprintHelp(java.lang.String[] args)

        System.out.println("Usage: java -cp [...] " + Driver.class.getName() + "<working dir> <config-file>");
    
private voidrun()

        TestData [] data = benchmarker.benchmark(workingDir, options);
        //Print out summary:
        /*System.out.println("Test Data:");
        for (int i = 0; i < data.length; i++)
        {
            TestData testData = data[i];
            System.out.println("---------------");
            System.out.println(testData.showRunData(testData.getId()));
            System.out.println("---------------");
        }*/

    
public voidsetBenchmarker(Benchmarker benchmarker)

        this.benchmarker = benchmarker;
    
public voidsetOptions(BenchmarkOptions options)

        this.options = options;
    
public voidsetWorkingDir(java.io.File workingDir)

        this.workingDir = workingDir;