/**
   * Constructor for the class.
   *
   * @param args command line arguments into the program - see class description
   */
  public SimpleQuestionRunCPE(String args[]) throws Exception {
    mStartTime = System.currentTimeMillis();
    if (args.length == 0) {
      args = new String[1];
      args[0] = new String("src/main/resources/CpeQuestionDescriptor.xml");
    }

    // check command line args
    if (args.length < 1) {
      printUsageMessage();
      System.exit(1);
    }

    // parse CPE descriptor
    System.out.println("Parsing CPE Descriptor");
    CpeDescription cpeDesc =
        UIMAFramework.getXMLParser().parseCpeDescription(new XMLInputSource(args[0]));
    // instantiate CPE
    System.out.println("Instantiating CPE");
    mCPE = UIMAFramework.produceCollectionProcessingEngine(cpeDesc);

    // Create and register a Status Callback Listener
    mCPE.addStatusCallbackListener(new StatusCallbackListenerImpl());

    // Start Processing
    System.out.println("Running CPE");
    mCPE.process();

    // Allow user to abort by pressing Enter
    System.out.println("To abort processing, type \"abort\" and press enter.");
    while (true) {
      String line = new BufferedReader(new InputStreamReader(System.in)).readLine();
      if ("abort".equals(line) && mCPE.isProcessing()) {
        System.out.println("Aborting...");
        mCPE.stop();
        break;
      }
    }
  }