org.cdlib.xtf.textIndexer
Class IndexSync

Object
  extended by IndexSync

public class IndexSync
extends Object

Takes care of copying the differences between a source index and a dest index to make them exactly equal. Doesn't have to scan every data directory and lazy file, since it uses the DocSelCache to get an idea of the subset of things that actually need to be scanned.


Field Summary
private static SimpleDateFormat dateFormat
           
 
Constructor Summary
IndexSync()
           
 
Method Summary
private  SubDirFilter calcFilter(String indexName, File srcDir, File dstDir)
          Determine the sub-directory filter for directory scanning.
static String newestTime(File dir)
          Determine the newest file within a directory (or the dir itself if empty) and return a human-readable version of that time.
static String oldestTime(File dir)
          Determine the oldest file within a directory (or the dir itself if empty) and return a human-readable version of that time.
 void syncDirs(String indexName, File srcDir, File dstDir)
          Perform the minimum necessary work to ensure that the contents of dstDir exactly match srcDir.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateFormat

private static SimpleDateFormat dateFormat
Constructor Detail

IndexSync

public IndexSync()
Method Detail

syncDirs

public void syncDirs(String indexName,
                     File srcDir,
                     File dstDir)
              throws IOException
Perform the minimum necessary work to ensure that the contents of dstDir exactly match srcDir.

Parameters:
indexName -
Throws:
IOException - If anything goes wrong.

calcFilter

private SubDirFilter calcFilter(String indexName,
                                File srcDir,
                                File dstDir)
                         throws IOException
Determine the sub-directory filter for directory scanning. If the dst is an ancestor of src, we do intelligent filtering; otherwise we scan the whole thing.

Throws:
IOException - If anything goes wrong.

oldestTime

public static String oldestTime(File dir)
Determine the oldest file within a directory (or the dir itself if empty) and return a human-readable version of that time.


newestTime

public static String newestTime(File dir)
Determine the newest file within a directory (or the dir itself if empty) and return a human-readable version of that time.