當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。