// Token: 0x06000351 RID: 849 RVA: 0x00011FC4 File Offset: 0x000101C4 public static ADNotificationRequestCookie RegisterChangeNotification <T>(ADObjectId baseDN, ADNotificationCallback callback, object context, int retryCount) where T : ADConfigurationObject, new() { object wrappedContext; ADNotificationAdapter.CreateWrappedContextForRegisterChangeNotification(ref baseDN, callback, context, out wrappedContext); return(ADNotificationAdapter.RegisterChangeNotification <T>(baseDN, wrappedContext, true, retryCount)); }
// Token: 0x0600035F RID: 863 RVA: 0x000125A0 File Offset: 0x000107A0 public static bool TryReadConfiguration <T>(ADConfigurationReader <T> configurationReader, out T result, int retryCount, out ADOperationResult operationStatus) { if (configurationReader == null) { throw new ArgumentNullException("configurationReader"); } if (retryCount < 0) { throw new ArgumentOutOfRangeException("retryCount", "Number of retries must be equal to or larger than zero."); } result = default(T); T objectReturned = result; operationStatus = ADNotificationAdapter.TryRunADOperation(delegate() { objectReturned = configurationReader(); }, retryCount); result = objectReturned; if (operationStatus.Succeeded) { return(result != null); } if (operationStatus.Exception is ComputerNameNotCurrentlyAvailableException) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_DSC_EVENT_FIND_LOCAL_SERVER_FAILED, Environment.MachineName, new object[] { operationStatus.Exception.Message, Environment.MachineName }); } return(false); }
internal static ThrottlingPolicy ReadThrottlingPolicyFromAD(IConfigurationSession session, object id, Func <IConfigurationSession, object, ThrottlingPolicy> getPolicy) { ThrottlingPolicy policy = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { session.SessionSettings.IsSharedConfigChecked = true; policy = getPolicy(session, id); }); if (!adoperationResult.Succeeded && adoperationResult.Exception != null) { ThrottlingPolicyCache.Tracer.TraceError <string, string, object>(0L, "Encountered exception reading throttling policy. Exception Class: {0}, Message: {1}, Key: {2}", adoperationResult.Exception.GetType().FullName, adoperationResult.Exception.Message, id); } if (policy != null) { ValidationError[] array = policy.Validate(); if (array != null && array.Length > 0) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_FailedToReadThrottlingPolicy, id.ToString(), new object[] { id, array[0].Description }); policy = null; } } return(policy); }
// Token: 0x0600035A RID: 858 RVA: 0x00012274 File Offset: 0x00010474 public static ADNotificationRequestCookie RegisterExchangeTopologyChangeNotification(ADNotificationCallback callback, object context, ExchangeTopologyScope topologyType) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 387, "RegisterExchangeTopologyChangeNotification", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADNotificationAdapter.cs"); ADObjectId childId = topologyConfigurationSession.ConfigurationNamingContext.GetChildId("CN", "Sites"); ADObjectId childId2 = childId.GetChildId("CN", "Inter-Site Transports").GetChildId("CN", "IP"); ADObjectId orgContainerId = topologyConfigurationSession.GetOrgContainerId(); ADNotificationRequest[] requests; switch (topologyType) { case ExchangeTopologyScope.Complete: requests = new ADNotificationRequest[] { ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADSubnet>(childId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ReceiveConnector>(orgContainerId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADEmailTransport>(orgContainerId, callback, context).Requests[0] }; break; case ExchangeTopologyScope.ServerAndSiteTopology: requests = new ADNotificationRequest[] { ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0] }; break; case ExchangeTopologyScope.ADAndExchangeServerAndSiteTopology: requests = new ADNotificationRequest[] { ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0] }; break; case ExchangeTopologyScope.ADAndExchangeServerAndSiteAndVirtualDirectoryTopology: requests = new ADNotificationRequest[] { ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0], ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0] }; break; default: throw new ArgumentException("topologyType", "topologyType"); } return(new ADNotificationRequestCookie(requests)); }
// Token: 0x060072B9 RID: 29369 RVA: 0x0017BC24 File Offset: 0x00179E24 internal override IThrottlingPolicy InternalLookup() { ExchangeConfigurationUnit cu = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { PartitionId partitionIdByAcceptedDomainName = ADAccountPartitionLocator.GetPartitionIdByAcceptedDomainName(this.principal.DelegatedOrganization); if (partitionIdByAcceptedDomainName != null) { ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsPartitionId(partitionIdByAcceptedDomainName); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 86, "InternalLookup", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\throttling\\DelegatedPrincipalBudgetKey.cs"); tenantConfigurationSession.SessionSettings.IsSharedConfigChecked = true; cu = tenantConfigurationSession.GetExchangeConfigurationUnitByNameOrAcceptedDomain(this.principal.DelegatedOrganization); } if (cu == null) { throw new CannotResolveTenantNameException(DirectoryStrings.CannotResolveTenantNameByAcceptedDomain(this.principal.DelegatedOrganization)); } }); if (!adoperationResult.Succeeded) { ExTraceGlobals.ClientThrottlingTracer.TraceError <string, string, Exception>((long)this.GetHashCode(), "[DelegatedPrincipalBudgetKey.Lookup] Failed to find Delegated Organization: '{0}' for user '{1}', using global throttling policy. Exception: '{2}'", this.principal.DelegatedOrganization, this.principal.UserId, adoperationResult.Exception); return(ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy()); } OrganizationId orgId = cu.OrganizationId; if (cu.SupportedSharedConfigurations.Count > 0) { SharedConfiguration sharedConfig = null; adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { sharedConfig = SharedConfiguration.GetSharedConfiguration(cu.OrganizationId); }); if (!adoperationResult.Succeeded) { ExTraceGlobals.ClientThrottlingTracer.TraceError <OrganizationId, Exception>((long)this.GetHashCode(), "[DelegatedPrincipalBudgetKey.Lookup] Failed to get Shared Configuration Organization: '{0}', using global throttling policy. Exception: '{1}'", cu.OrganizationId, adoperationResult.Exception); return(ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy()); } if (sharedConfig != null) { orgId = sharedConfig.SharedConfigId; } } return(base.ADRetryLookup(delegate { ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(orgId); IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 149, "InternalLookup", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\throttling\\DelegatedPrincipalBudgetKey.cs"); tenantOrTopologyConfigurationSession.SessionSettings.IsSharedConfigChecked = true; ThrottlingPolicy organizationThrottlingPolicy = tenantOrTopologyConfigurationSession.GetOrganizationThrottlingPolicy(orgId, false); if (organizationThrottlingPolicy == null) { ExTraceGlobals.ClientThrottlingTracer.TraceError <string, string>((long)this.GetHashCode(), "[DelegatedPrincipalBudgetKey.Lookup] Failed to find Default Throttling Policy for '{0}\\{1}', using global throttling policy", this.principal.DelegatedOrganization, this.principal.UserId); return ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy(); } return organizationThrottlingPolicy.GetEffectiveThrottlingPolicy(true); })); }
// Token: 0x0600036B RID: 875 RVA: 0x00012AE8 File Offset: 0x00010CE8 private static void CreateWrappedContextForRegisterChangeNotification(ref ADObjectId baseDN, ADNotificationCallback callback, object context, out object wrappedContext) { if (callback == null) { throw new ArgumentNullException("callback"); } if (baseDN == null) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 1089, "CreateWrappedContextForRegisterChangeNotification", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADNotificationAdapter.cs"); baseDN = topologyConfigurationSession.GetOrgContainerId(); } ExTraceGlobals.ADNotificationsTracer.TraceDebug <ADObjectId, string, string>(0L, "new change notification registration for {0} from {1}.{2}", baseDN, callback.Method.DeclaringType.FullName, callback.Method.Name); wrappedContext = ADNotificationAdapter.CreateWrappingContext(callback, context); }
// Token: 0x06000356 RID: 854 RVA: 0x000121D0 File Offset: 0x000103D0 public static ADOperationResult TryRegisterChangeNotification <T>(Func <ADObjectId> baseDNGetter, ADNotificationCallback callback, object context, int retryCount, out ADNotificationRequestCookie cookie) where T : ADConfigurationObject, new() { cookie = null; ADNotificationRequestCookie returnedCookie = cookie; ADOperationResult result = ADNotificationAdapter.TryRunADOperation(delegate() { ADObjectId baseDN = (baseDNGetter == null) ? null : baseDNGetter(); object wrappedContext; ADNotificationAdapter.CreateWrappedContextForRegisterChangeNotification(ref baseDN, callback, context, out wrappedContext); returnedCookie = ADNotificationAdapter.RegisterChangeNotification <T>(baseDN, wrappedContext, false, 0); }, retryCount); cookie = returnedCookie; return(result); }
protected internal IThrottlingPolicy ADRetryLookup(Func <IThrottlingPolicy> policyLookup) { IThrottlingPolicy policy = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { policy = policyLookup(); }); if (!adoperationResult.Succeeded) { ExTraceGlobals.ClientThrottlingTracer.TraceError <Exception>((long)this.GetHashCode(), "[LookupBudgetKey.ADRetryLookup] Failed to lookup throttling policy. Failed with exception '{0}'", adoperationResult.Exception); return(ThrottlingPolicyCache.Singleton.GetGlobalThrottlingPolicy()); } return(policy); }
// Token: 0x06000361 RID: 865 RVA: 0x00012710 File Offset: 0x00010910 public static void ReadConfigurationPaged <T>(ADConfigurationReader <ADPagedReader <T> > configurationReader, ADConfigurationProcessor <T> configurationProcessor, int retryCount) where T : IConfigurable, new() { if (configurationProcessor == null) { throw new ArgumentNullException("configurationProcessor"); } ADPagedReader <T> pagedReader = ADNotificationAdapter.ReadConfiguration <ADPagedReader <T> >(configurationReader, retryCount); IEnumerator <T> enumerator = null; ADNotificationAdapter.RunADOperation(delegate() { enumerator = pagedReader.GetEnumerator(); }, retryCount); Breadcrumbs <Exception> exceptions = new Breadcrumbs <Exception>(32); try { for (;;) { bool hasMore = false; ADNotificationAdapter.RunADOperation(delegate() { try { hasMore = enumerator.MoveNext(); } catch (Exception bc) { exceptions.Drop(bc); enumerator.Dispose(); enumerator = pagedReader.GetEnumerator(); throw; } }, retryCount); if (!hasMore) { break; } configurationProcessor(enumerator.Current); } } finally { enumerator.Dispose(); } }
// Token: 0x06000352 RID: 850 RVA: 0x00012014 File Offset: 0x00010214 public static ADNotificationRequestCookie RegisterChangeNotification <T>(ADObjectId baseDN, object wrappedContext, bool wrapAsADOperation, int retryCount) where T : ADConfigurationObject, new() { ADNotificationRequestCookie cookie = null; if (wrapAsADOperation) { ADNotificationAdapter.RunADOperation(delegate() { cookie = ADNotificationAdapter.RegisterChangeNotification <T>(baseDN, new ADNotificationCallback(ADNotificationAdapter.OnNotification), wrappedContext); }, retryCount); } else { cookie = ADNotificationAdapter.RegisterChangeNotification <T>(baseDN, new ADNotificationCallback(ADNotificationAdapter.OnNotification), wrappedContext); } return(cookie); }
// Token: 0x0600035C RID: 860 RVA: 0x000124F8 File Offset: 0x000106F8 public static T ReadConfiguration <T>(ADConfigurationReader <T> configurationReader, int retryCount) { if (configurationReader == null) { throw new ArgumentNullException("configurationReader"); } if (retryCount < 0) { throw new ArgumentOutOfRangeException("retryCount", "Number of retries must be equal to or larger than zero."); } T result = default(T); ADNotificationAdapter.RunADOperation(delegate() { result = configurationReader(); }, retryCount); return(result); }
// Token: 0x06000368 RID: 872 RVA: 0x000129FC File Offset: 0x00010BFC public static ADOperationResult TryRunADOperation(ADOperation adOperation, int retryCount) { try { ADNotificationAdapter.RunADOperation(adOperation, retryCount); } catch (TransientException ex) { ExTraceGlobals.ADNotificationsTracer.TraceDebug <TransientException>(0L, "AD operation failed with exception: {0}", ex); return(new ADOperationResult(ADOperationErrorCode.RetryableError, ex)); } catch (DataSourceOperationException ex2) { ExTraceGlobals.ADNotificationsTracer.TraceDebug <DataSourceOperationException>(0L, "AD operation failed with exception: {0}", ex2); return(new ADOperationResult(ADOperationErrorCode.PermanentError, ex2)); } catch (DataValidationException ex3) { ExTraceGlobals.ADNotificationsTracer.TraceDebug <DataValidationException>(0L, "AD operation failed with exception: {0}", ex3); return(new ADOperationResult(ADOperationErrorCode.PermanentError, ex3)); } return(ADOperationResult.Success); }
// Token: 0x06000367 RID: 871 RVA: 0x000129F0 File Offset: 0x00010BF0 public static ADOperationResult TryRunADOperation(ADOperation adOperation) { return(ADNotificationAdapter.TryRunADOperation(adOperation, 10)); }
// Token: 0x06000365 RID: 869 RVA: 0x0001295C File Offset: 0x00010B5C public static void RunADOperation(ADOperation adOperation) { ADNotificationAdapter.RunADOperation(adOperation, 10); }
// Token: 0x06000364 RID: 868 RVA: 0x00012880 File Offset: 0x00010A80 public static bool TryReadConfigurationPaged <T>(ADConfigurationReader <ADPagedReader <T> > configurationReader, ADConfigurationProcessor <T> configurationProcessor, int retryCount, out ADOperationResult operationStatus) where T : IConfigurable, new() { if (configurationProcessor == null) { throw new ArgumentNullException("configurationProcessor"); } ADPagedReader <T> pagedReader; if (!ADNotificationAdapter.TryReadConfiguration <ADPagedReader <T> >(configurationReader, out pagedReader, retryCount, out operationStatus)) { return(false); } IEnumerator <T> enumerator = null; operationStatus = ADNotificationAdapter.TryRunADOperation(delegate() { enumerator = pagedReader.GetEnumerator(); }, retryCount); if (!operationStatus.Succeeded) { return(false); } Breadcrumbs <Exception> exceptions = new Breadcrumbs <Exception>(32); try { for (;;) { bool hasMore = false; operationStatus = ADNotificationAdapter.TryRunADOperation(delegate() { try { hasMore = enumerator.MoveNext(); } catch (Exception bc) { exceptions.Drop(bc); enumerator.Dispose(); enumerator = pagedReader.GetEnumerator(); throw; } }, retryCount); if (!operationStatus.Succeeded) { break; } if (!hasMore) { goto IL_AB; } configurationProcessor(enumerator.Current); } return(false); IL_AB :; } finally { enumerator.Dispose(); } return(true); }
// Token: 0x0600035B RID: 859 RVA: 0x000124D2 File Offset: 0x000106D2 public static T ReadConfiguration <T>(ADConfigurationReader <T> configurationReader) { return(ADNotificationAdapter.ReadConfiguration <T>(configurationReader, 10)); }
// Token: 0x06000357 RID: 855 RVA: 0x00012222 File Offset: 0x00010422 public static void UnregisterChangeNotification(ADNotificationRequestCookie request) { ADNotificationAdapter.UnregisterChangeNotification(request, false); }
// Token: 0x0600035E RID: 862 RVA: 0x00012578 File Offset: 0x00010778 public static bool TryReadConfiguration <T>(ADConfigurationReader <T> configurationReader, out T result, out ADOperationResult operationStatus) { return(ADNotificationAdapter.TryReadConfiguration <T>(configurationReader, out result, 10, out operationStatus)); }
// Token: 0x06000359 RID: 857 RVA: 0x00012267 File Offset: 0x00010467 public static ADNotificationRequestCookie RegisterExchangeTopologyChangeNotification(ADNotificationCallback callback, object context) { return(ADNotificationAdapter.RegisterExchangeTopologyChangeNotification(callback, context, ExchangeTopologyScope.ADAndExchangeServerAndSiteTopology)); }
// Token: 0x0600035D RID: 861 RVA: 0x00012560 File Offset: 0x00010760 public static bool TryReadConfiguration <T>(ADConfigurationReader <T> configurationReader, out T result) { ADOperationResult adoperationResult; return(ADNotificationAdapter.TryReadConfiguration <T>(configurationReader, out result, 10, out adoperationResult)); }
// Token: 0x06000353 RID: 851 RVA: 0x00012083 File Offset: 0x00010283 public static ADNotificationRequestCookie RegisterChangeNotification <T>(ADObjectId baseDN, ADNotificationCallback callback, object context) where T : ADConfigurationObject, new() { return(ADNotificationAdapter.RegisterChangeNotification <T>(Activator.CreateInstance <T>(), baseDN, callback, context)); }
// Token: 0x06000355 RID: 853 RVA: 0x00012150 File Offset: 0x00010350 public static ADOperationResult TryRegisterChangeNotification <T>(ADObjectId baseDN, ADNotificationCallback callback, int retryCount, out ADNotificationRequestCookie cookie) where T : ADConfigurationObject, new() { return(ADNotificationAdapter.TryRegisterChangeNotification <T>(() => baseDN, callback, null, retryCount, out cookie)); }
// Token: 0x06000363 RID: 867 RVA: 0x000127DC File Offset: 0x000109DC public static bool TryReadConfigurationPaged <T>(ADConfigurationReader <ADPagedReader <T> > configurationReader, ADConfigurationProcessor <T> configurationProcessor, out ADOperationResult operationStatus) where T : IConfigurable, new() { return(ADNotificationAdapter.TryReadConfigurationPaged <T>(configurationReader, configurationProcessor, 10, out operationStatus)); }
// Token: 0x06000360 RID: 864 RVA: 0x0001266D File Offset: 0x0001086D public static void ReadConfigurationPaged <T>(ADConfigurationReader <ADPagedReader <T> > configurationReader, ADConfigurationProcessor <T> configurationProcessor) where T : IConfigurable, new() { ADNotificationAdapter.ReadConfigurationPaged <T>(configurationReader, configurationProcessor, 10); }
// Token: 0x06000350 RID: 848 RVA: 0x00011FB8 File Offset: 0x000101B8 public static ADNotificationRequestCookie RegisterChangeNotification <T>(ADObjectId baseDN, ADNotificationCallback callback) where T : ADConfigurationObject, new() { return(ADNotificationAdapter.RegisterChangeNotification <T>(baseDN, callback, null, 10)); }