checker.configureLog();
    public static void main(String[] args)    {        // set up command line parser        CommandLineParser parser = new PosixParser();        CommandLine line = null;        // create an options object and populate it        Options options = new Options();        options.addOption("l", "looping", false, "Loop once through bitstreams");        options.addOption("L", "continuous", false,                "Loop continuously through bitstreams");        options.addOption("h", "help", false, "Help");        options.addOption("d", "duration", true, "Checking duration");        options.addOption("c", "count", true, "Check count");        options.addOption("a", "handle", true, "Specify a handle to check");        options.addOption("v", "verbose", false, "Report all processing");        OptionBuilder.withArgName("bitstream-ids").hasArgs().withDescription(                "Space separated list of bitstream ids");        Option useBitstreamIds = OptionBuilder.create('b');        options.addOption(useBitstreamIds);        options.addOption("p", "prune", false, "Prune configuration file");        options                .addOption(OptionBuilder                        .withArgName("prune")                        .hasOptionalArgs(1)                        .withDescription(                                "Prune old results (optionally using specified properties file for configuration)")                        .create('p'));        try        {            line = parser.parse(options, args);        }        catch (ParseException e)        {            LOG.fatal(e);            System.exit(1);        }        // user asks for help        if (line.hasOption('h'))        {            printHelp(options);        }        // Prune stage        if (line.hasOption('p'))        {            ResultsPruner rp = null;            try            {                rp = (line.getOptionValue('p') != null) ? ResultsPruner                        .getPruner(line.getOptionValue('p')) : ResultsPruner                        .getDefaultPruner();            }            catch (FileNotFoundException e)            {                e.printStackTrace();                System.exit(1);            }            int count = rp.prune();            System.out.println("Pruned " + count                    + " old results from the database.");        }        Date processStart = Calendar.getInstance().getTime();        BitstreamDispatcher dispatcher = null;                // process should loop infinitely through        // most_recent_checksum table        if (line.hasOption('l'))        {            dispatcher = new SimpleDispatcher(new BitstreamInfoDAO(), processStart, false);         }        else if (line.hasOption('L'))        {            dispatcher = new SimpleDispatcher(new BitstreamInfoDAO(), processStart, true);        }        else if (line.hasOption('b'))        {            // check only specified bitstream(s)            String[] ids = line.getOptionValues('b');            List idList = new ArrayList(ids.length);            for (int i = 0; i < ids.length; i++)            {                try                {                    idList.add(new Integer(ids[i]));                }                catch (NumberFormatException nfe)                {                    System.err.println("The following argument: " + ids[i]                            + " is not an integer");                    System.exit(0);                }            }            dispatcher = new ListDispatcher(idList);        }        else if (line.hasOption('a'))        {            dispatcher = new HandleDispatcher(new BitstreamInfoDAO(), line.getOptionValue('a'));        }        else if (line.hasOption('d'))        {            // run checker process for specified duration            try            {                dispatcher = new LimitedDurationDispatcher(                        new SimpleDispatcher(new BitstreamInfoDAO(), processStart, true), new Date(                                System.currentTimeMillis()                                        + Utils.parseDuration(line                                                .getOptionValue('d'))));            }            catch (Exception e)            {                LOG.fatal("Couldn't parse " + line.getOptionValue('d')                        + " as a duration: ", e);                System.exit(0);            }        }        else if (line.hasOption('c'))        {        	int count = new Integer(line.getOptionValue('c')).intValue();                    	// run checker process for specified number of bitstreams            dispatcher = new LimitedCountDispatcher(new SimpleDispatcher(                    new BitstreamInfoDAO(), processStart, false), count);        }        else        {            dispatcher = new LimitedCountDispatcher(new SimpleDispatcher(                    new BitstreamInfoDAO(), processStart, false), 1);        }                ResultsLogger logger = new ResultsLogger(processStart);        CheckerCommand checker = new CheckerCommand();        // verbose reporting        if (line.hasOption('v'))        {            checker.setReportVerbose(true);        }        checker.configureLog();        checker.setProcessStartDate(processStart);        checker.setDispatcher(dispatcher);        checker.setCollector(logger);        checker.process();    }