/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> /// <exception cref="System.IO.FileNotFoundException"/> /// <exception cref="System.IO.IOException"/> public override FileStatus GetFileStatus(Path f) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); FileStatus status = res.targetFileSystem.GetFileStatus(res.remainingPath); return(FixFileStatus(status, this.MakeQualified(f))); }
/// <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)); }
/// <exception cref="System.IO.IOException"/> public override BlockLocation[] GetFileBlockLocations(FileStatus fs, long start, long len) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(fs.GetPath() ), true); return(res.targetFileSystem.GetFileBlockLocations(new ViewFsFileStatus(fs, res.remainingPath ), start, len)); }
/// <exception cref="System.IO.IOException"/> private Path GetChrootedPath(InodeTree.ResolveResult <FileSystem> res, FileStatus status, Path f) { string suffix = ((ChRootedFileSystem)res.targetFileSystem).StripOutRoot(status.GetPath ()); return(this.MakeQualified(suffix.Length == 0 ? f : new Path(res.resolvedPath, suffix ))); }
/// <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)); }
public override short GetDefaultReplication(Path f) { try { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); return(res.targetFileSystem.GetDefaultReplication(res.remainingPath)); } catch (FileNotFoundException) { throw new NotInMountpointException(f, "getDefaultReplication"); } }
/// <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)); }
/// <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); }
public virtual void TestGetFileChecksum() { FileSystem mockFS = Org.Mockito.Mockito.Mock <FileSystem>(); InodeTree.ResolveResult <FileSystem> res = new InodeTree.ResolveResult <FileSystem> (null, mockFS, null, new Path("someFile")); InodeTree <FileSystem> fsState = Org.Mockito.Mockito.Mock <InodeTree>(); Org.Mockito.Mockito.When(fsState.Resolve("/tmp/someFile", true)).ThenReturn(res); ViewFileSystem vfs = Org.Mockito.Mockito.Mock <ViewFileSystem>(); vfs.fsState = fsState; Org.Mockito.Mockito.When(vfs.GetFileChecksum(new Path("/tmp/someFile"))).ThenCallRealMethod (); vfs.GetFileChecksum(new Path("/tmp/someFile")); Org.Mockito.Mockito.Verify(mockFS).GetFileChecksum(new Path("someFile")); }
public virtual void TestGetFileChecksum() { AbstractFileSystem mockAFS = Org.Mockito.Mockito.Mock <AbstractFileSystem>(); InodeTree.ResolveResult <AbstractFileSystem> res = new InodeTree.ResolveResult <AbstractFileSystem >(null, mockAFS, null, new Path("someFile")); InodeTree <AbstractFileSystem> fsState = Org.Mockito.Mockito.Mock <InodeTree>(); Org.Mockito.Mockito.When(fsState.Resolve(Org.Mockito.Mockito.AnyString(), Org.Mockito.Mockito .AnyBoolean())).ThenReturn(res); ViewFs vfs = Org.Mockito.Mockito.Mock <ViewFs>(); vfs.fsState = fsState; Org.Mockito.Mockito.When(vfs.GetFileChecksum(new Path("/tmp/someFile"))).ThenCallRealMethod (); vfs.GetFileChecksum(new Path("/tmp/someFile")); Org.Mockito.Mockito.Verify(mockAFS).GetFileChecksum(new Path("someFile")); }
/// <exception cref="System.IO.IOException"/> public override bool Truncate(Path f, long newLength) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); return(res.targetFileSystem.Truncate(f, newLength)); }
/// <exception cref="System.IO.IOException"/> public override IList <string> ListXAttrs(Path path) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(path), true); return(res.targetFileSystem.ListXAttrs(res.remainingPath)); }
/// <exception cref="System.IO.IOException"/> public override void RemoveXAttr(Path path, string name) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(path), true); res.targetFileSystem.RemoveXAttr(res.remainingPath, name); }
/// <exception cref="System.IO.IOException"/> public override void SetXAttr(Path path, string name, byte[] value, EnumSet <XAttrSetFlag > flag) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(path), true); res.targetFileSystem.SetXAttr(res.remainingPath, name, value, flag); }
/// <exception cref="System.IO.IOException"/> public override IDictionary <string, byte[]> GetXAttrs(Path path, IList <string> names ) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(path), true); return(res.targetFileSystem.GetXAttrs(res.remainingPath, names)); }
/// <exception cref="System.IO.IOException"/> public override void SetAcl(Path path, IList <AclEntry> aclSpec) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(path), true); res.targetFileSystem.SetAcl(res.remainingPath, aclSpec); }
/// <exception cref="System.IO.IOException"/> public override AclStatus GetAclStatus(Path path) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(path), true); return(res.targetFileSystem.GetAclStatus(res.remainingPath)); }
/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> /// <exception cref="System.IO.FileNotFoundException"/> /// <exception cref="System.IO.IOException"/> public override void SetTimes(Path f, long mtime, long atime) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); res.targetFileSystem.SetTimes(res.remainingPath, mtime, atime); }
/// <exception cref="System.IO.IOException"/> public override void RemoveAcl(Path path) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(path), true); res.targetFileSystem.RemoveAcl(res.remainingPath); }
/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> /// <exception cref="System.IO.FileNotFoundException"/> /// <exception cref="System.IO.IOException"/> public override FileChecksum GetFileChecksum(Path f) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); return(res.targetFileSystem.GetFileChecksum(res.remainingPath)); }
/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> /// <exception cref="System.IO.FileNotFoundException"/> /// <exception cref="System.IO.IOException"/> public override bool SetReplication(Path f, short replication) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); return(res.targetFileSystem.SetReplication(res.remainingPath, replication)); }
/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> /// <exception cref="System.IO.FileNotFoundException"/> /// <exception cref="System.IO.IOException"/> public override void Access(Path path, FsAction mode) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(path), true); res.targetFileSystem.Access(res.remainingPath, mode); }
/// <exception cref="System.IO.IOException"/> public override FsServerDefaults GetServerDefaults(Path f) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); return(res.targetFileSystem.GetServerDefaults(res.remainingPath)); }
public _RemoteIterator_422(ViewFileSystem _enclosing, RemoteIterator <LocatedFileStatus > statusIter, InodeTree.ResolveResult <FileSystem> res, Path f) { this._enclosing = _enclosing; this.statusIter = statusIter; this.res = res; this.f = f; }
/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> /// <exception cref="System.IO.FileNotFoundException"/> /// <exception cref="System.IO.IOException"/> public override FSDataInputStream Open(Path f, int bufferSize) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); return(res.targetFileSystem.Open(res.remainingPath, bufferSize)); }
/// <exception cref="System.IO.IOException"/> public override bool Mkdirs(Path dir, FsPermission permission) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(dir), false); return(res.targetFileSystem.Mkdirs(res.remainingPath, permission)); }
/// <exception cref="System.IO.IOException"/> public override ContentSummary GetContentSummary(Path f) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); return(res.targetFileSystem.GetContentSummary(res.remainingPath)); }
/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> /// <exception cref="System.IO.FileNotFoundException"/> /// <exception cref="System.IO.IOException"/> public override void SetOwner(Path f, string username, string groupname) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); res.targetFileSystem.SetOwner(res.remainingPath, username, groupname); }
/// <summary>Resolve the pathname p relative to root InodeDir</summary> /// <param name="p">- inout path</param> /// <param name="resolveLastComponent"></param> /// <returns>ResolveResult which allows further resolution of the remaining path</returns> /// <exception cref="System.IO.FileNotFoundException"/> internal virtual InodeTree.ResolveResult <T> Resolve(string p, bool resolveLastComponent ) { // TO DO: - more efficient to not split the path, but simply compare string[] path = BreakIntoPathComponents(p); if (path.Length <= 1) { // special case for when path is "/" InodeTree.ResolveResult <T> res = new InodeTree.ResolveResult <T>(InodeTree.ResultKind .isInternalDir, root.InodeDirFs, root.fullPath, SlashPath); return(res); } InodeTree.INodeDir <T> curInode = root; int i; // ignore first slash for (i = 1; i < path.Length - (resolveLastComponent ? 0 : 1); i++) { InodeTree.INode <T> nextInode = curInode.ResolveInternal(path[i]); if (nextInode == null) { StringBuilder failedAt = new StringBuilder(path[0]); for (int j = 1; j <= i; ++j) { failedAt.Append('/').Append(path[j]); } throw (new FileNotFoundException(failedAt.ToString())); } if (nextInode is InodeTree.INodeLink) { InodeTree.INodeLink <T> link = (InodeTree.INodeLink <T>)nextInode; Path remainingPath; if (i >= path.Length - 1) { remainingPath = SlashPath; } else { StringBuilder remainingPathStr = new StringBuilder("/" + path[i + 1]); for (int j = i + 2; j < path.Length; ++j) { remainingPathStr.Append('/').Append(path[j]); } remainingPath = new Path(remainingPathStr.ToString()); } InodeTree.ResolveResult <T> res = new InodeTree.ResolveResult <T>(InodeTree.ResultKind .isExternalDir, link.targetFileSystem, nextInode.fullPath, remainingPath); return(res); } else { if (nextInode is InodeTree.INodeDir) { curInode = (InodeTree.INodeDir <T>)nextInode; } } } // We have resolved to an internal dir in mount table. Path remainingPath_1; if (resolveLastComponent) { remainingPath_1 = SlashPath; } else { // note we have taken care of when path is "/" above // for internal dirs rem-path does not start with / since the lookup // that follows will do a children.get(remaningPath) and will have to // strip-out the initial / StringBuilder remainingPathStr = new StringBuilder("/" + path[i]); for (int j = i + 1; j < path.Length; ++j) { remainingPathStr.Append('/').Append(path[j]); } remainingPath_1 = new Path(remainingPathStr.ToString()); } InodeTree.ResolveResult <T> res_1 = new InodeTree.ResolveResult <T>(InodeTree.ResultKind .isInternalDir, curInode.InodeDirFs, curInode.fullPath, remainingPath_1); return(res_1); }
/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> /// <exception cref="System.IO.FileNotFoundException"/> /// <exception cref="System.IO.IOException"/> public override void SetPermission(Path f, FsPermission permission) { InodeTree.ResolveResult <FileSystem> res = fsState.Resolve(GetUriPath(f), true); res.targetFileSystem.SetPermission(res.remainingPath, permission); }