Example #1
0
 public void Append(LocalizedString msg, ConnectivityRec connectivityRec)
 {
     this.Append(new ReportEntry(msg)
     {
         Connectivity = connectivityRec
     });
 }
Example #2
0
 public ConnectivityRecWithTimestamp(DateTime timestamp, ConnectivityRec entry)
 {
     this.Timestamp     = timestamp;
     base.ServerKind    = entry.ServerKind;
     base.ServerName    = entry.ServerName;
     base.ServerVersion = entry.ServerVersion;
     base.ProxyName     = entry.ProxyName;
     base.ProxyVersion  = entry.ProxyVersion;
     base.ProviderName  = entry.ProviderName;
 }
Example #3
0
        protected override void MakeConnections()
        {
            Exception sourceConnectFailure = null;
            Exception targetConnectFailure = null;
            int       sourceVersion        = 0;
            int       targetVersion        = 0;
            string    sourceServerName     = null;
            string    targetServerName     = null;

            CommonUtils.CatchKnownExceptions(delegate
            {
                MrsTracer.Service.Debug("Attempting to connect to the destination mailbox {0}.", new object[]
                {
                    this.MailboxMerger.TargetTracingID
                });
                this.MailboxMerger.ConnectDestinationMailbox(MailboxConnectFlags.None);
            }, delegate(Exception failure)
            {
                MrsTracer.Service.Warning("Failed to connect to destination mailbox: {0}", new object[]
                {
                    CommonUtils.FullExceptionMessage(failure)
                });
                targetConnectFailure = failure;
            });
            if (targetConnectFailure == null)
            {
                MailboxServerInformation mailboxServerInformation = this.MailboxMerger.DestMailbox.GetMailboxServerInformation();
                MailboxInformation       mailboxInformation       = this.MailboxMerger.DestMailbox.GetMailboxInformation();
                this.MailboxMerger.TargetServerInfo = mailboxServerInformation;
                if (mailboxServerInformation != null)
                {
                    ConnectivityRec connectivityRec = new ConnectivityRec(ServerKind.Target, mailboxInformation, mailboxServerInformation);
                    base.Report.Append(MrsStrings.ReportDestinationMailboxConnection(this.MailboxMerger.TargetTracingID, mailboxServerInformation.ServerInfoString, (mailboxInformation != null) ? mailboxInformation.MdbName : "(null)"), connectivityRec);
                    targetServerName = mailboxServerInformation.MailboxServerName;
                    targetVersion    = mailboxServerInformation.MailboxServerVersion;
                }
                if (!this.MailboxMerger.DestMailbox.MailboxExists())
                {
                    throw new MailboxDoesNotExistPermanentException(this.MailboxMerger.TargetTracingID);
                }
                MrsTracer.Service.Debug("Destination mailbox {0} exists.", new object[]
                {
                    this.MailboxMerger.TargetTracingID
                });
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulTargetConnection, new DateTime?(DateTime.UtcNow));
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.TargetConnectionFailure, null);
                this.MailboxMerger.LoadSyncState(base.Report);
            }
            if (targetConnectFailure == null)
            {
                this.AfterTargetConnect();
            }
            CommonUtils.CatchKnownExceptions(delegate
            {
                MrsTracer.Service.Debug("Connecting to the source mailbox {0}.", new object[]
                {
                    this.MailboxMerger.SourceTracingID
                });
                this.MailboxMerger.ConnectSourceMailbox(MailboxConnectFlags.None);
            }, delegate(Exception failure)
            {
                MrsTracer.Service.Warning("Failed to connect to source mailbox: {0}", new object[]
                {
                    CommonUtils.FullExceptionMessage(failure)
                });
                sourceConnectFailure = failure;
            });
            if (sourceConnectFailure == null)
            {
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulSourceConnection, new DateTime?(DateTime.UtcNow));
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.SourceConnectionFailure, null);
                MailboxServerInformation mailboxServerInformation2 = this.MailboxMerger.SourceMailbox.GetMailboxServerInformation();
                MailboxInformation       mailboxInformation2       = this.MailboxMerger.SourceMailbox.GetMailboxInformation();
                this.MailboxMerger.SourceServerInfo = mailboxServerInformation2;
                if (mailboxServerInformation2 != null)
                {
                    ConnectivityRec connectivityRec2 = new ConnectivityRec(ServerKind.Source, mailboxInformation2, mailboxServerInformation2);
                    base.Report.Append(MrsStrings.ReportSourceMailboxConnection(this.MailboxMerger.SourceTracingID, mailboxServerInformation2.ServerInfoString, (mailboxInformation2 != null) ? mailboxInformation2.MdbName : "(null)"), connectivityRec2);
                    sourceServerName = mailboxServerInformation2.MailboxServerName;
                    sourceVersion    = mailboxServerInformation2.MailboxServerVersion;
                }
            }
            if (sourceConnectFailure != null || targetConnectFailure != null)
            {
                base.CheckRequestIsValid();
                if (sourceConnectFailure != null)
                {
                    throw sourceConnectFailure;
                }
                if (targetConnectFailure != null)
                {
                    throw targetConnectFailure;
                }
            }
            base.SaveRequest(true, delegate(TransactionalRequestJob rj)
            {
                this.TimeTracker.SetTimestamp(RequestJobTimestamp.Failure, null);
                this.TimeTracker.SetTimestamp(RequestJobTimestamp.Suspended, null);
                rj.FailureCode   = null;
                rj.FailureType   = null;
                rj.FailureSide   = null;
                rj.Message       = LocalizedString.Empty;
                rj.SourceServer  = sourceServerName;
                rj.SourceVersion = sourceVersion;
                rj.TargetServer  = targetServerName;
                rj.TargetVersion = targetVersion;
                rj.Status        = RequestStatus.InProgress;
                this.TimeTracker.CurrentState = RequestState.InitialSeeding;
                RequestJobLog.Write(rj);
            });
            if (!string.IsNullOrEmpty(base.CachedRequestJob.ContentFilter))
            {
                RestrictionData contentRestriction;
                string          text;
                ContentFilterBuilder.ProcessContentFilter(base.CachedRequestJob.ContentFilter, base.CachedRequestJob.ContentFilterLCID, null, this.MailboxMerger.SourceMailboxWrapper, out contentRestriction, out text);
                this.MailboxMerger.ContentRestriction = contentRestriction;
            }
            if (this.MailboxMerger.SupportsRuleAPIs)
            {
                this.MailboxMerger.SourceMailbox.ConfigMailboxOptions(MailboxOptions.IgnoreExtendedRuleFAIs);
            }
            this.MailboxMerger.ExchangeSourceAndTargetVersions();
            base.ScheduleWorkItem(new Action(this.StartMerge), WorkloadType.Unknown);
        }