/** * Starts the reindexing process * * @param args */ public static void main(String[] args) { startTime = new Date().getTime(); // Get the configuration filename if (args.length == 0) { System.out.println("Please enter the server to index as the first parameter"); System.exit(1); } serverName = args[0]; System.setProperty("reindex.process.serverName", serverName); initializeReindex(); // Runs the export process to extract marc records from the ILS (if applicable) runExportScript(); // Process all reords (marc records, econtent that has been added to the database, and // resources) ArrayList<IRecordProcessor> recordProcessors = loadRecordProcesors(); if (recordProcessors.size() > 0) { // Do processing of marc records with record processors loaded above. // includes indexing records // extracting eContent from records // Updating resource information // Saving records to strands - may need to move to resources if we are doing partial exports processMarcRecords(recordProcessors); // Process eContent records that have been saved to the database. processEContentRecords(recordProcessors); // Do processing of resources as needed (for extraction of resources). processResources(recordProcessors); for (IRecordProcessor processor : recordProcessors) { processor.finish(); } } // Send completion information endTime = new Date().getTime(); sendCompletionMessage(recordProcessors); logger.info("Finished Reindex for " + serverName); }
private static void sendCompletionMessage(ArrayList<IRecordProcessor> recordProcessors) { logger.info("Reindex Results"); logger.info( "Processor, Records Processed, eContent Processed, Resources Processed, Errors, Added, Updated, Deleted, Skipped"); for (IRecordProcessor curProcessor : recordProcessors) { ProcessorResults results = curProcessor.getResults(); logger.info(results.toCsv()); } long elapsedTime = endTime - startTime; float elapsedMinutes = (float) elapsedTime / (float) (60000); logger.info("Time elpased: " + elapsedMinutes + " minutes"); try { PreparedStatement finishedStatement = vufindConn.prepareStatement("UPDATE reindex_log SET endTime = ? WHERE id = ?"); finishedStatement.setLong(1, new Date().getTime() / 1000); finishedStatement.setLong(2, reindexLogId); finishedStatement.executeUpdate(); } catch (SQLException e) { logger.error("Unable to update reindex log with completion time.", e); } }