org.cdlib.xtf.textEngine
Class FlippingDirectory

Object
  extended by Directory
      extended by FlippingDirectory

public class FlippingDirectory
extends Directory

Represents a Lucene directory in every way except that it allows the underlying directory pointer to be flipped. This facilitates warming a directory in the background before flipping it to the foreground.

Author:
Martin Haye

Field Summary
private  Directory wrapped
           
 
Fields inherited from class Directory
lockFactory
 
Constructor Summary
FlippingDirectory(Directory toWrap)
          Wrap a directory to start with
 
Method Summary
 void clearLock(String name)
           
 void close()
           
 IndexOutput createOutput(String name)
           
 void deleteFile(String name)
           
 boolean fileExists(String name)
           
 long fileLength(String name)
           
 long fileModified(String name)
           
 void flipTo(Directory other)
          Switch to a different underlying directory.
 LockFactory getLockFactory()
           
 String getLockID()
           
 String[] list()
           
 Lock makeLock(String name)
           
 IndexInput openInput(String name)
           
 void renameFile(String from, String to)
           
 void setLockFactory(LockFactory lockFactory)
           
 void touchFile(String name)
           
 
Methods inherited from class Directory
copy
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wrapped

private Directory wrapped
Constructor Detail

FlippingDirectory

public FlippingDirectory(Directory toWrap)
Wrap a directory to start with

Method Detail

flipTo

public void flipTo(Directory other)
Switch to a different underlying directory. Note that it should still contain the same files, and thus should be the old directory with a simply a different name.


clearLock

public void clearLock(String name)
               throws IOException
Overrides:
clearLock in class Directory
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in class Directory
Throws:
IOException

createOutput

public IndexOutput createOutput(String name)
                         throws IOException
Specified by:
createOutput in class Directory
Throws:
IOException

deleteFile

public void deleteFile(String name)
                throws IOException
Specified by:
deleteFile in class Directory
Throws:
IOException

fileExists

public boolean fileExists(String name)
                   throws IOException
Specified by:
fileExists in class Directory
Throws:
IOException

fileLength

public long fileLength(String name)
                throws IOException
Specified by:
fileLength in class Directory
Throws:
IOException

fileModified

public long fileModified(String name)
                  throws IOException
Specified by:
fileModified in class Directory
Throws:
IOException

getLockFactory

public LockFactory getLockFactory()
Overrides:
getLockFactory in class Directory

getLockID

public String getLockID()
Overrides:
getLockID in class Directory

list

public String[] list()
              throws IOException
Specified by:
list in class Directory
Throws:
IOException

makeLock

public Lock makeLock(String name)
Overrides:
makeLock in class Directory

openInput

public IndexInput openInput(String name)
                     throws IOException
Specified by:
openInput in class Directory
Throws:
IOException

renameFile

public void renameFile(String from,
                       String to)
                throws IOException
Specified by:
renameFile in class Directory
Throws:
IOException

setLockFactory

public void setLockFactory(LockFactory lockFactory)
Overrides:
setLockFactory in class Directory

touchFile

public void touchFile(String name)
               throws IOException
Specified by:
touchFile in class Directory
Throws:
IOException