org.hibernate.search.store
Class DirectoryProviderHelper
java.lang.Object
org.hibernate.search.store.DirectoryProviderHelper
public class DirectoryProviderHelper
- extends Object
- Author:
- Emmanuel Bernard, Sanne Grinovero
Method Summary |
static org.apache.lucene.store.FSDirectory |
createFSIndex(File indexDir)
Creates an FSDirectory in provided directory if not already existing. |
static long |
getCopyBufferSize(String directoryProviderName,
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 directoryProviderName,
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYBUFFERSIZE_PROP_NAME
public static final String COPYBUFFERSIZE_PROP_NAME
- See Also:
- Constant Field Values
DirectoryProviderHelper
public DirectoryProviderHelper()
getSourceDirectory
public static File getSourceDirectory(String directoryProviderName,
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
- Parameters:
directoryProviderName
- properties
- needWritePermissions
- when true the directory will be tested for read-write permissions.
- Returns:
- The file representing the source directory
createFSIndex
public static org.apache.lucene.store.FSDirectory createFSIndex(File indexDir)
throws IOException
- Creates an FSDirectory in provided directory if not already existing.
- Parameters:
indexDir
- The directory where to write a new index
- Returns:
- the created FSDirectory
- Throws:
IOException
getVerifiedIndexDir
public static File getVerifiedIndexDir(String annotatedIndexName,
Properties properties,
boolean verifyIsWritable)
- Verify the index directory exists and is writable,
or creates it if not existing.
- Parameters:
annotatedIndexName
- The index name declared on the @Indexed annotationproperties
- The properties may override the indexname.verifyIsWritable
- Verify the directory is writable
- Returns:
- the File representing the Index Directory
- Throws:
SearchException
getCopyBufferSize
public static long getCopyBufferSize(String directoryProviderName,
Properties properties)
- Users may configure the number of MB to use as
"chunk size" for large file copy operations performed
by DirectoryProviders.
- Parameters:
directoryProviderName
- properties
-
- Returns:
- the number of Bytes to use as "chunk size" in file copy operations.