long size = 0L;
String modified = null;
String path = null;
String identifier = null;
SQLiteStatement stmt = db.prepare("SELECT isDir, crawlid, fname, owner, groupowner, permissions, size, modified, path FROM Files WHERE Files.fid = ?");
try {
stmt.bind(1, fid);
if (stmt.step()) {
isDir = "True".equals(stmt.columnString(0));
crawlid = stmt.columnLong(1);
fname = stmt.columnString(2);
owner = stmt.columnString(3);
groupowner = stmt.columnString(4);
permissions = stmt.columnString(5);
size = stmt.columnLong(6);
modified = stmt.columnString(7);
path = stmt.columnString(8);
}
} finally {
stmt.dispose();
}
if (! isDir) {
stmt = db.prepare("SELECT typelabel FROM Types, TypeGuesses WHERE TypeGuesses.fid = ? AND Types.typeid = TypeGuesses.typeid");
try {
stmt.bind(1, fid);
if (stmt.step()) {
identifier = stmt.columnString(0);
}
} finally {
stmt.dispose();
}
stmt = db.prepare("SELECT Schemas.schemaid, Schemas.schemarepr, Schemas.schemasrcdescription, Schemas.schemapayload FROM Schemas, SchemaGuesses WHERE SchemaGuesses.fid = ? AND SchemaGuesses.schemaid = Schemas.schemaid");
try {
List<String> schemaReprs = new ArrayList<String>();
List<String> schemaDescs = new ArrayList<String>();
List<byte[]> schemaBlobs = new ArrayList<byte[]>();
stmt.bind(1, fid);
while (stmt.step()) {
schemaReprs.add(stmt.columnString(1));
schemaDescs.add(stmt.columnString(2));
schemaBlobs.add(stmt.columnBlob(3));
}
try {
DataDescriptor dd = formatAnalyzer.loadDataDescriptor(fs, new Path(path + fname), identifier, schemaReprs, schemaDescs, schemaBlobs);
fsd = new FileSummaryData(FSAnalyzer.this, true, fid, crawlid, fname, owner, groupowner, permissions, size, modified, path);
fsd.addCachedData(dd);
} catch (IOException iex) {
iex.printStackTrace();
return null;
}
} finally {
stmt.dispose();
}
} else {
fsd = new FileSummaryData(FSAnalyzer.this, false, fid, crawlid, fname, owner, groupowner, permissions, size, modified, path);
}
return fsd;