// Token: 0x06000C42 RID: 3138 RVA: 0x000364AC File Offset: 0x000346AC
        public static bool IsServerRcrSource(IADDatabase db, string serverName, ITopologyConfigurationSession adSession, out DatabaseLocationInfo activeLocation)
        {
            bool result;

            using (ActiveManager activeManager = ActiveManager.CreateCustomActiveManager(false, null, null, null, null, null, null, adSession, true))
            {
                activeLocation = activeManager.GetServerForDatabase(db.Guid, GetServerForDatabaseFlags.BasicQuery);
                result         = Cluster.StringIEquals(new AmServerName(activeLocation.ServerFqdn).NetbiosName, serverName);
            }
            return(result);
        }
示例#2
0
        // Token: 0x0600135F RID: 4959 RVA: 0x0004EB5C File Offset: 0x0004CD5C
        internal CopyStatusLookupComponent()
        {
            CopyStatusClientLookupTable statusTable          = null;
            IReplayAdObjectLookup       replayAdObjectLookup = Dependencies.ReplayAdObjectLookup;

            this.ActiveManagerInstance = ActiveManager.CreateCustomActiveManager(true, replayAdObjectLookup.DagLookup, replayAdObjectLookup.ServerLookup, replayAdObjectLookup.MiniServerLookup, null, null, replayAdObjectLookup.DatabaseLookup, replayAdObjectLookup.AdSession, true);
            if (CopyStatusLookupComponent.CopyStatusClientCachingEnabled)
            {
                statusTable           = new CopyStatusClientLookupTable();
                this.CopyStatusPoller = new CopyStatusPoller(Dependencies.MonitoringADConfigProvider, statusTable, this.ActiveManagerInstance);
            }
            this.CopyStatusLookup = new CopyStatusClientLookup(statusTable, this.CopyStatusPoller, this.ActiveManagerInstance);
            Dependencies.Container.RegisterInstance <ICopyStatusClientLookup>(this.CopyStatusLookup);
        }
