lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sh...@apache.org
Subject svn commit: r939649 - in /lucene/dev/trunk/lucene: CHANGES.txt src/java/org/apache/lucene/index/DirectoryReader.java src/java/org/apache/lucene/index/IndexCommit.java src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java
Date Fri, 30 Apr 2010 12:07:19 GMT
Author: shaie
Date: Fri Apr 30 12:07:19 2010
New Revision: 939649

URL: http://svn.apache.org/viewvc?rev=939649&view=rev
Log:
LUCENE-2417: changed IndexCommit methods to abstract

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexCommit.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=939649&r1=939648&r2=939649&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Fri Apr 30 12:07:19 2010
@@ -284,8 +284,9 @@ Bug fixes
   called.  (Ruben Laguna, Uwe Schindler, Mike McCandless)
   
 * LUCENE-2417: IndexCommit did not implement hashCode() and equals() 
-  consitently. Now they both take Directory and version into consideration. 
-  (Shai Erera)
+  consitently. Now they both take Directory and version into consideration. In
+  addition, all of IndexComnmit methods which threw 
+  UnsupportedOperationException are now abstract. (Shai Erera)
 
 * LUCENE-2424: Fix FieldDoc.toString to actually return its fields
   (Stephen Green via Mike McCandless)

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DirectoryReader.java?rev=939649&r1=939648&r2=939649&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DirectoryReader.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DirectoryReader.java Fri Apr
30 12:07:19 2010
@@ -1125,6 +1125,11 @@ class DirectoryReader extends IndexReade
     public Map<String,String> getUserData() {
       return userData;
     }
+
+    @Override
+    public void delete() {
+      throw new UnsupportedOperationException("This IndexCommit does not support deletions");
+    }
   }
   
   // @deprecated This is pre-flex API

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexCommit.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexCommit.java?rev=939649&r1=939648&r2=939649&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexCommit.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexCommit.java Fri Apr 30 12:07:19
2010
@@ -70,24 +70,14 @@ public abstract class IndexCommit {
    * and therefore this should only be called by its {@link IndexDeletionPolicy#onInit onInit()}
or 
    * {@link IndexDeletionPolicy#onCommit onCommit()} methods.
   */
-  public void delete() {
-    throw new UnsupportedOperationException("This IndexCommit does not support this method.");
-  }
+  public abstract void delete();
 
-  public boolean isDeleted() {
-    throw new UnsupportedOperationException("This IndexCommit does not support this method.");
-  }
+  public abstract boolean isDeleted();
 
-  /**
-   * Returns true if this commit is an optimized index.
-   */
-  public boolean isOptimized() {
-    throw new UnsupportedOperationException("This IndexCommit does not support this method.");
-  }
+  /** Returns true if this commit is an optimized index. */
+  public abstract boolean isOptimized();
 
-  /**
-   * Two IndexCommits are equal if both their Directory and versions are equal.
-   */
+  /** Two IndexCommits are equal if both their Directory and versions are equal. */
   @Override
   public boolean equals(Object other) {
     if (other instanceof IndexCommit) {
@@ -105,15 +95,11 @@ public abstract class IndexCommit {
   /** Returns the version for this IndexCommit.  This is the
    *  same value that {@link IndexReader#getVersion} would
    *  return if it were opened on this commit. */
-  public long getVersion() {
-    throw new UnsupportedOperationException("This IndexCommit does not support this method.");
-  }
+  public abstract long getVersion();
 
   /** Returns the generation (the _N in segments_N) for this
    *  IndexCommit */
-  public long getGeneration() {
-    throw new UnsupportedOperationException("This IndexCommit does not support this method.");
-  }
+  public abstract long getGeneration();
 
   /** Convenience method that returns the last modified time
    *  of the segments_N file corresponding to this index
@@ -126,7 +112,6 @@ public abstract class IndexCommit {
   /** Returns userData, previously passed to {@link
    *  IndexWriter#commit(Map)} for this commit.  Map is
    *  String -> String. */
-  public Map<String,String> getUserData() throws IOException {
-    throw new UnsupportedOperationException("This IndexCommit does not support this method.");
-  }
+  public abstract Map<String,String> getUserData() throws IOException;
+  
 }

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java?rev=939649&r1=939648&r2=939649&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java Fri
Apr 30 12:07:19 2010
@@ -132,6 +132,10 @@ public class SnapshotDeletionPolicy impl
     public Map<String,String> getUserData() throws IOException {
       return cp.getUserData();
     }
+    @Override
+    public boolean isOptimized() {
+      return cp.isOptimized();
+    }
   }
 
   private List<IndexCommit> wrapCommits(List<? extends IndexCommit> commits)
{



Mime
View raw message