예제 #1
0
 public static void SetSharedConfigDC(string partitionFqdn, string serverName, int port)
 {
     using (ServiceTopologyProvider serviceTopologyProvider = new ServiceTopologyProvider())
     {
         serviceTopologyProvider.SetConfigDC(partitionFqdn, serverName, port);
     }
 }
예제 #2
0
        private static TopologyProvider InitializeInstance()
        {
            ExTraceGlobals.TopologyProviderTracer.TraceDebug(0L, "Starting InitializeInstance and waiting for the lock");
            TopologyProvider result;

            lock (TopologyProvider.instanceLockRoot)
            {
                int adamPort;
                switch (TopologyProvider.SelectTopologyMode(out adamPort))
                {
                case TopologyMode.ADTopologyService:
                {
                    ServiceTopologyProvider serviceTopologyProvider = new ServiceTopologyProvider();
                    serviceTopologyProvider.SuppressDisposeTracker();
                    TopologyProvider.staticInstance = serviceTopologyProvider;
                    break;
                }

                case TopologyMode.Adam:
                    TopologyProvider.staticInstance = new AdamTopologyProvider(adamPort);
                    break;

                case TopologyMode.Ldap:
                    TopologyProvider.staticInstance = new LdapTopologyProvider();
                    break;
                }
                ExTraceGlobals.TopologyProviderTracer.TraceDebug <int>(0L, "TopologyProvider::InitializeInstance created {0}", (int)TopologyProvider.CurrentTopologyMode);
                result = TopologyProvider.staticInstance;
            }
            return(result);
        }
예제 #3
0
        public static string GetSharedConfigDC()
        {
            string configDC;

            using (ServiceTopologyProvider serviceTopologyProvider = new ServiceTopologyProvider())
            {
                configDC = serviceTopologyProvider.GetConfigDC(false);
            }
            return(configDC);
        }
예제 #4
0
 private static TopologyMode SelectTopologyMode(out int adamPort)
 {
     adamPort = 0;
     if (AdamTopologyProvider.CheckIfAdamConfigured(out adamPort))
     {
         return(TopologyMode.Adam);
     }
     if (TopologyProvider.userSetTopologyMode != null)
     {
         return(TopologyProvider.userSetTopologyMode.Value);
     }
     if (ServiceTopologyProvider.IsAdTopologyServiceInstalled())
     {
         return(TopologyMode.ADTopologyService);
     }
     return(TopologyMode.Ldap);
 }
예제 #5
0
        public static string GetConfigDC(string partitionFqdn, string serverName)
        {
            if (!Globals.IsDatacenter)
            {
                ExTraceGlobals.ADTopologyTracer.TraceDebug <string, string>(0L, "ADSession::GetConfigDC '{0}' will use local forest '{1}'", partitionFqdn, TopologyProvider.LocalForestFqdn);
                partitionFqdn = TopologyProvider.LocalForestFqdn;
            }
            string fqdn;

            using (ServiceTopologyProvider serviceTopologyProvider = new ServiceTopologyProvider(serverName))
            {
                ADServerInfo configDCInfo = serviceTopologyProvider.GetConfigDCInfo(partitionFqdn, false);
                if (configDCInfo == null)
                {
                    throw new ADTransientException(DirectoryStrings.ExceptionADTopologyUnexpectedError(serverName, string.Empty));
                }
                fqdn = configDCInfo.Fqdn;
            }
            return(fqdn);
        }