Package org.apache.solr.core
Class StandardDirectoryFactory
- java.lang.Object
-
- org.apache.solr.core.DirectoryFactory
-
- org.apache.solr.core.CachingDirectoryFactory
-
- org.apache.solr.core.StandardDirectoryFactory
-
- All Implemented Interfaces:
Closeable,AutoCloseable,NamedListInitializedPlugin
- Direct Known Subclasses:
MMapDirectoryFactory,NIOFSDirectoryFactory,NRTCachingDirectoryFactory,SimpleFSDirectoryFactory
public class StandardDirectoryFactory extends CachingDirectoryFactory
Directory provider which mimics original SolrFSDirectorybased 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
coreContainer, dataHomePath, INDEX_W_TIMESTAMP_REGEX, IOCONTEXT_NO_CACHE, LOCK_TYPE_HDFS, LOCK_TYPE_NATIVE, LOCK_TYPE_NONE, LOCK_TYPE_SIMPLE, LOCK_TYPE_SINGLE
-
-
Constructor Summary
Constructors Constructor Description StandardDirectoryFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.lucene.store.Directorycreate(String path, org.apache.lucene.store.LockFactory lockFactory, DirectoryFactory.DirContext dirContext)Creates a new Directory for a given path.protected org.apache.lucene.store.LockFactorycreateLockFactory(String rawLockType)Creates a new LockFactory for a given path.booleanexists(String path)Returns true if a Directory exists for a given path in the underlying (stable) storage and contains at least one file.booleanisAbsolute(String path)booleanisPersistent()voidmove(org.apache.lucene.store.Directory fromDir, org.apache.lucene.store.Directory toDir, String fileName, org.apache.lucene.store.IOContext ioContext)Override for more efficient moves.Stringnormalize(String path)Normalize a given path.protected voidremoveDirectory(CachingDirectoryFactory.CacheValue cacheValue)voidrenameWithOverwrite(org.apache.lucene.store.Directory dir, String fileName, String toName)-
Methods inherited from class org.apache.solr.core.CachingDirectoryFactory
addCloseListener, close, deleteOldIndexDirectory, doneWithDirectory, get, getLivePaths, getPath, incRef, init, release, remove, remove, remove, remove, stripTrailingSlash
-
Methods inherited from class org.apache.solr.core.DirectoryFactory
cleanupOldIndexDirectories, empty, getBaseDir, getDataHome, initCoreContainer, isSharedStorage, searchersReserveCommitPoints, size, size, sizeOf, sizeOfDirectory
-
-
-
-
Method Detail
-
create
protected org.apache.lucene.store.Directory create(String path, org.apache.lucene.store.LockFactory lockFactory, DirectoryFactory.DirContext dirContext) throws IOException
Description copied from class:DirectoryFactoryCreates a new Directory for a given path.- Specified by:
createin classDirectoryFactory- Throws:
IOException- If there is a low-level I/O error.
-
createLockFactory
protected org.apache.lucene.store.LockFactory createLockFactory(String rawLockType) throws IOException
Description copied from class:DirectoryFactoryCreates a new LockFactory for a given path.- Specified by:
createLockFactoryin classDirectoryFactory- Parameters:
rawLockType- A string value as passed in config. Every factory should at least support 'none' to disable locking.- Throws:
IOException- If there is a low-level I/O error.
-
normalize
public String normalize(String path) throws IOException
Description copied from class:DirectoryFactoryNormalize a given path.- Overrides:
normalizein classCachingDirectoryFactory- Parameters:
path- to normalize- Returns:
- normalized path
- Throws:
IOException- on io error
-
exists
public boolean exists(String path) throws IOException
Description copied from class:DirectoryFactoryReturns true if a Directory exists for a given path in the underlying (stable) storage and contains at least one file. Note that the existence of aDirectoryObject as returned by a previous call to theDirectoryFactory.get(java.lang.String, org.apache.solr.core.DirectoryFactory.DirContext, java.lang.String)method (on the specifiedpath) is not enough to cause this method to return true. Some prior user of that Directory must have written & synced at least one file to that Directory (and at least one file must still exist)- Overrides:
existsin classCachingDirectoryFactory- Throws:
IOException- If there is a low-level I/O error.
-
isPersistent
public boolean isPersistent()
- Specified by:
isPersistentin classDirectoryFactory- Returns:
- true if data is kept after close.
-
isAbsolute
public boolean isAbsolute(String path)
- Overrides:
isAbsolutein classDirectoryFactory- Parameters:
path- the path to check- Returns:
- true if absolute, as in not relative
-
removeDirectory
protected void removeDirectory(CachingDirectoryFactory.CacheValue cacheValue) throws IOException
- Overrides:
removeDirectoryin classCachingDirectoryFactory- Throws:
IOException
-
move
public void move(org.apache.lucene.store.Directory fromDir, org.apache.lucene.store.Directory toDir, String fileName, org.apache.lucene.store.IOContext ioContext) throws IOExceptionOverride for more efficient moves. Intended for use with replication - use carefully - some Directory wrappers will cache files for example. You should firstDirectory.sync(java.util.Collection)any file that will be moved or avoid cached files through settings.- Overrides:
movein classDirectoryFactory- Throws:
IOException- If there is a low-level I/O error.
-
renameWithOverwrite
public void renameWithOverwrite(org.apache.lucene.store.Directory dir, String fileName, String toName) throws IOException- Overrides:
renameWithOverwritein classDirectoryFactory- Throws:
IOException
-
-