Skip to content

Code Primer

haschart edited this page Nov 30, 2016 · 3 revisions

The Top-level classes that run SolrMarc are in the package org.solrmarc.driver

  • Boot.java -- The top-level Main routine that dynamically loads the required jars, and then call the main routine specified as the first command line argument

  • BootableMain.java -- The base class for main routines that can be called by the Boot class. Does all of the command-line argument processing, and additional dynamic jar loading.

  • ConfigDriver.java -- A backwards-compatibiity driver program. Reads an old-style config.properties file, and builds the correct command-line to call the IndexDriver class.

  • IndexDriver.java -- Uses the command-line arguments to create a MarcReader, a collection of AbstractValueIndexer objects, and a SolrProxy object and then passes them to the Indexer class.

  • Indexer.java -- The single-threaded reference implementation of the indexing process. Reads a record, builds the SolrInputDocument, and sends it to the SolrProxy.

  • ThreadedIndexer.java -- The multi-threaded, producer-consumer implementation of the Indexer class, AKA where the magic happens.

  • MarcReaderThread.java -- Used by ThreadedIndexer. Reads records, puts them in the readQ queue.

  • IndexerWorker.java -- Used by ThreadedIndexer. Takes a record from the readQ queue, processes the index specifications to produce a SolrInputDocument, puts that in docQ queue.

  • ChunkIndexerWorker.java -- Used by ThreadedIndexer. Takes a chunk of SolrInputDocuments from the docQ queue, send them to Solr.

  • RecordAndDoc.java -- Used by the Indexing Queues, consists of a Record and a SolrInputDocument.

The heart of the index specification processing in in the package org.solrmarc.index.indexer

  • ValueIndexerFactory.java -- The primary driver for reading index specifications, and building AbstractValueIndexer objects. A global singleton instance.

  • FullScanner.lex -- The Jflex specification for the lexical tokenizer of the Index Specification Parser.

  • FullConditionalParser.cup -- The Java Cup specification for the LALR parser generator

  • VerboseSymbolFactory.java -- Used by the parser and scanner in debug mode.

  • FullConditionalParser.java -- generated Java code for the LALR parser.

  • FullConditionalScanner.java -- generated Java code for the JFlex tokenizer.

  • FullSym.java -- generated Java code used by the parser and scanner.

  • IndexerSpecException.java -- A runtime exception that can be used to indicate a problem with the Index Specification

  • AbstractValueIndexer.java -- The abstract class created by the ValueIndexerFactory for each Index Specification.

  • MultiValueIndexer.java -- The concrete implementation of AbstractValueIndexer, consists of a MultiValue Extractor, zero or more MultiValue maps, plus a MultiValue collector.