You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2013/10/05 01:46:23 UTC

svn commit: r1529350 - in /lucene/pylucene/trunk: java/org/apache/pylucene/store/PythonDirectory.java test/test_PythonDirectory.py

Author: vajda
Date: Fri Oct  4 23:46:23 2013
New Revision: 1529350

URL: http://svn.apache.org/r1529350
Log:
refreshed and fixed PythonDirectory failures

Modified:
    lucene/pylucene/trunk/java/org/apache/pylucene/store/PythonDirectory.java
    lucene/pylucene/trunk/test/test_PythonDirectory.py

Modified: lucene/pylucene/trunk/java/org/apache/pylucene/store/PythonDirectory.java
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/java/org/apache/pylucene/store/PythonDirectory.java?rev=1529350&r1=1529349&r2=1529350&view=diff
==============================================================================
--- lucene/pylucene/trunk/java/org/apache/pylucene/store/PythonDirectory.java (original)
+++ lucene/pylucene/trunk/java/org/apache/pylucene/store/PythonDirectory.java Fri Oct  4 23:46:23 2013
@@ -23,16 +23,15 @@ import org.apache.lucene.store.IOContext
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.store.LockFactory;
+import org.apache.lucene.store.Lock;
 
 
 public class PythonDirectory extends Directory {
 
     private long pythonObject;
 
-    public PythonDirectory(LockFactory factory)
-        throws IOException
+    public PythonDirectory()
     {
-        setLockFactory(factory);
     }
 
     public void pythonExtension(long pythonObject)
@@ -61,7 +60,7 @@ public class PythonDirectory extends Dir
 
     public native void close()
         throws IOException;
-    public native IndexOutput createOutput(String name, IOContext context) //new4.0
+    public native IndexOutput createOutput(String name, IOContext context)
         throws IOException;
     public native void deleteFile(String name)
         throws IOException;
@@ -73,11 +72,16 @@ public class PythonDirectory extends Dir
         throws IOException;
     public native String[] listAll()
         throws IOException;
-    public native IndexInput openInput(String name, IOContext context) //new4.0
+    public native IndexInput openInput(String name, IOContext context)
         throws IOException;
     public native void touchFile(String name)
         throws IOException;
     public native void sync(String name) 
         throws IOException;
-
+    public native LockFactory getLockFactory();
+    public native void setLockFactory(LockFactory lockFactory)
+        throws IOException;
+    public native void clearLock(String name)
+        throws IOException;
+    public native Lock makeLock(String name);
 }

Modified: lucene/pylucene/trunk/test/test_PythonDirectory.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test/test_PythonDirectory.py?rev=1529350&r1=1529349&r2=1529350&view=diff
==============================================================================
--- lucene/pylucene/trunk/test/test_PythonDirectory.py (original)
+++ lucene/pylucene/trunk/test/test_PythonDirectory.py Fri Oct  4 23:46:23 2013
@@ -160,8 +160,9 @@ class PythonFileStreamOutput(PythonIndex
 class PythonFileDirectory(PythonDirectory):
 
     def __init__(self, path):
-        super(PythonFileDirectory, self).__init__(PythonDirLockFactory(path))
+        super(PythonFileDirectory, self).__init__()
 
+        self._lockFactory = PythonDirLockFactory(path)
         self.name = path
         assert os.path.isdir(path)
         self.path = path
@@ -214,6 +215,18 @@ class PythonFileDirectory(PythonDirector
         file_path = os.path.join(self.path, name)
         os.utime(file_path, None)
 
+    def setLockFactory(self, lockFactory):
+        pass
+
+    def getLockFactory(self):
+        return None
+
+    def clearLock(self, name):
+        self._lockFactory.clearLock(name)
+
+    def makeLock(self, name):
+        return self._lockFactory.makeLock(name)
+
 
 if DEBUG:
     _globals = globals()