public final class DirectoryProviderHelper extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
configurationExplicitlySetsLockFactory(Properties dirConfiguration) |
static FSDirectory |
createFSIndex(File indexDir,
Properties properties)
Creates an FSDirectory in provided directory and initializes
an index if not already existing.
|
static LockFactory |
createLockFactory(File indexDir,
Properties dirConfiguration)
Creates a LockFactory as selected in the configuration for the
DirectoryProvider.
|
static long |
getCopyBufferSize(String indexName,
Properties properties)
Users may configure the number of MB to use as
"chunk size" for large file copy operations performed
by DirectoryProviders.
|
static File |
getSourceDirectory(String indexName,
Properties properties,
boolean needWritePermissions)
Build a directory name out of a root and relative path, guessing the significant part
and checking for the file availability
|
static File |
getVerifiedIndexDir(String annotatedIndexName,
Properties properties,
boolean verifyIsWritable)
Verify the index directory exists and is writable,
or creates it if not existing.
|
static void |
initializeIndexIfNeeded(Directory directory)
Initialize the Lucene Directory if it isn't already.
|
static boolean |
isNativeLockingStrategy(Properties dirConfiguration) |
public static File getSourceDirectory(String indexName, Properties properties, boolean needWritePermissions)
indexName
- the name of the index (directory) to createproperties
- the configuration propertiesneedWritePermissions
- when true the directory will be tested for read-write permissions.public static FSDirectory createFSIndex(File indexDir, Properties properties) throws IOException
indexDir
- the directory where to write a new indexproperties
- the configuration propertiesFSDirectory
instanceIOException
- if an errorpublic static void initializeIndexIfNeeded(Directory directory)
directory
- the Directory to initializeSearchException
- in case of lock acquisition timeouts, IOException, or if a corrupt index is foundpublic static boolean configurationExplicitlySetsLockFactory(Properties dirConfiguration)
dirConfiguration
- the properties representing the configuration for this indextrue
if the configuration contains an override for the locking_strategypublic static boolean isNativeLockingStrategy(Properties dirConfiguration)
public static LockFactory createLockFactory(File indexDir, Properties dirConfiguration)
indexDir
- the directory to use to store locks, if needed by implementationdirConfiguration
- the configuration of current DirectoryProviderIOException
- if any.public static File getVerifiedIndexDir(String annotatedIndexName, Properties properties, boolean verifyIsWritable)
annotatedIndexName
- The index name declared on the @Indexed annotationproperties
- The properties may override the indexname.verifyIsWritable
- Verify the directory is writableSearchException
- if any.public static long getCopyBufferSize(String indexName, Properties properties)
indexName
- the index nameproperties
- the configuration propertiesCopyright © 2006-2015 Red Hat, Inc. All Rights Reserved