// 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; }
/** * 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()); }
/** * Transforms the list of {@link AlluxioURI} in a new list of Strings, where each string is {@link * AlluxioURI#getPath()}. * * @param uris the list of {@link AlluxioURI}s to be stripped * @return a new list of strings mapping the input URIs to theri path component */ private List<String> stripURIList(List<AlluxioURI> uris) { final List<String> pathStrings = new ArrayList<>(uris.size()); for (final AlluxioURI uri : uris) { pathStrings.add(uri.getPath()); } return pathStrings; }