org.cdlib.xtf.textEngine
Class IndexValidator

Object
  extended by IndexValidator

public class IndexValidator
extends Object

This class performs the validation steps for a specified index, checking that the results are acceptable. This is used at index time to decide whether to rotate in a new index, and also by the servlets to "warm up" a new index before presenting it to the user.

Author:
Martin Haye

Nested Class Summary
static class IndexValidator.ValidationError
          Internal exception for quickly passing errors up the call chain.
 
Field Summary
private  TestableCrossQuery crossQuery
           
private  TestableDynaXML dynaXML
           
private  int nErrs
           
 
Constructor Summary
IndexValidator()
           
 
Method Summary
private  void traverse(EasyNode node, int level)
          Traverse the validation specification document, visiting each node.
 boolean validate(String baseDir, String indexPath, IndexReader indexReader)
          Run validations for the given index.
private  void visit(EasyNode node, int level)
          Process one node of the validation specification document.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

crossQuery

private TestableCrossQuery crossQuery

dynaXML

private TestableDynaXML dynaXML

nErrs

private int nErrs
Constructor Detail

IndexValidator

public IndexValidator()
Method Detail

validate

public boolean validate(String baseDir,
                        String indexPath,
                        IndexReader indexReader)
                 throws IOException
Run validations for the given index.

Parameters:
baseDir - XTF home directory
indexPath - path to the index data
indexReader - Lucene reader for the index
Returns:
true iff all validations passed
Throws:
IOException - if the index can't be read

traverse

private void traverse(EasyNode node,
                      int level)
               throws IndexValidator.ValidationError,
                      ServletException,
                      IOException
Traverse the validation specification document, visiting each node.

Throws:
IndexValidator.ValidationError
ServletException
IOException

visit

private void visit(EasyNode node,
                   int level)
            throws IndexValidator.ValidationError,
                   ServletException,
                   IOException
Process one node of the validation specification document.

Throws:
IndexValidator.ValidationError
ServletException
IOException