REsolves the given Ufs path. If the given UFs path is mounted in Alluxio space, it returns
the associated Alluxio path.
@param ufsUri an Ufs path URI
@return an Alluxio path URI
480975
public AlluxioURI reverseResolve(AlluxioURI ufsUri) {
    AlluxioURI returnVal = null;
    for (Map.Entry<String, MountInfo> mountInfoEntry : getMountTable().entrySet()) {
      try {
        if (mountInfoEntry.getValue().getUfsUri().isAncestorOf(ufsUri)) {
          returnVal = reverseResolve(mountInfoEntry.getValue().getAlluxioUri(),
              mountInfoEntry.getValue().getUfsUri(), ufsUri);
        }
      } catch (InvalidPathException | RuntimeException e) {
        LOG.info(Throwables.getStackTraceAsString(e));
        // expected when ufsUri does not belong to this particular mountPoint
      }
      if (returnVal != null) {
        return returnVal;
      }
    }
    return null;
  }
104631
public static URI resolveBase(final URI baseURI, final Stack<URI> stack) throws XIncludeFatalException
    {
        final URI computedUri = XIncProcUtils.computeBase(stack);
        final URI resolvedUri = baseURI.resolve(computedUri);
        if (0 == resolvedUri.compareTo(baseURI))
        {
            throw new XIncludeFatalException("Inclusion loop error");
        }
        return resolvedUri;
    }
567733
URI buildUri(String relativePath)
    {    
        URI uri = null;
        
        try
        {    
            uri = new URI(buildUrl(relativePath));   
        }
        catch (URISyntaxException e)
        {           
            logger.severe("Problem constructing URI: "+e.getClass().getName()+e.getMessage());
        }

        return uri;
    }
1253
@Override
    public URI toUri() {
        final URI root = ShrinkWrapFileSystems.getRootUri(this.fileSystem.getArchive());
        // Compose a new URI location, stripping out the extra "/" root
        final String location = root.toString() + this.toString().substring(1);
        final URI uri = URI.create(location);
        return uri;
    }
1350907
StorageDirectory getStorageDirectory(URI uri) {
    try {
      uri = Util.fileAsURI(new File(uri));
      Iterator<StorageDirectory> it = dirIterator();
      for (; it.hasNext(); ) {
        StorageDirectory sd = it.next();
        if (Util.fileAsURI(sd.getRoot()).equals(uri)) {
          return sd;
        }
      }
    } catch (IOException ioe) {
      LOG.warn("Error converting file to URI", ioe);
    }
    return null;
  }
180717
@Override
  public Path getHadoopPath(URI gcsPath) {
    logger.atFine().log("GHFS.getHadoopPath: %s", gcsPath);

    // Handle root. Delegate to getGcsPath on "gs:/" to resolve the appropriate gs://<bucket> URI.
    if (gcsPath.equals(getGcsPath(getFileSystemRoot()))) {
      return getFileSystemRoot();
    }

    StorageResourceId resourceId = pathCodec.validatePathAndGetId(gcsPath, true);

    // Unlike the global-rooted GHFS, gs:// has no meaning in the bucket-rooted world.
    checkArgument(!resourceId.isRoot(), "Missing authority in gcsPath '%s'", gcsPath);
    checkArgument(
        resourceId.getBucketName().equals(rootBucket),
        "Authority of URI '%s' doesn't match root bucket '%s'",
        resourceId.getBucketName(), rootBucket);

    Path hadoopPath = new Path(getScheme() + "://" + rootBucket + '/' + resourceId.getObjectName());
    logger.atFine().log("GHFS.getHadoopPath: %s -> %s", gcsPath, hadoopPath);
    return hadoopPath;
  }
1349240
public static Path asPath(URI uri) {
    try {
      return Paths.get(uri);
    } catch (FileSystemNotFoundException e) {
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      if (cl == null) {
        throw e;
      }
      try {
        return FileSystems.newFileSystem(uri, new HashMap<>(), cl).provider().getPath(uri);
      } catch (IOException ex) {
        throw new RuntimeException("Cannot create filesystem for " + uri, ex);
      }
    }
  }
21076
private URI decodeHarURI(URI rawURI, Configuration conf) throws IOException {
    String tmpAuth = rawURI.getAuthority();
    //we are using the default file
    //system in the config
    //so create a underlying uri and
    //return it
    if (tmpAuth == null) {
      //create a path
      return FileSystem.getDefaultUri(conf);
    }
    String host = rawURI.getHost();
    String[] str = host.split("-", 2);
    if (str[0] == null) {
      throw new IOException("URI: " + rawURI + " is an invalid Har URI.");
    }
    String underLyingScheme = str[0];
    String underLyingHost = (str.length > 1)? str[1]:null;
    int underLyingPort = rawURI.getPort();
    String auth = (underLyingHost == null && underLyingPort == -1)?
                  null:(underLyingHost+":"+underLyingPort);
    URI tmp = null;
    if (rawURI.getQuery() != null) {
      // query component not allowed
      throw new IOException("query component in Path not supported  " + rawURI);
    }
    try {
      tmp = new URI(underLyingScheme, auth, rawURI.getPath(),
            rawURI.getQuery(), rawURI.getFragment());
    } catch (URISyntaxException e) {
        // do nothing should not happen
    }
    return tmp;
  }
