/**
  * XSLT Import Tool
  *
  * @return void
  */
 public function importXslAction()
 {
     // Parse switches:
     $this->consoleOpts->addRules(array('test-only' => 'Use test mode', 'index-s' => 'Solr index to use'));
     $testMode = $this->consoleOpts->getOption('test-only') ? true : false;
     $index = $this->consoleOpts->getOption('index');
     if (empty($index)) {
         $index = 'Solr';
     }
     // Display help message if parameters missing:
     $argv = $this->consoleOpts->getRemainingArgs();
     if (!isset($argv[1])) {
         Console::writeLine("Usage: import-xsl.php [--test-only] [--index <type>] " . "XML_file properties_file");
         Console::writeLine("\tXML_file - source file to index");
         Console::writeLine("\tproperties_file - import configuration file");
         Console::writeLine("If the optional --test-only flag is set, " . "transformed XML will be displayed");
         Console::writeLine("on screen for debugging purposes, " . "but it will not be indexed into VuFind.");
         Console::writeLine("");
         Console::writeLine("If the optional --index parameter is set, " . "it must be followed by the name of");
         Console::writeLine("a class for accessing Solr; it defaults to the " . "standard Solr class, but could");
         Console::writeLine("be overridden with, for example, SolrAuth to " . "load authority records.");
         Console::writeLine("");
         Console::writeLine("Note: See vudl.properties and ojs.properties " . "for configuration examples.");
         return $this->getFailureResponse();
     }
     // Try to import the document if successful:
     try {
         $importer = new Importer();
         $importer->setServiceLocator($this->getServiceLocator());
         $importer->save($argv[0], $argv[1], $index, $testMode);
     } catch (\Exception $e) {
         Console::writeLine("Fatal error: " . $e->getMessage());
         return $this->getFailureResponse();
     }
     if (!$testMode) {
         Console::writeLine("Successfully imported {$argv[0]}...");
     }
     return $this->getSuccessResponse();
 }
 /**
  * Support method -- perform an XML import.
  *
  * @param string $xml        XML file to load
  * @param string $properties Configuration file to load
  * @param string $index      Name of backend to write to
  * @param bool   $testMode   Use test mode?
  *
  * @return void
  */
 protected function performImport($xml, $properties, $index = 'Solr', $testMode = false)
 {
     $importer = new Importer();
     $importer->setServiceLocator($this->getServiceLocator());
     $importer->save($xml, $properties, $index, $testMode);
 }