Methods Summary |
---|
public void | close()
flush();
|
public org.apache.lucene.store.IndexOutput | createOutput(java.lang.String name)
return new JEIndexOutput(this, name, true);
|
public void | deleteFile(java.lang.String name)
new File(name).delete(this);
|
public boolean | fileExists(java.lang.String name)
return new File(name).exists(this);
|
public long | fileLength(java.lang.String name)
File file = new File(name);
if (file.exists(this))
return file.getLength();
throw new IOException("File does not exist: " + name);
|
public long | fileModified(java.lang.String name)
File file = new File(name);
if (file.exists(this))
return file.getTimeModified();
throw new IOException("File does not exist: " + name);
|
public void | flush()Flush the currently open files. After they have been flushed it is safe
to commit the transaction without closing this DbDirectory instance
first.
Iterator iterator = openFiles.iterator();
while (iterator.hasNext()) {
System.out
.println(((JEIndexOutput) iterator.next()).file.getName());
// ((IndexOutput) iterator.next()).flush();
}
|
public java.lang.String[] | list()
Cursor cursor = null;
List list = new ArrayList();
try {
try {
DatabaseEntry key = new DatabaseEntry(new byte[0]);
DatabaseEntry data = new DatabaseEntry(null);
data.setPartial(true);
// TODO see if cursor needs configuration
cursor = files.openCursor(txn, null);
// TODO see if LockMode should be set
if (cursor.getNext(key, data, null) != OperationStatus.NOTFOUND) {
ByteArrayInputStream buffer = new ByteArrayInputStream(key
.getData());
DataInputStream in = new DataInputStream(buffer);
String name = in.readUTF();
in.close();
list.add(name);
while (cursor.getNext(key, data, null) != OperationStatus.NOTFOUND) {
buffer = new ByteArrayInputStream(key.getData());
in = new DataInputStream(buffer);
name = in.readUTF();
in.close();
list.add(name);
}
}
} finally {
if (cursor != null)
cursor.close();
}
} catch (DatabaseException e) {
throw new IOException(e.getMessage());
}
return (String[]) list.toArray(new String[list.size()]);
|
public org.apache.lucene.store.Lock | makeLock(java.lang.String name)
return new JELock();
|
public org.apache.lucene.store.IndexInput | openInput(java.lang.String name)
return new JEIndexInput(this, name);
|
public void | renameFile(java.lang.String from, java.lang.String to)
new File(from).rename(this, to);
|
public void | setTransaction(com.sleepycat.je.Transaction txn)Once a transaction handle was committed it is no longer valid. In order
to continue using this JEDirectory instance after a commit, the
transaction handle has to be replaced.
this.txn = txn;
|
public void | touchFile(java.lang.String name)
File file = new File(name);
long length = 0L;
if (file.exists(this))
length = file.getLength();
file.modify(this, length, System.currentTimeMillis());
|