public _PrivilegedExceptionAction_149(ListPathsServlet _enclosing, XMLOutputter doc , IDictionary <string, string> root, string filePath, string path, Sharpen.Pattern exclude, Sharpen.Pattern filter, bool recur) { this._enclosing = _enclosing; this.doc = doc; this.root = root; this.filePath = filePath; this.path = path; this.exclude = exclude; this.filter = filter; this.recur = recur; }
/// <exception cref="System.IO.IOException"/> public Void Run() { ClientProtocol nn = this._enclosing.CreateNameNodeProxy(); doc.Declaration(); doc.StartTag("listing"); foreach (KeyValuePair <string, string> m in root) { doc.Attribute(m.Key, m.Value); } HdfsFileStatus @base = nn.GetFileInfo(filePath); if ((@base != null) && @base.IsDir()) { ListPathsServlet.WriteInfo(@base.GetFullPath(new Path(path)), @base, doc); } Stack <string> pathstack = new Stack <string>(); pathstack.Push(path); while (!pathstack.Empty()) { string p = pathstack.Pop(); try { byte[] lastReturnedName = HdfsFileStatus.EmptyName; DirectoryListing thisListing; do { System.Diagnostics.Debug.Assert(lastReturnedName != null); thisListing = nn.GetListing(p, lastReturnedName, false); if (thisListing == null) { if (lastReturnedName.Length == 0) { DfsServlet.Log.Warn("ListPathsServlet - Path " + p + " does not exist"); } break; } HdfsFileStatus[] listing = thisListing.GetPartialListing(); foreach (HdfsFileStatus i in listing) { Path fullpath = i.GetFullPath(new Path(p)); string localName = fullpath.GetName(); if (exclude.Matcher(localName).Matches() || !filter.Matcher(localName).Matches()) { continue; } if (recur && i.IsDir()) { pathstack.Push(new Path(p, localName).ToUri().GetPath()); } ListPathsServlet.WriteInfo(fullpath, i, doc); } lastReturnedName = thisListing.GetLastName(); }while (thisListing.HasMore()); } catch (IOException re) { this._enclosing.WriteXml(re, p, doc); } } return(null); }