1347449
protected boolean shouldIgnorePath(String requestUri) {
        for (String path : router.getIgnorePaths()) {
            if (requestUri.startsWith(path)) {
                return true;
            }
        }

        return false;
    }
131270
protected function pathFromUri(HttpUriInterface $uri)
    {
        $path = $uri->getPath();
        if (null === $path) {
            $path = '';
        }

        return $path;
    }
1006223
@VisibleForTesting
  static URI sourceURI(URI uri) {
    if (!uri.getScheme().equals("jar")) {
      return uri;
    }
    try {
      return URI.create(
          "file:/" + ((JarURLConnection) uri.toURL().openConnection()).getEntryName());
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }
958630
public URI resolve(final URI uri, final Sid accountSid) {
        getHttpConnector();

        String restcommAddress = null;

        if (accountSid != null && daoManager != null) {
            Sid organizationSid = daoManager.getAccountsDao().getAccount(accountSid).getOrganizationSid();
            restcommAddress = daoManager.getOrganizationsDao().getOrganization(organizationSid).getDomainName();
        }

        if (restcommAddress == null || restcommAddress.isEmpty()) {
            if (useHostnameToResolve) {
                restcommAddress = RestcommConfiguration.getInstance().getMain().getHostname();
                if (restcommAddress == null || restcommAddress.isEmpty()) {
                    try {
                        InetAddress addr = DNSUtils.getByName(selectedConnector.getAddress());
                        restcommAddress = addr.getCanonicalHostName();
                    } catch (UnknownHostException e) {
                        logger.error("Unable to resolveWithBase: " + selectedConnector + " to hostname: " + e);
                        restcommAddress = selectedConnector.getAddress();
                    }
                }
            } else {
                restcommAddress = selectedConnector.getAddress();
            }
        }

        String base = selectedConnector.getScheme() + "://" + restcommAddress + ":" + selectedConnector.getPort();
        try {
            return resolveWithBase(new URI(base), uri);
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("Badly formed URI: " + base, e);
        }
    }
1341476
public URI toUri(final String stringUri) {
    try {
      final java.net.URI netUri = new java.net.URI(stringUri);
      return this.toEmfUri(netUri);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
86498
@Override
  public URI getGcsPath(Path hadoopPath) {
    logger.atFine().log("GHFS.getGcsPath: %s", hadoopPath);

    // Convert to fully qualified absolute path; the Path object will callback to get our current
    // workingDirectory as part of fully resolving the path.
    Path resolvedPath = makeQualified(hadoopPath);

    String objectName = resolvedPath.toUri().getPath();
    if (objectName != null && resolvedPath.isAbsolute()) {
      // Strip off leading '/' because GoogleCloudStorageFileSystem.getPath appends it explicitly
      // between bucket and objectName.
      objectName = objectName.substring(1);
    }

    // Construct GCS path uri.
    URI gcsPath = pathCodec.getPath(rootBucket, objectName, true);
    logger.atFine().log("GHFS.getGcsPath: %s -> %s", hadoopPath, gcsPath);
    return gcsPath;
  }
987231
public java.lang.String getUfsPath() {
    java.lang.Object ref = ufsPath_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        ufsPath_ = s;
      }
      return s;
    }
  }
693398
private void extractPathInfo(URI dsnUri) {
        String uriPath = dsnUri.getPath();
        if (uriPath == null) {
            return;
        }
        int projectIdStart = uriPath.lastIndexOf("/") + 1;
        path = uriPath.substring(0, projectIdStart);
        projectId = uriPath.substring(projectIdStart);
    }
71478
private String resolveFileStorePath(String fileStorePath) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, "resolveFileStorePath", new Object[] { fileStorePath });
        }

        String filePath = null;

        try {
            BundleContext bundleContext = FrameworkUtil.getBundle(
                                                                  WsLocationAdmin.class).getBundleContext();
            ServiceReference<WsLocationAdmin> locationAdminRef = bundleContext
                            .getServiceReference(WsLocationAdmin.class);
            WsLocationAdmin locationAdmin = bundleContext
                            .getService(locationAdminRef);
            filePath = locationAdmin.resolveString(fileStorePath);
        } catch (Exception e) {
            SibTr.exception(tc, e);
            FFDCFilter.processException(e, this.getClass().getName(), "720", this);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, "resolveFileStorePath", new Object[] { filePath });
        }
        return filePath;

    }