本文整理汇总了Java中org.apache.hadoop.fs.FileSystem.resolvePath方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystem.resolvePath方法的具体用法?Java FileSystem.resolvePath怎么用?Java FileSystem.resolvePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.FileSystem
的用法示例。
在下文中一共展示了FileSystem.resolvePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseDistributedCacheArtifacts
import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
private static void parseDistributedCacheArtifacts(Configuration conf,
Map<String, LocalResource> localResources, LocalResourceType type, URI[] uris,
long[] timestamps, long[] sizes, boolean visibilities[]) throws IOException {
if (uris != null) {
// Sanity check
if ((uris.length != timestamps.length) || (uris.length != sizes.length)
|| (uris.length != visibilities.length)) {
throw new IllegalArgumentException("Invalid specification for "
+ "distributed-cache artifacts of type " + type + " :" + " #uris=" + uris.length
+ " #timestamps=" + timestamps.length + " #visibilities=" + visibilities.length);
}
for (int i = 0; i < uris.length; ++i) {
URI u = uris[i];
Path p = new Path(u);
FileSystem remoteFS = p.getFileSystem(conf);
p =
remoteFS
.resolvePath(p.makeQualified(remoteFS.getUri(), remoteFS.getWorkingDirectory()));
// Add URI fragment or just the filename
Path name = new Path((null == u.getFragment()) ? p.getName() : u.getFragment());
if (name.isAbsolute()) {
throw new IllegalArgumentException("Resource name must be relative");
}
String linkName = name.toUri().getPath();
LocalResource orig = localResources.get(linkName);
org.apache.hadoop.yarn.api.records.URL url = ConverterUtils.getYarnUrlFromURI(p.toUri());
if (orig != null && !orig.getResource().equals(url)) {
LOG.warn(getResourceDescription(orig.getType()) + toString(orig.getResource())
+ " conflicts with " + getResourceDescription(type) + toString(url)
+ " This will be an error in Hadoop 2.0");
continue;
}
localResources.put(linkName, LocalResource.newInstance(ConverterUtils.getYarnUrlFromURI(p
.toUri()), type, visibilities[i] ? LocalResourceVisibility.PUBLIC
: LocalResourceVisibility.PRIVATE, sizes[i], timestamps[i]));
}
}
}
示例2: parseDistributedCacheArtifacts
import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
private static void parseDistributedCacheArtifacts(
Configuration conf,
Map<String, LocalResource> localResources,
LocalResourceType type,
URI[] uris, long[] timestamps, long[] sizes, boolean visibilities[])
throws IOException {
if (uris != null) {
// Sanity check
if ((uris.length != timestamps.length) || (uris.length != sizes.length) ||
(uris.length != visibilities.length)) {
throw new IllegalArgumentException("Invalid specification for " +
"distributed-cache artifacts of type " + type + " :" +
" #uris=" + uris.length +
" #timestamps=" + timestamps.length +
" #visibilities=" + visibilities.length
);
}
for (int i = 0; i < uris.length; ++i) {
URI u = uris[i];
Path p = new Path(u);
FileSystem remoteFS = p.getFileSystem(conf);
p = remoteFS.resolvePath(p.makeQualified(remoteFS.getUri(),
remoteFS.getWorkingDirectory()));
// Add URI fragment or just the filename
Path name = new Path((null == u.getFragment())
? p.getName()
: u.getFragment());
if (name.isAbsolute()) {
throw new IllegalArgumentException("Resource name must be relative");
}
String linkName = name.toUri().getPath();
LocalResource orig = localResources.get(linkName);
org.apache.hadoop.yarn.api.records.URL url =
ConverterUtils.getYarnUrlFromURI(p.toUri());
if(orig != null && !orig.getResource().equals(url)) {
LOG.warn(
getResourceDescription(orig.getType()) +
toString(orig.getResource()) + " conflicts with " +
getResourceDescription(type) + toString(url) +
" This will be an error in Hadoop 2.0");
continue;
}
localResources.put(linkName, LocalResource.newInstance(ConverterUtils
.getYarnUrlFromURI(p.toUri()), type, visibilities[i]
? LocalResourceVisibility.PUBLIC : LocalResourceVisibility.PRIVATE,
sizes[i], timestamps[i]));
}
}
}
示例3: getResolvedPath
import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
private Path getResolvedPath(String dir) throws IOException {
Configuration conf = getConf();
Path dirPath = new Path(dir);
FileSystem fs = dirPath.getFileSystem(conf);
return fs.resolvePath(dirPath);
}