当前位置: 首页>>代码示例>>Java>>正文


Java FileSystem.resolvePath方法代码示例

本文整理汇总了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]));
    }
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:41,代码来源:AngelApps.java

示例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]));
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:52,代码来源:MRApps.java

示例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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:DFSck.java


注:本文中的org.apache.hadoop.fs.FileSystem.resolvePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。