@Override public GridGgfsSecondaryInputStreamDescriptor onSuccess( Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo info = infos.get(path); if (info == null) throw new GridGgfsFileNotFoundException("File not found: " + path); if (!info.isFile()) throw new GridGgfsInvalidPathException("Failed to open file (not a file): " + path); return new GridGgfsSecondaryInputStreamDescriptor(infos.get(path), fs.open(path, bufSize)); }
@Override public GridGgfsSecondaryInputStreamDescriptor onSuccess( Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo info = infos.get(path); if (info == null) throw new GridGgfsFileNotFoundException("File not found: " + path); if (!info.isFile()) throw new GridGgfsInvalidPathException("Failed to open file (not a file): " + path); return new GridGgfsSecondaryInputStreamDescriptor(infos.get(path), fs.open(path, bufSize)); }
/** {@inheritDoc} */ @Override public void setTimes(GridGgfsPath path, long accessTime, long modificationTime) throws GridException { if (busyLock.enterBusy()) { try { A.notNull(path, "path"); if (accessTime == -1 && modificationTime == -1) return; FileDescriptor desc = getFileDescriptor(path); if (desc == null) { checkConflictWithPrimary(path); throw new GridGgfsFileNotFoundException("Failed to update times (path not found): " + path); } // Cannot update times for root. if (desc.parentId == null) return; meta.updateTimes(desc.parentId, desc.fileId, desc.fileName, accessTime, modificationTime); } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to set file times because Grid is stopping."); }
/** {@inheritDoc} */ @Override public void setTimes(GridGgfsPath path, long accessTime, long modificationTime) throws GridException { if (enterBusy()) { try { A.notNull(path, "path"); if (accessTime == -1 && modificationTime == -1) return; FileDescriptor desc = getFileDescriptor(path); if (desc == null) { checkConflictWithPrimary(path); throw new GridGgfsFileNotFoundException("Failed to update times (path not found): " + path); } // Cannot update times for root. if (desc.parentId == null) return; meta.updateTimes(desc.parentId, desc.fileId, desc.fileName, accessTime, modificationTime); } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to set file times because Grid is stopping."); }
checkConflictWithPrimary(path); throw new GridGgfsFileNotFoundException("Failed to list files (path not found): " + path);
checkConflictWithPrimary(path); throw new GridGgfsFileNotFoundException("Failed to list files (path not found): " + path);
/** {@inheritDoc} */ @Override public GridGgfsPathSummary summary(GridGgfsPath path) throws GridException { if (busyLock.enterBusy()) { try { A.notNull(path, "path"); if (log.isDebugEnabled()) log.debug("Calculating path summary: " + path); GridUuid fileId = meta.fileId(path); if (fileId == null) throw new GridGgfsFileNotFoundException("Failed to get path summary (path not found): " + path); GridGgfsPathSummary sum = new GridGgfsPathSummary(path); summary0(fileId, sum); return sum; } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to get path summary because Grid is stopping."); }
/** {@inheritDoc} */ @Override public GridGgfsPathSummary summary(GridGgfsPath path) throws GridException { if (enterBusy()) { try { A.notNull(path, "path"); if (log.isDebugEnabled()) log.debug("Calculating path summary: " + path); GridUuid fileId = meta.fileId(path); if (fileId == null) throw new GridGgfsFileNotFoundException("Failed to get path summary (path not found): " + path); GridGgfsPathSummary sum = new GridGgfsPathSummary(path); summary0(fileId, sum); return sum; } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to get path summary because Grid is stopping."); }
throw new GridGgfsFileNotFoundException("Failed to read file block (file was concurrently " + "deleted) [path=" + path + ", blockIdx=" + blockIdx + ']');
throw new GridGgfsFileNotFoundException("Failed to read file block (file was concurrently " + "deleted) [path=" + path + ", blockIdx=" + blockIdx + ']');
throw new GridGgfsFileNotFoundException("Failed to rename (source path not found): " + src); throw new GridGgfsFileNotFoundException("Failed to rename (destination path not found): " + dest);
throw new GridGgfsFileNotFoundException("Failed to rename (source path not found): " + src); throw new GridGgfsFileNotFoundException("Failed to rename (destination path not found): " + dest);
checkConflictWithPrimary(path); throw new GridGgfsFileNotFoundException("Failed to list files (path not found): " + path);
/** * @param errCode Error code. * @param err Error. * @throws GridException Based on error code. */ public static void throwError(Integer errCode, String err) throws GridException { assert err != null; assert errCode != -1; if (errCode == ERR_FILE_NOT_FOUND) throw new GridGgfsFileNotFoundException(err); else if (errCode == ERR_PATH_ALREADY_EXISTS) throw new GridGgfsPathAlreadyExistsException(err); else if (errCode == ERR_DIRECTORY_NOT_EMPTY) throw new GridGgfsDirectoryNotEmptyException(err); else if (errCode == ERR_PARENT_NOT_DIRECTORY) throw new GridGgfsParentNotDirectoryException(err); else if (errCode == ERR_INVALID_HDFS_VERSION) throw new GridGgfsInvalidHdfsVersionException(err); else if (errCode == ERR_CORRUPTED_FILE) throw new GridGgfsCorruptedFileException(err); else if (errCode == ERR_GGFS_GENERIC) throw new GridGgfsException(err); throw new GridException(err); }
/** * @param errCode Error code. * @param err Error. * @throws GridException Based on error code. */ public static void throwError(Integer errCode, String err) throws GridException { assert err != null; assert errCode != -1; if (errCode == ERR_FILE_NOT_FOUND) throw new GridGgfsFileNotFoundException(err); else if (errCode == ERR_PATH_ALREADY_EXISTS) throw new GridGgfsPathAlreadyExistsException(err); else if (errCode == ERR_DIRECTORY_NOT_EMPTY) throw new GridGgfsDirectoryNotEmptyException(err); else if (errCode == ERR_PARENT_NOT_DIRECTORY) throw new GridGgfsParentNotDirectoryException(err); else if (errCode == ERR_INVALID_HDFS_VERSION) throw new GridGgfsInvalidHdfsVersionException(err); else if (errCode == ERR_CORRUPTED_FILE) throw new GridGgfsCorruptedFileException(err); else if (errCode == ERR_GGFS_GENERIC) throw new GridGgfsException(err); throw new GridException(err); }
throw new GridGgfsFileNotFoundException("File not found: " + path);
throw new GridGgfsFileNotFoundException("File not found: " + path);
throw new GridGgfsFileNotFoundException("Failed to lock parent directory (not found): " + parentId);
throw new GridGgfsFileNotFoundException("Failed to lock parent directory (not found): " + parentId);
checkConflictWithPrimary(path); throw new GridGgfsFileNotFoundException("File not found: " + path);