Java Code Examples for org.apache.hadoop.fs.Path#isUriPathAbsolute()

The following examples show how to use org.apache.hadoop.fs.Path#isUriPathAbsolute() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   File: KMSConfiguration.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source Project: big-c   File: KMSConfiguration.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source Project: ranger   File: KMSConfiguration.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 4
Source Project: hadoop   File: UnresolvedPathException.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
  }
}
 
Example 5
Source Project: big-c   File: UnresolvedPathException.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
  }
}
 
Example 6
Source Project: reef   File: FSCheckpointService.java    License: Apache License 2.0 5 votes vote down vote up
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));
}
 
Example 7
/**
 * 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();
}