org.apache.lucene.store
Class BaseDirectory

java.lang.Object
  extended by org.apache.lucene.store.Directory
      extended by org.apache.lucene.store.BaseDirectory
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
CompoundFileDirectory, FileSwitchDirectory, FSDirectory, RAMDirectory

public abstract class BaseDirectory
extends Directory

Base implementation for a concrete Directory.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.store.Directory
Directory.IndexInputSlicer
 
Field Summary
protected  boolean isOpen
           
protected  LockFactory lockFactory
          Holds the LockFactory instance (implements locking for this Directory instance).
 
Constructor Summary
protected BaseDirectory()
          Sole constructor.
 
Method Summary
 void clearLock(String name)
          Attempt to clear (forcefully unlock and remove) the specified lock.
protected  void ensureOpen()
           
 LockFactory getLockFactory()
          Get the LockFactory that this Directory instance is using for its locking implementation.
 Lock makeLock(String name)
          Construct a Lock.
 void setLockFactory(LockFactory lockFactory)
          Set the LockFactory that this Directory instance should use for its locking implementation.
 
Methods inherited from class org.apache.lucene.store.Directory
close, copy, createOutput, createSlicer, deleteFile, fileExists, fileLength, getLockID, listAll, openInput, sync, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isOpen

protected volatile boolean isOpen

lockFactory

protected LockFactory lockFactory
Holds the LockFactory instance (implements locking for this Directory instance).

Constructor Detail

BaseDirectory

protected BaseDirectory()
Sole constructor.

Method Detail

makeLock

public Lock makeLock(String name)
Description copied from class: Directory
Construct a Lock.

Specified by:
makeLock in class Directory
Parameters:
name - the name of the lock file

clearLock

public void clearLock(String name)
               throws IOException
Description copied from class: Directory
Attempt to clear (forcefully unlock and remove) the specified lock. Only call this at a time when you are certain this lock is no longer in use.

Specified by:
clearLock in class Directory
Parameters:
name - name of the lock to be cleared.
Throws:
IOException

setLockFactory

public void setLockFactory(LockFactory lockFactory)
                    throws IOException
Description copied from class: Directory
Set the LockFactory that this Directory instance should use for its locking implementation. Each * instance of LockFactory should only be used for one directory (ie, do not share a single instance across multiple Directories).

Specified by:
setLockFactory in class Directory
Parameters:
lockFactory - instance of LockFactory.
Throws:
IOException

getLockFactory

public LockFactory getLockFactory()
Description copied from class: Directory
Get the LockFactory that this Directory instance is using for its locking implementation. Note that this may be null for Directory implementations that provide their own locking implementation.

Specified by:
getLockFactory in class Directory

ensureOpen

protected final void ensureOpen()
                         throws AlreadyClosedException
Overrides:
ensureOpen in class Directory
Throws:
AlreadyClosedException - if this Directory is closed


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.