Selective filtering modifications to allow uploading of new root folders
[pithos-ms-client] / trunk / Pithos.Core / Agents / DeleteAgent.cs
index bf3dc2d..76e688b 100644 (file)
@@ -65,6 +65,8 @@ namespace Pithos.Core.Agents
 
         [Import]
         public IStatusKeeper StatusKeeper { get; set; }
+        
+        public IStatusNotification StatusNotification { get; set; }
 
         //A separate agent is used to execute delete actions immediatelly;
         private readonly ActionBlock<CloudDeleteAction> _deleteAgent;
@@ -111,7 +113,7 @@ namespace Pithos.Core.Agents
 
             var accountInfo = action.AccountInfo;
 
-            using (log4net.ThreadContext.Stacks["NETWORK"].Push("PROCESS"))
+            using (log4net.ThreadContext.Stacks["Operation"].Push("ProcessDelete"))
             {
                 Log.InfoFormat("[ACTION] Start Processing {0}", action);
 
@@ -199,7 +201,7 @@ namespace Pithos.Core.Agents
             _deleteAgent.Post(action);
         }
 
-        private void DeleteCloudFile(AccountInfo accountInfo, ObjectInfo cloudFile)
+        public void DeleteCloudFile(AccountInfo accountInfo, ObjectInfo cloudFile)
         {
             if (accountInfo == null)
                 throw new ArgumentNullException("accountInfo");
@@ -212,13 +214,13 @@ namespace Pithos.Core.Agents
 
             var fileAgent = GetFileAgent(accountInfo);
 
-            using (ThreadContext.Stacks["DeleteCloudFile"].Push("Delete"))
+            using (ThreadContext.Stacks["Operation"].Push("DeleteCloudFile"))
             {
                 var fileName = cloudFile.RelativeUrlToFilePath(accountInfo.UserName);
                 var info = fileAgent.GetFileSystemInfo(fileName);
                 var fullPath = info.FullName.ToLower();
 
-                StatusKeeper.SetFileOverlayStatus(fullPath, FileOverlayStatus.Modified);
+                StatusKeeper.SetFileOverlayStatus(fullPath, FileOverlayStatus.Modified).Wait();
 
                 var account = cloudFile.Account ?? accountInfo.UserName;
                 var container = cloudFile.Container;//?? FolderConstants.PithosContainer;
@@ -227,6 +229,7 @@ namespace Pithos.Core.Agents
                 client.DeleteObject(account, container, cloudFile.Name);
 
                 StatusKeeper.ClearFileStatus(fullPath);
+                StatusNotification.Notify(new CloudNotification{Data=cloudFile});
             }
         }