Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/directory/FSDirectoryManager.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/directory/FSDirectoryManager.java (revision 1414607)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/directory/FSDirectoryManager.java (working copy)
@@ -25,6 +25,7 @@
import org.apache.lucene.store.Lock;
import org.apache.lucene.store.LockFactory;
import org.apache.lucene.store.NativeFSLockFactory;
+import org.apache.lucene.store.SimpleFSDirectory;
import java.io.File;
import java.io.FileFilter;
@@ -41,11 +42,14 @@
*/
private File baseDir;
+ private boolean useSimpleFSDirectory;
+
/**
* {@inheritDoc}
*/
public void init(SearchIndex handler) throws IOException {
baseDir = new File(handler.getPath());
+ useSimpleFSDirectory = handler.isUseSimpleFSDirectory();
}
/**
@@ -66,7 +70,7 @@
} else {
dir = new File(baseDir, name);
}
- return new FSDir(dir);
+ return new FSDir(dir, useSimpleFSDirectory);
}
/**
@@ -140,14 +144,18 @@
private final FSDirectory directory;
- public FSDir(File dir) throws IOException {
+ public FSDir(File dir, boolean simpleFS) throws IOException {
if (!dir.mkdirs()) {
if (!dir.isDirectory()) {
throw new IOException("Unable to create directory: '" + dir + "'");
}
}
- directory = FSDirectory.open(dir,
- new NativeFSLockFactory(dir));
+ LockFactory lockFactory = new NativeFSLockFactory(dir);
+ if (simpleFS) {
+ directory = new SimpleFSDirectory(dir, lockFactory);
+ } else {
+ directory = FSDirectory.open(dir, lockFactory);
+ }
}
@Override
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java (revision 1414607)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java (working copy)
@@ -472,6 +472,14 @@
private DirectoryManager directoryManager;
/**
+ * Flat that indicates whether the {@link DirectoryManager} should
+ * use the SimpleFSDirectory instead of letting Lucene
+ * automatically pick an implementation based on the platform we are
+ * running on.
+ */
+ private boolean useSimpleFSDirectory = false;
+
+ /**
* The termInfosIndexDivisor.
*/
private int termInfosIndexDivisor = DEFAULT_TERM_INFOS_INDEX_DIVISOR;
@@ -2379,6 +2387,26 @@
}
/**
+ * If set true will indicate to the {@link DirectoryManager}
+ * to use the SimpleFSDirectory.
+ *
+ * @param useSimpleFSDirectory whether to use SimpleFSDirectory
+ * or automatically pick an implementation based
+ * on the current platform.
+ */
+ public void setUseSimpleFSDirectory(boolean useSimpleFSDirectory) {
+ this.useSimpleFSDirectory = useSimpleFSDirectory;
+ }
+
+ /**
+ * @return true if the {@link DirectoryManager} should use
+ * the SimpleFSDirectory.
+ */
+ public boolean isUseSimpleFSDirectory() {
+ return useSimpleFSDirectory;
+ }
+
+ /**
* @return the current value for termInfosIndexDivisor.
*/
public int getTermInfosIndexDivisor() {