Пример #1
0
 private static void HandleConfigurationChange(ADNotificationEventArgs args)
 {
     try
     {
         if (Interlocked.Increment(ref RmsClientManagerLog.notificationHandlerCount) == 1)
         {
             Server            localServer       = null;
             ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
             {
                 ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 1191, "HandleConfigurationChange", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\rightsmanagement\\RmsClientManagerLog.cs");
                 localServer = topologyConfigurationSession.FindLocalServer();
             });
             if (!adoperationResult.Succeeded)
             {
                 RmsClientManagerLog.Tracer.TraceError <Exception>(0L, "Failed to get the local server.  Unable to reload the log configuration. Error {0}", adoperationResult.Exception);
             }
             else
             {
                 RmsClientManagerLog.Configure(localServer);
             }
         }
     }
     finally
     {
         Interlocked.Decrement(ref RmsClientManagerLog.notificationHandlerCount);
     }
 }
Пример #2
0
        public static void Start()
        {
            Server localServer = null;

            RmsClientManagerLog.rmsLogSchema = new LogSchema("Microsoft Exchange Server", Assembly.GetExecutingAssembly().GetName().Version.ToString(), "Rms Client Manager Log", RmsClientManagerLog.Fields);
            RmsClientManagerLog.rmsLog       = new Log(RmsClientManagerUtils.GetUniqueFileNameForProcess(RmsClientManagerLog.LogSuffix, true), new LogHeaderFormatter(RmsClientManagerLog.rmsLogSchema), "RmsClientManagerLog");
            ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 254, "Start", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\rightsmanagement\\RmsClientManagerLog.cs");
                localServer = topologyConfigurationSession.FindLocalServer();
                RmsClientManagerLog.notificationCookie = ADNotificationAdapter.RegisterChangeNotification <Server>(localServer.Id, new ADNotificationCallback(RmsClientManagerLog.HandleConfigurationChange));
            });

            if (!adoperationResult.Succeeded)
            {
                RmsClientManagerLog.Tracer.TraceError <Exception>(0L, "Failed to get the local server.  Unable to load the log configuration. Error {0}", adoperationResult.Exception);
                throw new ExchangeConfigurationException(ServerStrings.FailedToReadConfiguration, adoperationResult.Exception);
            }
            RmsClientManagerLog.Configure(localServer);
        }