Example #1
0
        public void Execute(
      String[] filePaths,
      ILogManager logManager,
      IStreamReaderFactory streamReaderFactory,
      IRecordReader recordReader,
      IRecordMatchExpression expression,
      IRecordWriter recordWriter,
      IStatisticsCollector statisticsCollector,
      IStatisticsReporter statisticsReporter)
        {
            logManager.VerifyThatObjectIsNotNull("Parameter 'logManager' is null.");

              try
              {
            this.logManager = logManager;

            statisticsCollector.VerifyThatObjectIsNotNull("Parameter 'statisticsCollector' is null.");
            this.statisticsCollector = statisticsCollector;

            statisticsReporter.VerifyThatObjectIsNotNull("Parameter 'statisticsReporter' is null.");
            this.statisticsReporter = statisticsReporter;

            this.logManager.WriteMessagesToLogs("Run Started...");

            Action<IStreamReader, Record> writeMatchedRecordMethod, writeUnmatchedRecordMethod;
            this.DetermineOutputMethods(recordWriter, out writeMatchedRecordMethod, out writeUnmatchedRecordMethod);

            this.Process(filePaths, streamReaderFactory, recordReader, expression, writeMatchedRecordMethod, writeUnmatchedRecordMethod);

            recordWriter.Close();

            this.statisticsReporter.WriteToLog(this.logManager);

            this.logManager.WriteMessagesToLogs("Run Finished.");
              }
              catch (Exception exception)
              {
            logManager.WriteMessageToApplicationLog("EXCEPTION: " + exception.Message);
            logManager.WriteMessageToApplicationLog("STACK: " + exception.StackTrace);
            throw exception;
              }
        }