PyLucene 3.4.0-1 import
[pylucene.git] / java / org / apache / pylucene / store / PythonDirectory.java
1 /* ====================================================================
2  *   Licensed under the Apache License, Version 2.0 (the "License");
3  *   you may not use this file except in compliance with the License.
4  *   You may obtain a copy of the License at
5  *
6  *       http://www.apache.org/licenses/LICENSE-2.0
7  *
8  *   Unless required by applicable law or agreed to in writing, software
9  *   distributed under the License is distributed on an "AS IS" BASIS,
10  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  *   See the License for the specific language governing permissions and
12  *   limitations under the License.
13  * ====================================================================
14  */
15
16 package org.apache.pylucene.store;
17
18 import java.io.IOException;
19 import java.util.Collection;
20
21 import org.apache.lucene.store.Directory;
22 import org.apache.lucene.store.IndexInput;
23 import org.apache.lucene.store.IndexOutput;
24 import org.apache.lucene.store.LockFactory;
25
26
27 public class PythonDirectory extends Directory {
28
29     private long pythonObject;
30
31     public PythonDirectory(LockFactory factory)
32         throws IOException
33     {
34         setLockFactory(factory);
35     }
36
37     public void pythonExtension(long pythonObject)
38     {
39         this.pythonObject = pythonObject;
40     }
41     public long pythonExtension()
42     {
43         return this.pythonObject;
44     }
45
46     public void finalize()
47         throws Throwable
48     {
49         pythonDecRef();
50     }
51
52     public void sync(Collection<String> names)
53         throws IOException 
54     {
55         for (String name : names)
56             sync(name);
57     }
58
59     public native void pythonDecRef();
60
61     public native void close()
62         throws IOException;
63     public native IndexOutput createOutput(String name)
64         throws IOException;
65     public native void deleteFile(String name)
66         throws IOException;
67     public native boolean fileExists(String name)
68         throws IOException;
69     public native long fileLength(String name)
70         throws IOException;
71     public native long fileModified(String name)
72         throws IOException;
73     public native String[] listAll()
74         throws IOException;
75     public native IndexInput openInput(String name)
76         throws IOException;
77     public native IndexInput openInput(String name, int bufferSize)
78         throws IOException;
79     public native void touchFile(String name)
80         throws IOException;
81     public native void sync(String name) 
82         throws IOException;
83 }