blob: 862c70da6e7b3f9818ba2ab23990d1c90ecd21c5 [file] [log] [blame]
diff --git a/lucene/core/src/java/org/apache/lucene/index/DirectoryBased.java b/lucene/core/src/java/org/apache/lucene/index/DirectoryBased.java
new file mode 100644
index 0000000..913a71d
--- /dev/null
+++ b/lucene/core/src/java/org/apache/lucene/index/DirectoryBased.java
@@ -0,0 +1,32 @@
+package org.apache.lucene.index;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.store.Directory;
+
+/**
+ * Marks {@link IndexReader}-s that are reading their data from
+ * {@link Directory}.
+ */
+public interface DirectoryBased {
+
+ /**
+ * Return {@link Directory} that is the source of data for this {@link IndexReader}.
+ */
+ public Directory directory();
+}
diff --git a/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java b/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java
index 6cb1c37..3b77d10 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java
@@ -54,7 +54,7 @@ import org.apache.lucene.store.Directory;
{@link AtomicReader}, see {@link #subReaders} and
{@link #getSequentialSubReaders}.
*/
-public abstract class DirectoryReader extends BaseMultiReader<AtomicReader> {
+public abstract class DirectoryReader extends BaseMultiReader<AtomicReader> implements DirectoryBased {
public static final int DEFAULT_TERMS_INDEX_DIVISOR = 1;
protected final Directory directory;