internal static MserveWebService CreateDefaultMserveWebService(string domainController, bool batchMode, int initialChunkSize) { ITopologyConfigurationSession rootOrgSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(domainController, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 200, "CreateDefaultMserveWebService", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\EdgeSyncMservConnector.cs"); EdgeSyncServiceConfig config = null; string clientToken = null; ADSite localSite = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { localSite = rootOrgSession.GetLocalSite(); if (localSite == null) { throw new TransientException(DirectoryStrings.CannotGetLocalSite); } config = rootOrgSession.Read <EdgeSyncServiceConfig>(localSite.Id.GetChildId("EdgeSyncService")); clientToken = EdgeSyncMservConnector.GetMserveWebServiceClientTokenFromEndpointConfig(rootOrgSession); }, 3); if (!adoperationResult.Succeeded) { throw adoperationResult.Exception; } if (config == null) { throw new MserveException(string.Format("No EdgeSync configuration found. Site {0}", localSite.DistinguishedName)); } if (string.IsNullOrEmpty(clientToken)) { throw new InvalidOperationException(string.Format("clientToken from Endpoint configuration is null or empty . Site {0}", localSite.DistinguishedName)); } List <EdgeSyncMservConnector> connectors = new List <EdgeSyncMservConnector>(); if (!ADNotificationAdapter.TryReadConfigurationPaged <EdgeSyncMservConnector>(() => rootOrgSession.FindPaged <EdgeSyncMservConnector>(config.Id, QueryScope.SubTree, null, null, 0), delegate(EdgeSyncMservConnector connector) { connectors.Add(connector); }, 3, out adoperationResult)) { throw adoperationResult.Exception; } if (connectors.Count == 0) { throw new InvalidOperationException(string.Format("No MServ configuration found. Site {0}", localSite.DistinguishedName)); } MserveWebService mserveWebService = new MserveWebService(connectors[0].ProvisionUrl.AbsoluteUri, connectors[0].SettingUrl.AbsoluteUri, connectors[0].RemoteCertificate, clientToken, batchMode); mserveWebService.Initialize(initialChunkSize); return(mserveWebService); }
internal static string GetRedirectServerFromPartnerId(string redirectFormat, int partnerId, int currentSiteId, int startRange, int endRange, Trace tracer, bool overrideCurrentSiteCheck, bool throwExceptions) { if (startRange > endRange) { throw new InvalidOperationException(string.Format("startRange: {0} greater than endRange: {1}", startRange, endRange)); } if (string.IsNullOrEmpty(redirectFormat)) { return(string.Empty); } if (partnerId == -1 || partnerId < startRange || partnerId > endRange) { if (partnerId == -1) { string message = string.Format("The partner id {0} is invalid", partnerId); EdgeSyncMservConnector.TraceError(tracer, message); if (throwExceptions) { throw new InvalidPartnerIdException(message); } } else { string message2 = string.Format("The partner id {0} is out of range", partnerId); EdgeSyncMservConnector.TraceError(tracer, message2); if (throwExceptions) { throw new InvalidOperationException(message2); } } return(string.Empty); } if (partnerId == currentSiteId && !overrideCurrentSiteCheck) { EdgeSyncMservConnector.TraceDebug(tracer, string.Format("The partner id {0} is the same as the current site id", partnerId)); return(string.Empty); } return(string.Format(CultureInfo.InvariantCulture, redirectFormat, new object[] { partnerId })); }
internal static string GetRedirectServerFromPartnerId(string redirectFormat, int partnerId, int currentSiteId, int startRange, int endRange, Trace tracer) { return(EdgeSyncMservConnector.GetRedirectServerFromPartnerId(redirectFormat, partnerId, currentSiteId, startRange, endRange, tracer, false, false)); }
internal static string GetRedirectServer(string redirectFormat, string address, int currentSiteId, int startRange, int endRange) { return(EdgeSyncMservConnector.GetRedirectServer(redirectFormat, address, currentSiteId, startRange, endRange, false, false)); }
internal static MserveWebService CreateDefaultMserveWebService(string domainController, bool batchMode) { return(EdgeSyncMservConnector.CreateDefaultMserveWebService(domainController, batchMode, 0)); }
internal static MserveWebService CreateDefaultMserveWebService(string domainController) { return(EdgeSyncMservConnector.CreateDefaultMserveWebService(null, false)); }