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);
        }
Esempio n. 2
0
 public IRegisteredExchangeTopologyNotification RegisterExchangeTopologyNotification(ADNotificationCallback callback, ExchangeTopologyScope scope)
 {
     return(new RegisteredExchangeTopologyNotification(callback, scope));
 }
        private static ADNotificationRequestCookie RegisterChangeNotification <T>(T dummyObject, ADObjectId baseDN, ADNotificationCallback callback, object context) where T : ADConfigurationObject, new()
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (baseDN == null || string.IsNullOrEmpty(baseDN.DistinguishedName))
            {
                throw new ArgumentNullException("baseDN");
            }
            string forestFQDN = baseDN.GetPartitionId().ForestFQDN;

            if (!baseDN.IsDescendantOf(ADSession.GetConfigurationNamingContext(forestFQDN)) && !ADSession.IsTenantIdentity(baseDN, forestFQDN))
            {
                throw new ArgumentException(DirectoryStrings.ExArgumentException("baseDN", baseDN), "baseDN");
            }
            ADNotificationRequest adnotificationRequest = new ADNotificationRequest(typeof(T), dummyObject.MostDerivedObjectClass, baseDN, callback, context);

            ADNotificationListener.RegisterChangeNotification(adnotificationRequest);
            return(new ADNotificationRequestCookie(new ADNotificationRequest[]
            {
                adnotificationRequest
            }));
        }
 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));
 }
Esempio n. 5
0
 // Token: 0x0600036A RID: 874 RVA: 0x00012ACC File Offset: 0x00010CCC
 private static object CreateWrappingContext(ADNotificationCallback callback, object context)
 {
     ADNotificationAdapter.WrappedADNotificationCallback callback2 = new ADNotificationAdapter.WrappedADNotificationCallback(callback);
     return(new ADNotificationAdapter.WrappedContext(callback2, context));
 }
Esempio n. 6
0
        public ADNotificationRequestCookie RegisterForMailGatewayNotifications(ADObjectId rootId, ADNotificationCallback callback)
        {
            ADNotificationRequestCookie result = ADNotificationAdapter.RegisterChangeNotification <MailGateway>(rootId, callback);

            if (this.NeedExplicitDeletedObjectSubscription)
            {
                this.VerifyRootWasRegistered <SmtpSendConnectorConfig>();
                this.VerifyRootWasRegistered <DeliveryAgentConnector>();
                this.VerifyRootWasRegistered <ForeignConnector>();
            }
            return(result);
        }
Esempio n. 7
0
        public static ADOperationResult TryRegisterNotifications(Func <ADObjectId> baseDNGetter, ADNotificationCallback callback, TransportADNotificationAdapter.TransportADNotificationRegister registerDelegate, int retryCount, out ADNotificationRequestCookie cookie)
        {
            ADNotificationRequestCookie adCookie = null;
            ADOperationResult           result   = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                ADObjectId root = (baseDNGetter == null) ? null : baseDNGetter();
                adCookie        = registerDelegate(root, callback);
            }, retryCount);

            cookie = adCookie;
            return(result);
        }
Esempio n. 8
0
 // 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));
 }
Esempio n. 9
0
        private void RegisterChangeNotificationForDeletedObject <TConfigObject>(ADObjectId parentContainerId, ADNotificationCallback adNotificationCallback) where TConfigObject : ADConfigurationObject, new()
        {
            TConfigObject         tconfigObject = Activator.CreateInstance <TConfigObject>();
            ADNotificationRequest request       = new ADNotificationRequest(tconfigObject.GetType(), tconfigObject.MostDerivedObjectClass, parentContainerId, adNotificationCallback, null);

            ADNotificationListener.RegisterChangeNotificationForDeletedObjects(request);
            this.typesRegisteredForDeleteNotifications.Add(tconfigObject.GetType());
        }
Esempio n. 10
0
 public static ADNotificationRequestCookie RegisterForNonDeletedNotifications <TConfig>(ADObjectId baseDN, ADNotificationCallback callback) where TConfig : ADConfigurationObject, new()
 {
     return(ADNotificationAdapter.RegisterChangeNotification <TConfig>(baseDN, callback));
 }
Esempio n. 11
0
        public ADNotificationRequestCookie RegisterForJournalRuleNotifications(ADObjectId baseDN, ADNotificationCallback callback)
        {
            ADNotificationRequestCookie result = ADNotificationAdapter.RegisterChangeNotification <TransportRule>(baseDN, callback);

            if (this.NeedExplicitDeletedObjectSubscription)
            {
                this.VerifyRootWasRegistered <TransportRule>();
            }
            return(result);
        }
Esempio n. 12
0
 public ADNotificationRequestCookie RegisterForADSiteNotifications(ADObjectId baseDN, ADNotificationCallback callback)
 {
     return(ADNotificationAdapter.RegisterChangeNotification <ADSite>(baseDN, callback));
 }
Esempio n. 13
0
        public ADNotificationRequestCookie RegisterForRemoteDomainNotifications(ADObjectId baseDN, ADNotificationCallback callback)
        {
            ADNotificationRequestCookie result = ADNotificationAdapter.RegisterChangeNotification <DomainContentConfig>(baseDN, callback);

            if (this.NeedExplicitDeletedObjectSubscription)
            {
                this.VerifyRootWasRegistered <DomainContentConfig>();
            }
            return(result);
        }
Esempio n. 14
0
 // 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: 0x0600038B RID: 907 RVA: 0x00012E34 File Offset: 0x00011034
 internal ADNotificationRequest(Type type, string objectClass, ADObjectId rootId, ADNotificationCallback callback, object context)
 {
     if (rootId == null)
     {
         throw new ArgumentNullException("rootId");
     }
     this.type        = type;
     this.objectClass = objectClass;
     this.rootId      = rootId;
     this.callback    = callback;
     this.context     = context;
     this.isValid     = true;
     this.RefCount    = 0;
 }
Esempio n. 16
0
        // 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));
        }
 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));
 }
Esempio n. 18
0
        // 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));
        }
 public WrappedADNotificationCallback(ADNotificationCallback callback)
 {
     this.callback     = callback;
     this.waitHandle   = new AutoResetEvent(true);
     this.hasQueuedRun = false;
 }
Esempio n. 20
0
 // 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);
 }
Esempio n. 21
0
        public ADNotificationRequestCookie RegisterForLocalServerReceiveConnectorNotifications(ADObjectId baseDN, ADNotificationCallback callback)
        {
            ADNotificationRequestCookie result = ADNotificationAdapter.RegisterChangeNotification <ReceiveConnector>(baseDN, callback);

            if (this.NeedExplicitDeletedObjectSubscription)
            {
                this.VerifyRootWasRegistered <ReceiveConnector>();
            }
            return(result);
        }