Ejemplo n.º 1
0
        protected void PopulateDomainNamingContexts(string partitionFqdn)
        {
            TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
            ADServerInfo defaultServerInfo = this.GetDefaultServerInfo(partitionFqdn);

            if (string.IsNullOrEmpty(defaultServerInfo.WritableNC) || string.IsNullOrEmpty(defaultServerInfo.RootDomainNC))
            {
                PooledLdapConnection pooledLdapConnection = LdapConnectionPool.CreateOneTimeConnection(null, defaultServerInfo, LocatorFlags.None);
                try
                {
                    if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.WritableNC) && !TopologyProvider.IsAdamTopology())
                    {
                        this.LogRootDSEReadFailureAndThrow("domainNamingContext", defaultServerInfo.FqdnPlusPort);
                    }
                    this.domainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.WritableNC);
                    if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.RootDomainNC) && !TopologyProvider.IsAdamTopology())
                    {
                        this.LogRootDSEReadFailureAndThrow("rootDomainNamingContext", defaultServerInfo.FqdnPlusPort);
                    }
                    this.rootDomainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.RootDomainNC);
                    return;
                }
                finally
                {
                    pooledLdapConnection.ReturnToPool();
                }
            }
            this.domainNCs[partitionFqdn]     = ADObjectId.ParseExtendedDN(defaultServerInfo.WritableNC);
            this.rootDomainNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(defaultServerInfo.RootDomainNC);
        }
Ejemplo n.º 2
0
        protected void PopulateConfigNamingContexts(string partitionFqdn)
        {
            TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
            ADServerInfo configDCInfo = this.GetConfigDCInfo(partitionFqdn, true);

            if (string.IsNullOrEmpty(configDCInfo.ConfigNC) || string.IsNullOrEmpty(configDCInfo.SchemaNC))
            {
                PooledLdapConnection pooledLdapConnection = LdapConnectionPool.CreateOneTimeConnection(null, configDCInfo, LocatorFlags.None);
                try
                {
                    if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.ConfigNC))
                    {
                        this.LogRootDSEReadFailureAndThrow("configurationNamingContext", configDCInfo.FqdnPlusPort);
                    }
                    this.configNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.ConfigNC);
                    if (string.IsNullOrEmpty(pooledLdapConnection.ADServerInfo.SchemaNC))
                    {
                        this.LogRootDSEReadFailureAndThrow("schemaNamingContext", configDCInfo.FqdnPlusPort);
                    }
                    this.schemaNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(pooledLdapConnection.ADServerInfo.SchemaNC);
                    return;
                }
                finally
                {
                    pooledLdapConnection.ReturnToPool();
                }
            }
            this.configNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(configDCInfo.ConfigNC);
            this.schemaNCs[partitionFqdn] = ADObjectId.ParseExtendedDN(configDCInfo.SchemaNC);
        }
Ejemplo n.º 3
0
 public override IList <TopologyVersion> GetTopologyVersions(IList <string> partitionFqdns)
 {
     if (partitionFqdns == null)
     {
         throw new ArgumentNullException("partitionFqdns");
     }
     ExTraceGlobals.TopologyProviderTracer.Information <int>((long)this.GetHashCode(), "GetTopologyVersions. Partitions {0}", partitionFqdns.Count);
     TopologyVersion[] array = new TopologyVersion[partitionFqdns.Count];
     LdapTopologyProvider.MiniTopology miniTopology = null;
     for (int i = 0; i < partitionFqdns.Count; i++)
     {
         TopologyProvider.EnforceNonEmptyPartition(partitionFqdns[i]);
         int version = 1;
         if (this.topologies.TryGetValue(partitionFqdns[i], out miniTopology))
         {
             version = miniTopology.Version;
         }
         array[i] = new TopologyVersion(partitionFqdns[i], version);
     }
     if (ExTraceGlobals.TopologyProviderTracer.IsTraceEnabled(TraceType.InfoTrace))
     {
         ExTraceGlobals.TopologyProviderTracer.Information <string>((long)this.GetHashCode(), "GetTopologyVersions. Partitions {0}", string.Join(",", (object[])array));
     }
     return(array);
 }
Ejemplo n.º 4
0
        protected void ClearDomainNamingContexts(string partitionFqdn)
        {
            TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
            ADObjectId adobjectId;

            this.domainNCs.TryRemove(partitionFqdn, out adobjectId);
            this.rootDomainNCs.TryRemove(partitionFqdn, out adobjectId);
        }
Ejemplo n.º 5
0
        protected void ClearConfigNamingContexts(string partitionFqdn)
        {
            TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
            ADObjectId adobjectId;

            this.configNCs.TryRemove(partitionFqdn, out adobjectId);
            this.schemaNCs.TryRemove(partitionFqdn, out adobjectId);
        }
Ejemplo n.º 6
0
        internal ADObjectId GetRootDomainNamingContext(string partitionFqdn)
        {
            TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
            ADObjectId result;

            if (!this.rootDomainNCs.TryGetValue(partitionFqdn, out result))
            {
                this.PopulateDomainNamingContexts(partitionFqdn);
                this.rootDomainNCs.TryGetValue(partitionFqdn, out result);
            }
            return(result);
        }
Ejemplo n.º 7
0
        public int GetTopologyVersion(string partitionFqdn)
        {
            TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
            IList <TopologyVersion> topologyVersions = this.GetTopologyVersions(new List <string>
            {
                partitionFqdn
            });

            if (topologyVersions.Count > 0)
            {
                return(topologyVersions[0].Version);
            }
            return(-1);
        }
Ejemplo n.º 8
0
 public string GetConfigDC(string partitionFqdn)
 {
     TopologyProvider.EnforceNonEmptyPartition(partitionFqdn);
     return(this.GetConfigDC(partitionFqdn, true));
 }