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


Java FileSystem.getUri方法代码示例

本文整理汇总了Java中org.apache.hadoop.fs.FileSystem.getUri方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystem.getUri方法的具体用法?Java FileSystem.getUri怎么用?Java FileSystem.getUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.fs.FileSystem的用法示例。


在下文中一共展示了FileSystem.getUri方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUri

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
/**
 * 此方法用于获取文件的 Uri
 *
 * @param fileSystemInfo
 *            文件系统信息
 * @return Uri
 */
public static URI getUri(FileSystemInfo fileSystemInfo) {
	FileSystem fs = getFileSystem(fileSystemInfo);
	try {
		return fs.getUri();
	} finally {
		closeFileSystem(fs);
	}
}
 
开发者ID:zhangjunfang,项目名称:alluxio,代码行数:16,代码来源:HdfsAndAlluxioUtils_update.java

示例2: compareFs

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
private boolean compareFs(FileSystem srcFs, FileSystem destFs) {
  URI srcUri = srcFs.getUri();
  URI dstUri = destFs.getUri();
  if (srcUri.getScheme() == null) {
    return false;
  }
  if (!srcUri.getScheme().equals(dstUri.getScheme())) {
    return false;
  }
  String srcHost = srcUri.getHost();
  String dstHost = dstUri.getHost();
  if ((srcHost != null) && (dstHost != null)) {
    try {
      srcHost = InetAddress.getByName(srcHost).getCanonicalHostName();
      dstHost = InetAddress.getByName(dstHost).getCanonicalHostName();
    } catch (UnknownHostException ue) {
      return false;
    }
    if (!srcHost.equals(dstHost)) {
      return false;
    }
  } else if (srcHost == null && dstHost != null) {
    return false;
  } else if (srcHost != null && dstHost == null) {
    return false;
  }
  // check for ports
  if (srcUri.getPort() != dstUri.getPort()) {
    return false;
  }
  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:JobResourceUploader.java

示例3: getDFS

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
static DistributedFileSystem getDFS(Configuration conf)
    throws IOException {
  FileSystem fs = FileSystem.get(conf);
  if (!(fs instanceof DistributedFileSystem)) {
    throw new IllegalArgumentException("FileSystem " + fs.getUri() +
        " is not an HDFS file system");
  }
  return (DistributedFileSystem)fs;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:AdminHelper.java

示例4: DFSAdminCommand

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
/** Constructor */
public DFSAdminCommand(FileSystem fs) {
  super(fs.getConf());
  if (!(fs instanceof DistributedFileSystem)) {
    throw new IllegalArgumentException("FileSystem " + fs.getUri() + 
        " is not an HDFS file system");
  }
  this.dfs = (DistributedFileSystem)fs;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:DFSAdmin.java

示例5: getDFS

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
protected DistributedFileSystem getDFS() throws IOException {
  FileSystem fs = getFS();
  if (!(fs instanceof DistributedFileSystem)) {
    throw new IllegalArgumentException("FileSystem " + fs.getUri() + 
    " is not an HDFS file system");
  }
  return (DistributedFileSystem)fs;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:DFSAdmin.java

示例6: checkFileSystemAclSupport

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
/**
 * Determines if a file system supports ACLs by running a canary getAclStatus
 * request on the file system root.  This method is used before distcp job
 * submission to fail fast if the user requested preserving ACLs, but the file
 * system cannot support ACLs.
 *
 * @param fs FileSystem to check
 * @throws AclsNotSupportedException if fs does not support ACLs
 */
public static void checkFileSystemAclSupport(FileSystem fs)
    throws AclsNotSupportedException {
  try {
    fs.getAclStatus(new Path(Path.SEPARATOR));
  } catch (Exception e) {
    throw new AclsNotSupportedException("ACLs not supported for file system: "
      + fs.getUri());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:DistCpUtils.java

示例7: checkFileSystemXAttrSupport

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
/**
 * Determines if a file system supports XAttrs by running a getXAttrs request
 * on the file system root. This method is used before distcp job submission
 * to fail fast if the user requested preserving XAttrs, but the file system
 * cannot support XAttrs.
 * 
 * @param fs FileSystem to check
 * @throws XAttrsNotSupportedException if fs does not support XAttrs
 */
public static void checkFileSystemXAttrSupport(FileSystem fs)
    throws XAttrsNotSupportedException {
  try {
    fs.getXAttrs(new Path(Path.SEPARATOR));
  } catch (Exception e) {
    throw new XAttrsNotSupportedException("XAttrs not supported for file system: "
      + fs.getUri());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:DistCpUtils.java

示例8: compareFs

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
public static boolean compareFs(FileSystem srcFs, FileSystem destFs) {
  URI srcUri = srcFs.getUri();
  URI dstUri = destFs.getUri();
  if (srcUri.getScheme() == null) {
    return false;
  }
  if (!srcUri.getScheme().equals(dstUri.getScheme())) {
    return false;
  }
  String srcHost = srcUri.getHost();
  String dstHost = dstUri.getHost();
  if ((srcHost != null) && (dstHost != null)) {
    try {
      srcHost = InetAddress.getByName(srcHost).getCanonicalHostName();
      dstHost = InetAddress.getByName(dstHost).getCanonicalHostName();
    } catch(UnknownHostException ue) {
      if (LOG.isDebugEnabled())
        LOG.debug("Could not compare file-systems. Unknown host: ", ue);
      return false;
    }
    if (!srcHost.equals(dstHost)) {
      return false;
    }
  }
  else if (srcHost == null && dstHost != null) {
    return false;
  }
  else if (srcHost != null) {
    return false;
  }

  //check for ports

  return srcUri.getPort() == dstUri.getPort();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:DistCpUtils.java

示例9: assertFsSameUri

import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
private void assertFsSameUri(FileSystem sourceFs, FileSystem targetFs) {
  Path source = new Path(sourceFs.getUri());
  Path target = new Path(targetFs.getUri());
  assertEquals(source, target);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:6,代码来源:TestHBaseOnOtherDfsCluster.java


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