Skip to content

Commit

Permalink
LUCENE-10287: Re-add abstract FSDirectory class as a supported direct…
Browse files Browse the repository at this point in the history
…ory (#522)
  • Loading branch information
mocobeta committed Dec 7, 2021
1 parent 892e324 commit 3eadfd4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
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

0 comments on commit 3eadfd4

Please sign in to comment.