예제 #1
0
 public void Unregister()
 {
     try
     {
         ADNotificationAdapter.UnregisterChangeNotification(this.adNotificationRequestCookie);
     }
     catch (DataSourceOperationException innerException)
     {
         ServiceDiscoveryPermanentException ex = new ServiceDiscoveryPermanentException(ServerStrings.ExFailedToUnregisterExchangeTopologyNotification, innerException);
         ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryPermanentException>(0L, "RegisteredExchangeTopologyNotification::Unregister. Failed to unregister. Throwing exception: {0}.", ex);
         throw ex;
     }
     catch (ADTransientException innerException2)
     {
         ServiceDiscoveryTransientException ex2 = new ServiceDiscoveryTransientException(ServerStrings.ExFailedToUnregisterExchangeTopologyNotification, innerException2);
         ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryTransientException>(0L, "RegisteredExchangeTopologyNotification::Unregister. Failed to unregister. Throwing exception: {0}.", ex2);
         throw ex2;
     }
 }
예제 #2
0
 internal RegisteredExchangeTopologyNotification(ADNotificationCallback callback, ExchangeTopologyScope scope)
 {
     try
     {
         this.adNotificationRequestCookie = ADNotificationAdapter.RegisterExchangeTopologyChangeNotification(callback, null, scope);
     }
     catch (DataSourceOperationException innerException)
     {
         ServiceDiscoveryPermanentException ex = new ServiceDiscoveryPermanentException(ServerStrings.ExFailedToRegisterExchangeTopologyNotification, innerException);
         ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryPermanentException>(0L, "RegisteredExchangeTopologyNotification::Constructor. Failed to register. Throwing exception: {0}.", ex);
         throw ex;
     }
     catch (ADTransientException innerException2)
     {
         ServiceDiscoveryTransientException ex2 = new ServiceDiscoveryTransientException(ServerStrings.ExFailedToRegisterExchangeTopologyNotification, innerException2);
         ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryTransientException>(0L, "RegisteredExchangeTopologyNotification::Constructor. Failed to register. Throwing exception: {0}.", ex2);
         throw ex2;
     }
 }
예제 #3
0
        public ExchangeTopology ReadExchangeTopology(DateTime timestamp, ExchangeTopologyScope topologyScope, bool forceRefresh)
        {
            ExchangeTopology result;

            try
            {
                using (TopologyServiceClient topologyServiceClient = TopologyServiceClient.CreateClient("localhost"))
                {
                    byte[][] exchangeTopology = topologyServiceClient.GetExchangeTopology(timestamp, topologyScope, forceRefresh);
                    if (exchangeTopology == null)
                    {
                        result = null;
                    }
                    else
                    {
                        ExchangeTopologyDiscovery.Simple topology          = ExchangeTopologyDiscovery.Simple.Deserialize(exchangeTopology);
                        ExchangeTopologyDiscovery        topologyDiscovery = ExchangeTopologyDiscovery.Simple.CreateFrom(topology);
                        result = ExchangeTopologyDiscovery.Populate(topologyDiscovery);
                    }
                }
            }
            catch (DataSourceOperationException innerException)
            {
                ServiceDiscoveryPermanentException ex = new ServiceDiscoveryPermanentException(ServerStrings.ExReadExchangeTopologyFailed, innerException);
                ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryPermanentException>(0L, "ExchangeTopologyBridge::ReadExchangeTopology. Read ExchangeTopology failed. Throwing exception: {0}.", ex);
                throw ex;
            }
            catch (Exception ex2)
            {
                if (!(ex2 is CommunicationException) && !(ex2 is TimeoutException) && !(ex2 is InvalidOperationException))
                {
                    throw;
                }
                ServiceDiscoveryTransientException ex3 = new ServiceDiscoveryTransientException(ServerStrings.ExReadExchangeTopologyFailed, ex2);
                ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryTransientException>(0L, "ExchangeTopologyBridge::ReadExchangeTopology. Read ExchangeTopology failed. Throwing exception: {0}.", ex3);
                throw ex3;
            }
            return(result);
        }