Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@
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;

Expand Down Expand Up @@ -127,7 +126,7 @@ private void initialize() {
Executors.newFixedThreadPool(1, new NamedThreadFactory("load-directory-types"));
executorService.execute(
() -> {
for (String clazzName : supportedDirImpls()) {
for (String clazzName : IndexUtils.supportedDirectoryImpls()) {
dirImplCombo.addItem(clazzName);
}
});
Expand Down Expand Up @@ -254,10 +253,6 @@ private JPanel expertSettings() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
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;

/**
Expand Down Expand Up @@ -108,6 +110,17 @@ public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs)
}
}

/**
* 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.
*
Expand Down