Exemplo n.º 1
0
 public void FoldersExport(ISourceMailbox mailbox, List <byte[]> folderIds, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
 {
     this.RunExportThread(delegate
     {
         using (BufferedTransmitter bufferedTransmitter = new BufferedTransmitter(this, this.service.ExportBufferSizeFromMrsKB, false, this.service.UseBufferring, this.service.UseCompression))
         {
             using (AsynchronousTransmitter asynchronousTransmitter = new AsynchronousTransmitter(bufferedTransmitter, false))
             {
                 using (FxProxyPoolTransmitter fxProxyPoolTransmitter = new FxProxyPoolTransmitter(asynchronousTransmitter, false, this.service.ClientVersion))
                 {
                     mailbox.ExportFolders(folderIds, fxProxyPoolTransmitter, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps, copyPropertiesFlags, excludeProps, extendedAclFlags);
                 }
             }
         }
     });
 }
Exemplo n.º 2
0
 void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
 {
     throw new NotImplementedException();
 }
        void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
        {
            string    text           = "ISourceMailbox.ExportFolders";
            TimeSpan  targetDuration = TimeSpan.Zero;
            Stopwatch stopwatch      = Stopwatch.StartNew();

            base.CreateContext(text, new DataContext[]
            {
                new EntryIDsDataContext(folderIds),
                new SimpleValueDataContext("exportFoldersDataToCopyFlags", exportFoldersDataToCopyFlags),
                new SimpleValueDataContext("folderRecFlags", folderRecFlags),
                new PropTagsDataContext(additionalFolderRecProps),
                new SimpleValueDataContext("copyPropertiesFlags", copyPropertiesFlags),
                new PropTagsDataContext(excludeProps),
                new SimpleValueDataContext("extendedAclFlags", extendedAclFlags)
            }).Execute(delegate
            {
                using (FxProxyPoolFxCallbackWrapper fxProxyPoolFxCallbackWrapper = new FxProxyPoolFxCallbackWrapper(proxyPool, true, delegate(TimeSpan duration)
                {
                    targetDuration += duration;
                }))
                {
                    ((ISourceMailbox)this.WrappedObject).ExportFolders(folderIds, fxProxyPoolFxCallbackWrapper, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps, copyPropertiesFlags, excludeProps, extendedAclFlags);
                }
            }, false);
            base.UpdateDuration(text, stopwatch.Elapsed.Subtract(targetDuration));
        }
 private void ExportSingleFolder(IFxProxyPool proxyPool, byte[] folderEntryId, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludePropertiesFromCopy, AclFlags extendedAclFlags)
 {
     ExecutionContext.Create(new DataContext[]
     {
         new OperationDataContext("StorageSourceMailbox.ExportSingleFolder", OperationType.None),
         new EntryIDsDataContext(folderEntryId),
         new SimpleValueDataContext("exportFoldersDataToCopyFlags", exportFoldersDataToCopyFlags),
         new SimpleValueDataContext("folderRecFlags", folderRecFlags),
         new PropTagsDataContext(additionalFolderRecProps),
         new SimpleValueDataContext("copyPropertiesFlags", copyPropertiesFlags),
         new PropTagsDataContext(excludePropertiesFromCopy),
         new SimpleValueDataContext("extendedAclFlags", extendedAclFlags)
     }).Execute(delegate
     {
         using (this.RHTracker.Start())
         {
             using (ISourceFolder folder = this.GetFolder <StorageSourceFolder>(folderEntryId))
             {
                 if (folder == null)
                 {
                     MrsTracer.Provider.Debug("Folder {0} is missing in source. Skipping.", new object[]
                     {
                         TraceUtils.DumpEntryId(folderEntryId)
                     });
                 }
                 else
                 {
                     using (IFolderProxy folderProxyForExportFolder = StorageSourceMailbox.GetFolderProxyForExportFolder(proxyPool, folder, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps))
                     {
                         if (extendedAclFlags != AclFlags.None)
                         {
                             this.ExportExtendedAcls(extendedAclFlags, folder, folderProxyForExportFolder);
                         }
                         using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(folderProxyForExportFolder, false, new Func <IDisposable>(this.RHTracker.StartExclusive), new Action <uint>(this.RHTracker.Charge)))
                         {
                             if (exportFoldersDataToCopyFlags.HasFlag(ExportFoldersDataToCopyFlags.IncludeCopyToStream))
                             {
                                 folder.CopyTo(fxProxyBudgetWrapper, copyPropertiesFlags, excludePropertiesFromCopy);
                             }
                         }
                     }
                 }
             }
         }
     });
 }
        private static IFolderProxy GetFolderProxyForExportFolder(IFxProxyPool proxyPool, IFolder sourceFolder, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps)
        {
            IFolderProxy result;

            if ((exportFoldersDataToCopyFlags & ExportFoldersDataToCopyFlags.OutputCreateMessages) == ExportFoldersDataToCopyFlags.OutputCreateMessages)
            {
                FolderRec folderRec = sourceFolder.GetFolderRec(additionalFolderRecProps, folderRecFlags);
                result = proxyPool.CreateFolder(folderRec);
            }
            else
            {
                result = proxyPool.GetFolderProxy(sourceFolder.GetFolderId());
            }
            return(result);
        }
        void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
        {
            MrsTracer.ProxyClient.Function("StorageSourceMailbox.ExportFolders", new object[0]);
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            bool exportCompleted = false;

            CommonUtils.ProcessKnownExceptions(delegate
            {
                foreach (byte[] folderEntryId in folderIds)
                {
                    this.ExportSingleFolder(proxyPool, folderEntryId, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps, copyPropertiesFlags, excludeProps, extendedAclFlags);
                }
                exportCompleted = true;
                proxyPool.Flush();
            }, delegate(Exception ex)
            {
                if (!exportCompleted)
                {
                    MrsTracer.Provider.Debug("Flushing target proxy after receiving an exception.", new object[0]);
                    CommonUtils.CatchKnownExceptions(new Action(proxyPool.Flush), null);
                }
                return(false);
            });
        }
Exemplo n.º 7
0
        void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
        {
            MrsTracer.ProxyClient.Function("RemoteSourceMailbox.ExportFolders", new object[0]);
            base.VerifyMailboxConnection();
            if (!base.ServerVersion[54])
            {
                throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "ISourceMailbox_ExportFolders");
            }
            DataExportBatch dataExportBatch = base.MrsProxy.ISourceMailbox_ExportFolders(base.Handle, folderIds, (int)exportFoldersDataToCopyFlags, (int)folderRecFlags, DataConverter <PropTagConverter, PropTag, int> .GetData(additionalFolderRecProps), (int)copyPropertiesFlags, DataConverter <PropTagConverter, PropTag, int> .GetData(excludeProps), (int)extendedAclFlags);

            using (IDataImport dataImport = new FxProxyPoolReceiver(proxyPool, false))
            {
                using (BufferedReceiver bufferedReceiver = new BufferedReceiver(dataImport, false, base.MrsProxyClient.UseBuffering, base.MrsProxyClient.UseCompression))
                {
                    RemoteDataExport.ExportRoutine(base.MrsProxy, dataExportBatch.DataExportHandle, bufferedReceiver, dataExportBatch, base.MrsProxyClient.UseCompression);
                }
            }
        }