LUCENE-10287: Re-add abstract FSDirectory class as a supported directory (#522)

This commit is contained in:
Tomoko Uchida 2021-12-07 15:32:12 +09:00 committed by GitHub
parent 8525356c8a
commit 35eff443a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View File

@ -55,9 +55,8 @@ import org.apache.lucene.luke.app.desktop.util.FontUtils;
import org.apache.lucene.luke.app.desktop.util.MessageUtils;
import org.apache.lucene.luke.app.desktop.util.StyleConstants;
import org.apache.lucene.luke.models.LukeException;
import org.apache.lucene.luke.models.util.IndexUtils;
import org.apache.lucene.luke.util.LoggerFactory;
import org.apache.lucene.store.MMapDirectory;
import org.apache.lucene.store.NIOFSDirectory;
import org.apache.lucene.util.NamedThreadFactory;
import org.apache.lucene.util.SuppressForbidden;
@ -127,7 +126,7 @@ public final class OpenIndexDialogFactory implements DialogOpener.DialogFactory
Executors.newFixedThreadPool(1, new NamedThreadFactory("load-directory-types"));
executorService.execute(
() -> {
for (String clazzName : supportedDirImpls()) {
for (String clazzName : IndexUtils.supportedDirectoryImpls()) {
dirImplCombo.addItem(clazzName);
}
});
@ -254,10 +253,6 @@ public final class OpenIndexDialogFactory implements DialogOpener.DialogFactory
return panel;
}
private String[] supportedDirImpls() {
return new String[] {MMapDirectory.class.getName(), NIOFSDirectory.class.getName()};
}
private JPanel buttons() {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
panel.setOpaque(false);

View File

@ -47,6 +47,8 @@ import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.LockFactory;
import org.apache.lucene.store.MMapDirectory;
import org.apache.lucene.store.NIOFSDirectory;
import org.apache.lucene.util.Bits;
/**
@ -108,6 +110,17 @@ public final class IndexUtils {
}
}
/**
* Returns supported {@link Directory} implementations.
*
* @return class names of supported directory implementation
*/
public static String[] supportedDirectoryImpls() {
return new String[] {
FSDirectory.class.getName(), MMapDirectory.class.getName(), NIOFSDirectory.class.getName()
};
}
/**
* Opens an index directory for given index path.
*