@Override
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
if (serverFileInfo == null) {
serverResourceInfo = null;
this.effectivePermissions = null;
FileInfo fi = new FileInfo(getName());
HDFSServer server = getServer();
if (server != null) {
try {
if (".project".equals(getName())) {
fi.setExists(getLocalFile().exists());
fi.setLength(getLocalFile().length());
} else {
ResourceInformation fileInformation = getClient().getResourceInformation(uri.getURI(), server.getUserId());
if (fileInformation != null) {
serverResourceInfo = fileInformation;
fi.setDirectory(fileInformation.isFolder());
fi.setExists(true);
fi.setLastModified(fileInformation.getLastModifiedTime());
fi.setLength(fileInformation.getSize());
fi.setName(fileInformation.getName());
String userId = server.getUserId();
List<String> groupIds = server.getGroupIds();
if (userId == null) {
userId = getDefaultUserId();
groupIds = getDefaultGroupIds();
}
fileInformation.updateEffectivePermissions(userId, groupIds);
this.effectivePermissions = fileInformation.getEffectivePermissions();
fi.setAttribute(EFS.ATTRIBUTE_OWNER_READ, fileInformation.getUserPermissions().read);
fi.setAttribute(EFS.ATTRIBUTE_OWNER_WRITE, fileInformation.getUserPermissions().write);
fi.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, fileInformation.getUserPermissions().execute);
fi.setAttribute(EFS.ATTRIBUTE_GROUP_READ, fileInformation.getGroupPermissions().read);
fi.setAttribute(EFS.ATTRIBUTE_GROUP_WRITE, fileInformation.getGroupPermissions().write);
fi.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, fileInformation.getGroupPermissions().execute);
fi.setAttribute(EFS.ATTRIBUTE_OTHER_READ, fileInformation.getOtherPermissions().read);
fi.setAttribute(EFS.ATTRIBUTE_OTHER_WRITE, fileInformation.getOtherPermissions().write);
fi.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, fileInformation.getOtherPermissions().execute);
}
}
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
} catch (InterruptedException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
} finally {
}
} else {
// No server definition
fi.setExists(false);
}
serverFileInfo = fi;
}
if (localFileInfo == null) {
if (isLocalFile()) {
File file = getLocalFile();
localFileInfo = new FileInfo(file.getName());
if (file.exists()) {
localFileInfo.setExists(true);
localFileInfo.setLastModified(file.lastModified());
localFileInfo.setLength(file.length());
localFileInfo.setDirectory(file.isDirectory());