use of org.apache.crail.metadata.FileInfo in project incubator-crail by apache.
the class CoreDataStore method _listEntries.
public DirectoryInputStream _listEntries(String name, boolean randomize) throws Exception {
FileName directory = new FileName(name);
if (CrailConstants.DEBUG) {
LOG.info("getDirectoryList: " + name);
}
RpcGetFile fileRes = rpcConnection.getFile(directory, false).get(CrailConstants.RPC_TIMEOUT, TimeUnit.MILLISECONDS);
if (fileRes.getError() != RpcErrors.ERR_OK) {
LOG.info("getDirectoryList: " + RpcErrors.messages[fileRes.getError()]);
throw new FileNotFoundException(RpcErrors.messages[fileRes.getError()]);
}
FileInfo dirInfo = fileRes.getFile();
if (!dirInfo.getType().isContainer()) {
LOG.info("getDirectoryList: " + RpcErrors.messages[RpcErrors.ERR_FILE_IS_NOT_DIR]);
throw new FileNotFoundException(RpcErrors.messages[RpcErrors.ERR_FILE_IS_NOT_DIR]);
}
CoreDirectory dirFile = new CoreDirectory(this, dirInfo, name);
DirectoryInputStream inputStream = dirFile.getDirectoryInputStream(randomize);
return inputStream;
}
Aggregations