Example #1
0
 /**
  * Advanced API.
  *
  * <p>Gets the FileInfo object that represents the fileId, or the path if fileId is -1.
  *
  * @param fileId the file id of the file or folder.
  * @param path the path of the file or folder. valid iff fileId is -1.
  * @param useCachedMetadata if true use the local cached meta data
  * @return the FileInfo of the file. null if the file does not exist.
  * @throws IOException if the underlying master RPC fails
  */
 public synchronized FileInfo getFileStatus(
     long fileId, TachyonURI path, boolean useCachedMetadata) throws IOException {
   if (fileId == -1) {
     try {
       fileId = mFSMasterClient.getFileId(path.getPath());
     } catch (InvalidPathException e) {
       throw new IOException(e);
     }
   }
   return getFileStatus(
       mIdToClientFileInfo, fileId, fileId, TachyonURI.EMPTY_URI.getPath(), useCachedMetadata);
 }
Example #2
0
 /**
  * Validates the given uri, throws an appropriate Exception if the uri is invalid.
  *
  * @param uri the uri to validate
  */
 private void validateUri(TachyonURI uri) {
   Preconditions.checkNotNull(uri, "URI cannot be null.");
   Preconditions.checkArgument(
       uri.isPathAbsolute() || TachyonURI.EMPTY_URI.equals(uri),
       "URI must be absolute, unless it's empty.");
   Preconditions.checkArgument(
       !uri.hasScheme() || mRootUri.getScheme().equals(uri.getScheme()),
       "URI's scheme: "
           + uri.getScheme()
           + " must match the file system's scheme: "
           + mRootUri.getScheme()
           + ", unless it doesn't have a scheme.");
   Preconditions.checkArgument(
       !uri.hasAuthority() || mRootUri.getAuthority().equals(uri.getAuthority()),
       "URI's authority: "
           + uri.getAuthority()
           + " must match the file system's authority: "
           + mRootUri.getAuthority()
           + ", unless it doesn't have an authority.");
 }