public File getFile(String name) { if (name == null) { throw new NullPointerException("name must not be null"); } Future<Path> future = cacheCopyTasks.get(name); if (future == null) { throw new IllegalArgumentException("File with name '" + name + "' is not available." + " Did you forget to register the file?"); } try { final Path path = future.get(); URI tmp = path.makeQualified(path.getFileSystem()).toUri(); return new File(tmp); } catch (ExecutionException e) { throw new RuntimeException("An error occurred while copying the file.", e.getCause()); } catch (Exception e) { throw new RuntimeException("Error while getting the file registered under '" + name + "' from the distributed cache", e); } }
@Test public void testMakeQualified() throws IOException { // make relative path qualified String path = "test/test"; Path p = new Path(path).makeQualified(FileSystem.getLocalFileSystem()); URI u = p.toUri(); assertEquals("file", u.getScheme()); assertEquals(null, u.getAuthority()); String q = new Path(FileSystem.getLocalFileSystem().getWorkingDirectory().getPath(), path).getPath(); assertEquals(q, u.getPath()); // make absolute path qualified path = "/test/test"; p = new Path(path).makeQualified(FileSystem.getLocalFileSystem()); u = p.toUri(); assertEquals("file", u.getScheme()); assertEquals(null, u.getAuthority()); assertEquals(path, u.getPath()); } }
tempFile.deleteOnExit(); expectedFiles.add(new Path(tempFile.getAbsolutePath()).makeQualified(FileSystem.getLocalFileSystem()).toString());
public File getFile(String name) { if (name == null) { throw new NullPointerException("name must not be null"); } Future<Path> future = cacheCopyTasks.get(name); if (future == null) { throw new IllegalArgumentException("File with name '" + name + "' is not available." + " Did you forget to register the file?"); } try { final Path path = future.get(); URI tmp = path.makeQualified(path.getFileSystem()).toUri(); return new File(tmp); } catch (ExecutionException e) { throw new RuntimeException("An error occurred while copying the file.", e.getCause()); } catch (Exception e) { throw new RuntimeException("Error while getting the file registered under '" + name + "' from the distributed cache", e); } }
public File getFile(String name) { if (name == null) { throw new NullPointerException("name must not be null"); } Future<Path> future = cacheCopyTasks.get(name); if (future == null) { throw new IllegalArgumentException("File with name '" + name + "' is not available." + " Did you forget to register the file?"); } try { final Path path = future.get(); URI tmp = path.makeQualified(path.getFileSystem()).toUri(); return new File(tmp); } catch (ExecutionException e) { throw new RuntimeException("An error occurred while copying the file.", e.getCause()); } catch (Exception e) { throw new RuntimeException("Error while getting the file registered under '" + name + "' from the distributed cache", e); } }
if (fs.mkdirs(path)) { final Path qp = path.makeQualified(fs);
if (fs.mkdirs(path)) { final Path qp = path.makeQualified(fs);
if (fs.mkdirs(path)) { final Path qp = path.makeQualified(fs);
Path checkpointDirPath = new Path(haStoragePath, UUID.randomUUID().toString()); if (checkpointDirPath.toUri().getScheme() == null) { checkpointDirPath = checkpointDirPath.makeQualified(checkpointDirPath.getFileSystem());
Path checkpointDirPath = new Path(haStoragePath, UUID.randomUUID().toString()); if (checkpointDirPath.toUri().getScheme() == null) { checkpointDirPath = checkpointDirPath.makeQualified(checkpointDirPath.getFileSystem());
metadataFileStatus.getPath(), metadataFileStatus.getLen()); final String pointer = checkpointDir.makeQualified(fs).toString();
metadataFileStatus.getPath(), metadataFileStatus.getLen()); final String pointer = checkpointDir.makeQualified(fs).toString();
metadataFileStatus.getPath(), metadataFileStatus.getLen()); final String pointer = checkpointDir.makeQualified(fs).toString();