public override void HandleGettingPathStatus(IFilesys sender, GetPathStatusEventArgs args) { // First decide the path conforms to the pattern, then check its existence. UriTemplateMatch match; var succ = TryMatchPath(BasicTemplateString, args.VritualRawPath.PathString, out match); if (succ) { // Does it already exist? var shadowFullPath = _pathFactory.CreateShadowFullPath4Read( new VirtualPath(args.VritualRawPath)); if (IOUtil.FileOrDirectoryExists(shadowFullPath.PathString)) { // @TODO return for now but the path could be stale. return; } else { String nameStr = match.BoundVariables[2]; if (nameStr.StartsWith(".")) { // We don't deal with hidden files. return; } } // The path doesn't exsit locally. Check the server. Uri reqUri; reqUri = BasicPathMatch2ReqUri(match, new NameValueCollection() { { PeekParamName, "true" } }); Logger.WriteLineIf(LogLevel.Verbose, _log_props, string.Format( "Requesting meta info from Uri {0}", reqUri.ToString())); string xmlString; try { // This can be a while. xmlString = _serverProxy.GetUTF8String(reqUri, System.Threading.Timeout.Infinite); } catch (WebException ex) { Logger.WriteLineIf(LogLevel.Verbose, _log_props, string.Format( "Exception thrown from server: {0}", ex)); // Handle different types of error accodingly. if (ex is WebException) { if (((HttpWebResponse)((ex as WebException).Response)).StatusCode == HttpStatusCode.NotFound) { // Normal. Logger.WriteLineIf(LogLevel.Verbose, _log_props, string.Format( "Server says {0} doesn't exist online.", args.VritualRawPath)); return; } else { // Other protocol level errors. throw; } } else { // Non-procotol-level errors. throw; } } // If everything is fine so far, we are good for subsequent read! CreateVirtualFiles(new ShadowMetaFullPath(sender.ShadowDirPath, new VirtualPath(args.VritualRawPath)), xmlString); } }
public void HandleGettingPathStatus(IFilesys sender, GetPathStatusEventArgs args) { // Do nothing. }
void FushareFilesys_GettingPathStatus(object sender, GetPathStatusEventArgs e) { GetEventHandler(sender as IFilesys, e).HandleGettingPathStatus( sender as IFilesys, e); }
public abstract void HandleGettingPathStatus(IFilesys sender, GetPathStatusEventArgs args);