Example #1
0
        public TopologyServer GetTopologyServer(ADObjectId serverId)
        {
            TopologyServer topologyServer = null;

            this.exchangeServerDictionary.TryGetValue(serverId.DistinguishedName, out topologyServer);
            ExTraceGlobals.ExchangeTopologyTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Mapped {0} to {1}", serverId.DistinguishedName, (topologyServer == null) ? "<null>" : topologyServer.Name);
            return(topologyServer);
        }
Example #2
0
        // Token: 0x06004F87 RID: 20359 RVA: 0x001252FC File Offset: 0x001234FC
        private void BuildInitialLinks()
        {
            ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int>(0L, "PFD ADPEXT {0} - Creating topology objects and building links", 18613);
            this.aDServerSiteDictionary = new Dictionary <string, TopologySite>(StringComparer.OrdinalIgnoreCase);
            this.siteADServerDictionary = new Dictionary <string, List <ADServer> >(StringComparer.OrdinalIgnoreCase);
            this.topoSites      = new List <TopologySite>(this.sites.Count);
            this.topoSiteLinks  = new List <TopologySiteLink>(this.siteLinks.Count);
            this.siteDictionary = new Dictionary <string, TopologySite>(this.sites.Count, StringComparer.OrdinalIgnoreCase);
            this.topoServers    = new List <TopologyServer>(this.servers.Count);
            Dictionary <TopologySite, List <ITopologySiteLink> > dictionary = new Dictionary <TopologySite, List <ITopologySiteLink> >(this.sites.Count);
            bool flag = ExchangeTopologyDiscovery.IncludeADServers(this.topologyScope);

            ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int>(0L, "PFD ADPEXT {0} - Creating TopologySites and hash them by site DN", 22709);
            foreach (ADSite site in this.sites)
            {
                TopologySite topologySite = new TopologySite(site);
                this.siteDictionary.Add(topologySite.DistinguishedName, topologySite);
                dictionary.Add(topologySite, new List <ITopologySiteLink>());
                this.topoSites.Add(topologySite);
            }
            ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int>(0L, "PFD ADPEXT {0} - Creating TopologySiteLinks and filling the TopologySites collection", 30901);
            foreach (ADSiteLink adsiteLink in this.siteLinks)
            {
                TopologySiteLink     topologySiteLink = new TopologySiteLink(adsiteLink);
                List <ITopologySite> list             = new List <ITopologySite>(topologySiteLink.Sites.Count);
                foreach (ADObjectId adobjectId in topologySiteLink.Sites)
                {
                    TopologySite topologySite2 = null;
                    if (!this.siteDictionary.TryGetValue(adobjectId.DistinguishedName, out topologySite2))
                    {
                        ExTraceGlobals.ExchangeTopologyTracer.TraceWarning <string, string>(0L, "Site link {0} points to nonexistent site {1} (likely a transient replication issue). Ignoring this pointer.", adsiteLink.Name, adobjectId.DistinguishedName);
                    }
                    else
                    {
                        list.Add(topologySite2);
                        dictionary[topologySite2].Add(topologySiteLink);
                    }
                }
                topologySiteLink.TopologySites = new ReadOnlyCollection <ITopologySite>(list);
                this.topoSiteLinks.Add(topologySiteLink);
            }
            ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int>(0L, "PFD ADPEXT {0} - Filling each site's TopologySiteLinks collection", 16565);
            foreach (TopologySite topologySite3 in this.topoSites)
            {
                List <ITopologySiteLink> list2 = null;
                if (!dictionary.TryGetValue(topologySite3, out list2))
                {
                    if (this.topoSites.Count > 1)
                    {
                        ExTraceGlobals.ExchangeTopologyTracer.TraceWarning <string>(0L, "Site {0} is not linked to any sites.", topologySite3.Name);
                    }
                    list2 = new List <ITopologySiteLink>();
                }
                topologySite3.TopologySiteLinks = new ReadOnlyCollection <ITopologySiteLink>(list2);
            }
            ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int>(0L, "PFD ADPEXT {0} - Creating TopologyServers", 24757);
            foreach (MiniTopologyServer server in this.servers)
            {
                TopologyServer item = new TopologyServer(server);
                this.topoServers.Add(item);
            }
            if (flag)
            {
                ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int>(0L, "PFD ADPEXT {0} - Filling the ADServerSite dictionary with domain controller site mappings", 28853);
                foreach (ADServer adserver in this.aDServers)
                {
                    string       distinguishedName = adserver.Id.Parent.Parent.DistinguishedName;
                    TopologySite topologySite4;
                    if (!this.siteDictionary.TryGetValue(distinguishedName, out topologySite4))
                    {
                        ExTraceGlobals.ExchangeTopologyTracer.TraceWarning <string, string>(0L, "AD Server {0} points to nonexistent site {1} (likely a replication issue).", adserver.DnsHostName, distinguishedName);
                    }
                    else
                    {
                        this.aDServerSiteDictionary[adserver.DnsHostName] = topologySite4;
                        this.aDServerSiteDictionary[adserver.Name]        = topologySite4;
                        ExTraceGlobals.ExchangeTopologyTracer.TraceDebug <string, string>(0L, "ADServer {0} is assigned a static site {1}.", adserver.DnsHostName, topologySite4.Name);
                        List <ADServer> list3;
                        if (!this.siteADServerDictionary.TryGetValue(distinguishedName, out list3))
                        {
                            list3 = new List <ADServer>();
                            this.siteADServerDictionary.Add(distinguishedName, list3);
                            ExTraceGlobals.ExchangeTopologyTracer.TraceDebug <string>(0L, "Adding site {0} to the siteADServerDictionary.", topologySite4.Name);
                        }
                        list3.Add(adserver);
                        ExTraceGlobals.ExchangeTopologyTracer.TraceDebug <string, string>(0L, "Adding ADServer {0} to the siteADServerDictionary under site {1}.", adserver.DnsHostName, topologySite4.Name);
                    }
                }
            }
        }