protected override void InternalDispose(bool calledFromDispose) { if (calledFromDispose && this.MailboxMerger != null) { this.MailboxMerger.UnconfigureProviders(); this.MailboxMerger = null; } base.InternalDispose(calledFromDispose); }
public override void Initialize(TransactionalRequestJob mergeRequest) { base.Initialize(mergeRequest); if (mergeRequest.RequestType == MRSRequestType.MailboxImport || mergeRequest.RequestType == MRSRequestType.MailboxExport || mergeRequest.RequestType == MRSRequestType.MailboxRestore || mergeRequest.RequestType == MRSRequestType.Sync) { return; } base.RequestJobIdentity = mergeRequest.Identity.ToString(); bool flag = mergeRequest.RequestStyle == RequestStyle.CrossOrg && mergeRequest.Direction == RequestDirection.Pull; bool flag2 = mergeRequest.RequestStyle == RequestStyle.CrossOrg && mergeRequest.Direction == RequestDirection.Push; LocalizedString sourceTracingID = LocalizedString.Empty; LocalizedString targetTracingID = LocalizedString.Empty; string orgID = (mergeRequest.OrganizationId != null && mergeRequest.OrganizationId.OrganizationalUnit != null) ? (mergeRequest.OrganizationId.OrganizationalUnit.Name + "\\") : string.Empty; Guid guid; if (flag) { guid = Guid.Empty; sourceTracingID = MrsStrings.RPCHTTPMailboxId(mergeRequest.RemoteMailboxLegacyDN); } else { guid = mergeRequest.SourceExchangeGuid; sourceTracingID = (mergeRequest.SourceIsArchive ? MrsStrings.ArchiveMailboxTracingId(orgID, guid) : MrsStrings.PrimaryMailboxTracingId(orgID, guid)); } Guid guid2; if (flag2) { guid2 = Guid.Empty; targetTracingID = MrsStrings.RPCHTTPMailboxId(mergeRequest.RemoteMailboxLegacyDN); } else { guid2 = mergeRequest.TargetExchangeGuid; targetTracingID = (mergeRequest.TargetIsArchive ? MrsStrings.ArchiveMailboxTracingId(orgID, guid2) : MrsStrings.PrimaryMailboxTracingId(orgID, guid2)); } MailboxCopierFlags mailboxCopierFlags = MailboxCopierFlags.Merge; if (mergeRequest.RequestStyle == RequestStyle.CrossOrg) { mailboxCopierFlags |= MailboxCopierFlags.CrossOrg; } if (mergeRequest.SourceIsArchive) { mailboxCopierFlags |= MailboxCopierFlags.SourceIsArchive; } if (mergeRequest.TargetIsArchive) { mailboxCopierFlags |= MailboxCopierFlags.TargetIsArchive; } this.MailboxMerger = new MailboxMerger(guid, guid2, mergeRequest, this, mailboxCopierFlags, sourceTracingID, targetTracingID); }
private void EnumerateAndReplayActions(MailboxMerger mbxContext, MergeSyncContext syncContext) { if (mbxContext.ReplaySyncState == null) { mbxContext.ReplaySyncState = new ReplaySyncState(); } string text = mbxContext.ReplaySyncState.ProviderState; bool flag = true; int num = 0; while (flag) { MergeSyncContext mergeSyncContext = (MergeSyncContext)base.MailboxMerger.CreateSyncContext(); string text2; ReplayActionsQueue andTranslateActions = mbxContext.GetAndTranslateActions(text, this.GetActionsPageSize, mergeSyncContext, out text2, out flag); base.Report.Append(MrsStrings.ReportReplayActionsEnumerated(mbxContext.TargetTracingID, andTranslateActions.Count, num)); try { mbxContext.ReplayActions(andTranslateActions, mergeSyncContext); text = text2; syncContext.NumberOfActionsReplayed += mergeSyncContext.NumberOfActionsReplayed; syncContext.NumberOfActionsIgnored += mergeSyncContext.NumberOfActionsIgnored; } catch (MailboxReplicationTransientException) { if (mergeSyncContext.LastActionProcessed != null) { text = mergeSyncContext.LastActionProcessed.Watermark; } } finally { base.Report.Append(MrsStrings.ReportReplayActionsSynced(mbxContext.TargetTracingID, mergeSyncContext.NumberOfActionsReplayed, mergeSyncContext.NumberOfActionsIgnored)); mbxContext.ReplaySyncState.ProviderState = text; mbxContext.SaveReplaySyncState(); } num++; } base.Report.Append(MrsStrings.ReportReplayActionsCompleted(mbxContext.TargetTracingID, syncContext.NumberOfActionsReplayed, syncContext.NumberOfActionsIgnored)); }
public MergeSyncContext(MailboxMerger merger) : base(merger.SourceHierarchy, merger.DestHierarchy) { this.Merger = merger; }