示例#1
0
 /// <exception cref="System.IO.IOException"/>
 public override bool Rename(Path src, Path dst)
 {
     // passing resolveLastComponet as false to catch renaming a mount point to
     // itself. We need to catch this as an internal operation and fail.
     InodeTree.ResolveResult <FileSystem> resSrc = fsState.Resolve(GetUriPath(src), false
                                                                   );
     if (resSrc.IsInternalDir())
     {
         throw ReadOnlyMountTable("rename", src);
     }
     InodeTree.ResolveResult <FileSystem> resDst = fsState.Resolve(GetUriPath(dst), false
                                                                   );
     if (resDst.IsInternalDir())
     {
         throw ReadOnlyMountTable("rename", dst);
     }
     //
     // Alternate 3 : renames ONLY within the the same mount links.
     //
     if (resSrc.targetFileSystem != resDst.targetFileSystem)
     {
         throw new IOException("Renames across Mount points not supported");
     }
     return(resSrc.targetFileSystem.Rename(resSrc.remainingPath, resDst.remainingPath));
 }
示例#2
0
 /// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/>
 /// <exception cref="System.IO.FileNotFoundException"/>
 /// <exception cref="System.IO.IOException"/>
 public override bool Delete(Path f, bool recursive)
 {
     InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true);
     // If internal dir or target is a mount link (ie remainingPath is Slash)
     if (res.IsInternalDir() || res.remainingPath == InodeTree.SlashPath)
     {
         throw ReadOnlyMountTable("delete", f);
     }
     return(res.targetFileSystem.Delete(res.remainingPath, recursive));
 }
示例#3
0
        /// <exception cref="System.IO.FileNotFoundException"/>
        /// <exception cref="System.IO.IOException"/>
        protected internal override RemoteIterator <LocatedFileStatus> ListLocatedStatus(Path
                                                                                         f, PathFilter filter)
        {
            InodeTree.ResolveResult <FileSystem> res        = fsState.Resolve(GetUriPath(f), true);
            RemoteIterator <LocatedFileStatus>   statusIter = res.targetFileSystem.ListLocatedStatus
                                                                  (res.remainingPath);

            if (res.IsInternalDir())
            {
                return(statusIter);
            }
            return(new _RemoteIterator_422(this, statusIter, res, f));
        }
示例#4
0
 /// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/>
 /// <exception cref="System.IO.FileNotFoundException"/>
 /// <exception cref="System.IO.IOException"/>
 public override FileStatus[] ListStatus(Path f)
 {
     InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true);
     FileStatus[] statusLst = res.targetFileSystem.ListStatus(res.remainingPath);
     if (!res.IsInternalDir())
     {
         // We need to change the name in the FileStatus as described in
         // {@link #getFileStatus }
         int i = 0;
         foreach (FileStatus status in statusLst)
         {
             statusLst[i++] = FixFileStatus(status, GetChrootedPath(res, status, f));
         }
     }
     return(statusLst);
 }
示例#5
0
 /// <exception cref="System.IO.FileNotFoundException"/>
 public virtual Path GetTrashCanLocation(Path f)
 {
     InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true);
     return(res.IsInternalDir() ? null : res.targetFileSystem.GetHomeDirectory());
 }