Exemplo n.º 1
0
 /**
  * Returns an {@link AlluxioURI} representation for the {@link UnderFileSystem} given a base UFS
  * URI, and the Alluxio path from the base.
  *
  * <p>The default implementation simply concatenates the path to the base URI. This should be
  * overridden if a subclass needs alternate functionality.
  *
  * @param ufsBaseUri the base {@link AlluxioURI} in the ufs
  * @param alluxioPath the path in Alluxio from the given base
  * @return the UFS {@link AlluxioURI} representing the Alluxio path
  */
 public AlluxioURI resolveUri(AlluxioURI ufsBaseUri, String alluxioPath) {
   return new AlluxioURI(
       ufsBaseUri.getScheme(),
       ufsBaseUri.getAuthority(),
       PathUtils.concatPath(ufsBaseUri.getPath(), alluxioPath),
       ufsBaseUri.getQueryMap());
 }
Exemplo n.º 2
0
  // TODO(calvin): See if this method is still necessary
  public static Pair<String, String> parse(AlluxioURI path) {
    Preconditions.checkArgument(path != null, "path may not be null");

    if (path.hasScheme()) {
      String header = path.getScheme() + "://";
      String authority = (path.hasAuthority()) ? path.getAuthority() : "";
      if (header.equals(Constants.HEADER)
          || header.equals(Constants.HEADER_FT)
          || isHadoopUnderFS(header)
          || header.equals(Constants.HEADER_S3)
          || header.equals(Constants.HEADER_S3A)
          || header.equals(Constants.HEADER_S3N)
          || header.equals(Constants.HEADER_OSS)
          || header.equals(Constants.HEADER_GCS)) {
        if (path.getPath().isEmpty()) {
          return new Pair<>(header + authority, AlluxioURI.SEPARATOR);
        } else {
          return new Pair<>(header + authority, path.getPath());
        }
      } else if (header.equals("file://")) {
        return new Pair<>(AlluxioURI.SEPARATOR, path.getPath());
      }
    } else if (path.isPathAbsolute()) {
      return new Pair<>(AlluxioURI.SEPARATOR, path.getPath());
    }

    return null;
  }
Exemplo n.º 3
0
 Key(AlluxioURI uri) {
   mScheme = uri.getScheme() == null ? "" : uri.getScheme().toLowerCase();
   mAuthority = uri.getAuthority() == null ? "" : uri.getAuthority().toLowerCase();
 }