org.apache.solr.core
Class StandardDirectoryFactory

java.lang.Object
  extended by org.apache.solr.core.DirectoryFactory
      extended by org.apache.solr.core.CachingDirectoryFactory
          extended by org.apache.solr.core.StandardDirectoryFactory
All Implemented Interfaces:
Closeable, NamedListInitializedPlugin
Direct Known Subclasses:
MMapDirectoryFactory, NIOFSDirectoryFactory, NRTCachingDirectoryFactory, SimpleFSDirectoryFactory

public class StandardDirectoryFactory
extends CachingDirectoryFactory

Directory provider which mimics original Solr FSDirectory based behavior. File based DirectoryFactory implementations generally extend this class.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.solr.core.CachingDirectoryFactory
CachingDirectoryFactory.CacheValue, CachingDirectoryFactory.CloseListener
 
Nested classes/interfaces inherited from class org.apache.solr.core.DirectoryFactory
DirectoryFactory.DirContext
 
Field Summary
 
Fields inherited from class org.apache.solr.core.CachingDirectoryFactory
byDirectoryCache, byPathCache, closeListeners, removeEntries
 
Fields inherited from class org.apache.solr.core.DirectoryFactory
IOCONTEXT_NO_CACHE
 
Constructor Summary
StandardDirectoryFactory()
           
 
Method Summary
protected  Directory create(String path, DirectoryFactory.DirContext dirContext)
          Creates a new Directory for a given path.
 boolean exists(String path)
          Returns true if a Directory exists for a given path.
 boolean isAbsolute(String path)
           
 boolean isPersistent()
           
 void move(Directory fromDir, Directory toDir, String fileName, IOContext ioContext)
          Override for more efficient moves.
 String normalize(String path)
          Normalize a given path.
protected  void removeDirectory(CachingDirectoryFactory.CacheValue cacheValue)
           
 
Methods inherited from class org.apache.solr.core.CachingDirectoryFactory
addCloseListener, close, doneWithDirectory, get, get, getPaths, incRef, init, release, remove, remove, remove, remove
 
Methods inherited from class org.apache.solr.core.DirectoryFactory
empty, sizeOf, sizeOfDirectory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardDirectoryFactory

public StandardDirectoryFactory()
Method Detail

create

protected Directory create(String path,
                           DirectoryFactory.DirContext dirContext)
                    throws IOException
Description copied from class: DirectoryFactory
Creates a new Directory for a given path.

Specified by:
create in class CachingDirectoryFactory
Throws:
IOException - If there is a low-level I/O error.

normalize

public String normalize(String path)
                 throws IOException
Description copied from class: DirectoryFactory
Normalize a given path.

Overrides:
normalize in class CachingDirectoryFactory
Parameters:
path - to normalize
Returns:
normalized path
Throws:
IOException - on io error

exists

public boolean exists(String path)
               throws IOException
Description copied from class: DirectoryFactory
Returns true if a Directory exists for a given path.

Overrides:
exists in class CachingDirectoryFactory
Throws:
IOException - If there is a low-level I/O error.

isPersistent

public boolean isPersistent()
Specified by:
isPersistent in class DirectoryFactory
Returns:
true if data is kept after close.

isAbsolute

public boolean isAbsolute(String path)
Overrides:
isAbsolute in class DirectoryFactory
Parameters:
path - the path to check
Returns:
true if absolute, as in not relative

removeDirectory

protected void removeDirectory(CachingDirectoryFactory.CacheValue cacheValue)
                        throws IOException
Overrides:
removeDirectory in class CachingDirectoryFactory
Throws:
IOException

move

public void move(Directory fromDir,
                 Directory toDir,
                 String fileName,
                 IOContext ioContext)
          throws IOException
Override for more efficient moves. Intended for use with replication - use carefully - some Directory wrappers will cache files for example. This implementation works with two wrappers: NRTCachingDirectory and RateLimitedDirectoryWrapper. You should first Directory.sync(java.util.Collection) any file that will be moved or avoid cached files through settings.

Overrides:
move in class DirectoryFactory
Throws:
IOException - If there is a low-level I/O error.


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