org.apache.hadoop.fs.Path#isUriPathAbsolute ( )源码实例Demo

下面列出了org.apache.hadoop.fs.Path#isUriPathAbsolute ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hadoop   文件: KMSConfiguration.java
public static boolean isACLsFileNewer(long time) {
  boolean newer = false;
  String confDir = System.getProperty(KMS_CONFIG_DIR);
  if (confDir != null) {
    Path confPath = new Path(confDir);
    if (!confPath.isUriPathAbsolute()) {
      throw new RuntimeException("System property '" + KMS_CONFIG_DIR +
          "' must be an absolute path: " + confDir);
    }
    File f = new File(confDir, KMS_ACLS_XML);
    // at least 100ms newer than time, we do this to ensure the file
    // has been properly closed/flushed
    newer = f.lastModified() - time > 100;
  }
  return newer;
}
 
源代码2 项目: big-c   文件: KMSConfiguration.java
public static boolean isACLsFileNewer(long time) {
  boolean newer = false;
  String confDir = System.getProperty(KMS_CONFIG_DIR);
  if (confDir != null) {
    Path confPath = new Path(confDir);
    if (!confPath.isUriPathAbsolute()) {
      throw new RuntimeException("System property '" + KMS_CONFIG_DIR +
          "' must be an absolute path: " + confDir);
    }
    File f = new File(confDir, KMS_ACLS_XML);
    // at least 100ms newer than time, we do this to ensure the file
    // has been properly closed/flushed
    newer = f.lastModified() - time > 100;
  }
  return newer;
}
 
源代码3 项目: ranger   文件: KMSConfiguration.java
public static boolean isACLsFileNewer(long time) {
  boolean newer = false;
  String confDir = System.getProperty(KMS_CONFIG_DIR);
  if (confDir != null) {
    Path confPath = new Path(confDir);
    if (!confPath.isUriPathAbsolute()) {
      throw new RuntimeException("System property '" + KMS_CONFIG_DIR +
          "' must be an absolute path: " + confDir);
    }
    File f = new File(confDir, KMS_ACLS_XML);
    // at least 100ms newer than time, we do this to ensure the file
    // has been properly closed/flushed
    newer = f.lastModified() - time > 100;
  }
  return newer;
}
 
源代码4 项目: hadoop   文件: UnresolvedPathException.java
/**
 * Return a path with the link resolved with the target.
 */
public Path getResolvedPath() throws IOException {
  // If the path is absolute we cam throw out the preceding part and
  // just append the remainder to the target, otherwise append each
  // piece to resolve the link in path.
  boolean noRemainder = (remainder == null || "".equals(remainder));
  Path target = new Path(linkTarget);
  if (target.isUriPathAbsolute()) {
    return noRemainder ? target : new Path(target, remainder);
  } else {
    return noRemainder
      ? new Path(preceding, target)
      : new Path(new Path(preceding, linkTarget), remainder);
  }
}
 
源代码5 项目: big-c   文件: UnresolvedPathException.java
/**
 * Return a path with the link resolved with the target.
 */
public Path getResolvedPath() throws IOException {
  // If the path is absolute we cam throw out the preceding part and
  // just append the remainder to the target, otherwise append each
  // piece to resolve the link in path.
  boolean noRemainder = (remainder == null || "".equals(remainder));
  Path target = new Path(linkTarget);
  if (target.isUriPathAbsolute()) {
    return noRemainder ? target : new Path(target, remainder);
  } else {
    return noRemainder
      ? new Path(preceding, target)
      : new Path(new Path(preceding, linkTarget), remainder);
  }
}
 
源代码6 项目: reef   文件: FSCheckpointService.java
public CheckpointWriteChannel create()
    throws IOException {

  final String name = namingPolicy.getNewName();
  final Path p = new Path(name);
  if (p.isUriPathAbsolute()) {
    throw new IOException("Checkpoint name cannot be an absolute path.");
  }

  return createInternal(new Path(basePath, p));
}
 
/**
 * Relative for our purposes is no scheme, no authority
 * and a non-absolute path portion.
 */
private boolean isRelative(Path path) {
  URI uri = path.toUri();
  return uri.getAuthority() == null && uri.getScheme() == null && !path.isUriPathAbsolute();
}