/** * Create a path that must exist in the cluster fs * @param uri uri to create * @return the path * @throws SliderException if the path does not exist */ public Path createPathThatMustExist(String uri) throws SliderException, IOException { Preconditions.checkNotNull(uri); Path path = new Path(uri); verifyPathExists(path); return path; }
/** * Create a path that must exist in the cluster fs * @param uri uri to create * @return the path * @throws SliderException if the path does not exist */ public Path createPathThatMustExist(String uri) throws SliderException, IOException { Preconditions.checkNotNull(uri); Path path = new Path(uri); verifyPathExists(path); return path; }
/** * Verify that a user has write access to a directory. * It does this by creating then deleting a temp file * * @param dirPath actual directory to look for * @throws FileNotFoundException file not found * @throws IOException trouble with FS * @throws BadClusterStateException if the directory is not writeable */ public void verifyDirectoryWriteAccess(Path dirPath) throws IOException, SliderException { verifyPathExists(dirPath); Path tempFile = new Path(dirPath, "tmp-file-for-checks"); try { FSDataOutputStream out ; out = fileSystem.create(tempFile, true); IOUtils.closeStream(out); fileSystem.delete(tempFile, false); } catch (IOException e) { log.warn("Failed to create file {}: {}", tempFile, e); throw new BadClusterStateException(e, "Unable to write to directory %s : %s", dirPath, e.toString()); } }
/** * Verify that a user has write access to a directory. * It does this by creating then deleting a temp file * * @param dirPath actual directory to look for * @throws FileNotFoundException file not found * @throws IOException trouble with FS * @throws BadClusterStateException if the directory is not writeable */ public void verifyDirectoryWriteAccess(Path dirPath) throws IOException, SliderException { verifyPathExists(dirPath); Path tempFile = new Path(dirPath, "tmp-file-for-checks"); try { FSDataOutputStream out ; out = fileSystem.create(tempFile, true); IOUtils.closeStream(out); fileSystem.delete(tempFile, false); } catch (IOException e) { log.warn("Failed to create file {}: {}", tempFile, e); throw new BadClusterStateException(e, "Unable to write to directory %s : %s", dirPath, e.toString()); } }
coreFS.verifyPathExists(componentClusterDir); } catch (IOException e) { throw new BadConfigException("external component " + component +
coreFS.verifyPathExists(componentClusterDir); } catch (IOException e) { throw new BadConfigException("external component " + component +