public class StandardDirectoryFactory extends CachingDirectoryFactory
FSDirectory
based behavior.
File based DirectoryFactory implementations generally extend
this class.CachingDirectoryFactory.CacheValue, CachingDirectoryFactory.CloseListener
DirectoryFactory.DirContext
byDirectoryCache, byPathCache, closeListeners, removeEntries
coreContainer, INDEX_W_TIMESTAMP_REGEX, IOCONTEXT_NO_CACHE, LOCK_TYPE_HDFS, LOCK_TYPE_NATIVE, LOCK_TYPE_NONE, LOCK_TYPE_SIMPLE, LOCK_TYPE_SINGLE
Constructor and Description |
---|
StandardDirectoryFactory() |
Modifier and Type | Method and Description |
---|---|
protected Directory |
create(String path,
LockFactory lockFactory,
DirectoryFactory.DirContext dirContext)
Creates a new Directory for a given path.
|
protected LockFactory |
createLockFactory(String rawLockType)
Creates a new LockFactory 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) |
void |
renameWithOverwrite(Directory dir,
String fileName,
String toName) |
addCloseListener, close, deleteOldIndexDirectory, doneWithDirectory, get, getLivePaths, getPath, incRef, init, release, remove, remove, remove, remove, stripTrailingSlash
cleanupOldIndexDirectories, empty, getBaseDir, getDataHome, initCoreContainer, isSharedStorage, offerMBeans, searchersReserveCommitPoints, size, size, sizeOf, sizeOfDirectory
protected Directory create(String path, LockFactory lockFactory, DirectoryFactory.DirContext dirContext) throws IOException
DirectoryFactory
create
in class DirectoryFactory
IOException
- If there is a low-level I/O error.protected LockFactory createLockFactory(String rawLockType) throws IOException
DirectoryFactory
createLockFactory
in class DirectoryFactory
rawLockType
- A string value as passed in config. Every factory should at least support 'none' to disable locking.IOException
- If there is a low-level I/O error.public String normalize(String path) throws IOException
DirectoryFactory
normalize
in class CachingDirectoryFactory
path
- to normalizeIOException
- on io errorpublic boolean exists(String path) throws IOException
DirectoryFactory
exists
in class CachingDirectoryFactory
IOException
- If there is a low-level I/O error.public boolean isPersistent()
isPersistent
in class DirectoryFactory
public boolean isAbsolute(String path)
isAbsolute
in class DirectoryFactory
path
- the path to checkprotected void removeDirectory(CachingDirectoryFactory.CacheValue cacheValue) throws IOException
removeDirectory
in class CachingDirectoryFactory
IOException
public void move(Directory fromDir, Directory toDir, String fileName, IOContext ioContext) throws IOException
Directory.sync(java.util.Collection)
any file that will be
moved or avoid cached files through settings.move
in class DirectoryFactory
IOException
- If there is a low-level I/O error.public void renameWithOverwrite(Directory dir, String fileName, String toName) throws IOException
renameWithOverwrite
in class DirectoryFactory
IOException
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.