示例#3
0
        protected override void WriteResult <T>(IEnumerable <T> dataObjects)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObjects
            });
            if (!this.Status)
            {
                using (IEnumerator <T> enumerator = dataObjects.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        T             t            = enumerator.Current;
                        IConfigurable configurable = t;
                        Database      database     = (Database)configurable;
                        bool          flag         = false;
                        Server        server       = database.GetServer();
                        if (server == null)
                        {
                            base.WriteError(new InvalidOperationException(Strings.ErrorDBOwningServerNotFound(database.Identity.ToString())), ErrorCategory.InvalidOperation, database.Identity);
                        }
                        else
                        {
                            flag = server.IsE15OrLater;
                        }
                        if (this.AllowLegacy || flag)
                        {
                            this.WriteResult(database);
                        }
                    }
                    goto IL_66D;
                }
            }
            Dictionary <string, Collection <Database> > dictionary = new Dictionary <string, Collection <Database> >();

            foreach (T t2 in dataObjects)
            {
                IConfigurable configurable2 = t2;
                Database      database2     = (Database)configurable2;
                string        text          = null;
                bool          flag2         = false;
                Server        server2       = database2.GetServer();
                if (server2 == null)
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorDBOwningServerNotFound(database2.Identity.ToString())), ErrorCategory.InvalidOperation, database2.Identity);
                }
                else
                {
                    flag2 = server2.IsE15OrLater;
                }
                bool flag3;
                if (flag2)
                {
                    ActiveManager activeManager = null;
                    Exception     ex            = null;
                    try
                    {
                        activeManager = ActiveManager.CreateCustomActiveManager(false, null, null, null, null, null, null, (ITopologyConfigurationSession)this.ConfigurationSession, false);
                        DatabaseLocationInfo serverForDatabase = activeManager.GetServerForDatabase(database2.Guid, GetServerForDatabaseFlags.IgnoreAdSiteBoundary);
                        text = serverForDatabase.ServerFqdn;
                    }
                    catch (DatabaseNotFoundException ex2)
                    {
                        ex = ex2;
                    }
                    catch (ObjectNotFoundException ex3)
                    {
                        ex = ex3;
                    }
                    catch (ServerForDatabaseNotFoundException ex4)
                    {
                        ex = ex4;
                    }
                    finally
                    {
                        if (activeManager != null)
                        {
                            activeManager.Dispose();
                            activeManager = null;
                        }
                    }
                    if (ex != null)
                    {
                        TaskLogger.Trace("GetDatabase.WriteResult() raised exception from AM.GetServerForDatabase() for database '{0}': {1}", new object[]
                        {
                            database2.Name,
                            ex.ToString()
                        });
                        this.WriteResult(database2);
                        this.WriteWarning(Strings.ErrorFailedToQueryActiveServerForDatabase(database2.Name, ex.Message));
                        continue;
                    }
                    database2.MountedOnServer = text;
                    flag3 = true;
                }
                else
                {
                    text = server2.Fqdn;
                    database2.MountedOnServer = text;
                    flag3 = this.AllowLegacy;
                }
                if (flag3)
                {
                    Collection <Database> collection;
                    if (!dictionary.TryGetValue(text, out collection))
                    {
                        collection = new Collection <Database>();
                        dictionary.Add(text, collection);
                    }
                    collection.Add(database2);
                }
            }
            foreach (string text2 in dictionary.Keys)
            {
                Collection <Database> collection2 = dictionary[text2];
                try
                {
                    base.WriteVerbose(Strings.VerboseConnectionAdminRpcInterface(text2));
                    using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=Management", text2, null, null, null))
                    {
                        Guid[] array = new Guid[collection2.Count];
                        for (int i = 0; i < collection2.Count; i++)
                        {
                            array[i] = collection2[i].Guid;
                            base.WriteVerbose(Strings.VerboseCheckDatabaseStatus(array[i].ToString()));
                        }
                        MdbStatus[] array2 = exRpcAdmin.ListMdbStatus(array);
                        for (int j = 0; j < collection2.Count; j++)
                        {
                            collection2[j].Mounted = new bool?((array2[j].Status & MdbStatusFlags.Online) != MdbStatusFlags.Offline);
                            collection2[j].OnlineMaintenanceInProgress = new bool?((array2[j].Status & MdbStatusFlags.Isinteg) == MdbStatusFlags.Offline);
                            collection2[j].BackupInProgress            = new bool?((array2[j].Status & MdbStatusFlags.Backup) != MdbStatusFlags.Offline);
                            if (collection2[j].Mounted.Value)
                            {
                                this.FillLastBackupTimes(exRpcAdmin, collection2[j]);
                                if (collection2[j].LastFullBackup != null)
                                {
                                    collection2[j].LastFullBackup = new DateTime?(collection2[j].LastFullBackup.Value.ToLocalTime());
                                }
                                if (collection2[j].LastIncrementalBackup != null)
                                {
                                    collection2[j].LastIncrementalBackup = new DateTime?(collection2[j].LastIncrementalBackup.Value.ToLocalTime());
                                }
                                if (collection2[j].LastDifferentialBackup != null)
                                {
                                    collection2[j].LastDifferentialBackup = new DateTime?(collection2[j].LastDifferentialBackup.Value.ToLocalTime());
                                }
                                if (collection2[j].LastCopyBackup != null)
                                {
                                    collection2[j].LastCopyBackup = new DateTime?(collection2[j].LastCopyBackup.Value.ToLocalTime());
                                }
                                this.FillDatabaseSize(exRpcAdmin, collection2[j]);
                                if (collection2[j].GetServer().IsE15OrLater)
                                {
                                    this.FillDatabaseProcessInfo(exRpcAdmin, collection2[j]);
                                }
                            }
                            else
                            {
                                TaskLogger.Trace("Database {0} is not mounted, not getting the last backup times of it", new object[]
                                {
                                    collection2[j].Name
                                });
                            }
                            this.WriteResult(collection2[j]);
                        }
                    }
                }
                catch (MapiPermanentException ex5)
                {
                    TaskLogger.Trace(string.Format(CultureInfo.InvariantCulture, "GetDatabase.WriteResult() raises exception while connecting to server '{0}': {1}", new object[]
                    {
                        text2,
                        ex5.Message
                    }), new object[0]);
                    foreach (Database dataObject in collection2)
                    {
                        this.WriteResult(dataObject);
                        this.WriteWarning(Strings.ErrorFailedToConnectToStore(text2));
                    }
                }
                catch (MapiRetryableException ex6)
                {
                    TaskLogger.Trace(string.Format(CultureInfo.InvariantCulture, "GetDatabase.WriteResult() raises exception while connecting to server '{0}': {1}", new object[]
                    {
                        text2,
                        ex6.Message
                    }), new object[0]);
                    foreach (Database dataObject2 in collection2)
                    {
                        this.WriteResult(dataObject2);
                        this.WriteWarning(Strings.ErrorFailedToConnectToStore(text2));
                    }
                }
            }
IL_66D:
            TaskLogger.LogExit();
        }