Ejemplo n.º 1
0
        public static void PrepareDBCopyForSDO(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DatabaseCopyStatusEntry statusEntry        = (DatabaseCopyStatusEntry)store.GetDataObject("DatabaseCopyStatusEntry");
            DatabaseCopyStatus      databaseCopyStatus = new DatabaseCopyStatus(statusEntry);
            DataRow dataRow = dataTable.Rows[0];

            dataRow["CanActivate"]             = databaseCopyStatus.CanActivate;
            dataRow["CanRemove"]               = databaseCopyStatus.CanRemove;
            dataRow["CanResume"]               = databaseCopyStatus.CanResume;
            dataRow["CanSuspend"]              = databaseCopyStatus.CanSuspend;
            dataRow["CanUpdate"]               = databaseCopyStatus.CanUpdate;
            dataRow["ContentIndexStateString"] = databaseCopyStatus.ContentIndexStateString;
            dataRow["IsActive"]     = databaseCopyStatus.IsActive;
            dataRow["StatusString"] = databaseCopyStatus.StatusString;
        }
Ejemplo n.º 2
0
 public DatabaseCopyStatus(DatabaseCopyStatusEntry statusEntry)
 {
     this.Name                    = statusEntry.Name;
     this.RawIdentity             = statusEntry.Id.ObjectGuid.ToString();
     this.IsActive                = statusEntry.ActiveCopy;
     this.StatusString            = LocalizedDescriptionAttribute.FromEnum(typeof(CopyStatus), statusEntry.Status);
     this.CopyQueueLength         = ((statusEntry.CopyQueueLength != null) ? statusEntry.CopyQueueLength.Value.ToString() : "0");
     this.ContentIndexStateString = LocalizedDescriptionAttribute.FromEnum(typeof(ContentIndexStatusType), statusEntry.ContentIndexState);
     this.SuspendComment          = statusEntry.SuspendComment;
     this.CanSuspend              = (statusEntry.Status == CopyStatus.Failed || statusEntry.Status == CopyStatus.Seeding || statusEntry.Status == CopyStatus.Healthy || statusEntry.Status == CopyStatus.Initializing || statusEntry.Status == CopyStatus.Resynchronizing || statusEntry.Status == CopyStatus.DisconnectedAndHealthy || statusEntry.Status == CopyStatus.DisconnectedAndResynchronizing);
     this.CanResume               = (statusEntry.Status == CopyStatus.Suspended || statusEntry.Status == CopyStatus.FailedAndSuspended);
     this.CanRemove               = (statusEntry.Status == CopyStatus.Failed || statusEntry.Status == CopyStatus.Seeding || statusEntry.Status == CopyStatus.Suspended || statusEntry.Status == CopyStatus.Healthy || statusEntry.Status == CopyStatus.Initializing || statusEntry.Status == CopyStatus.Resynchronizing || statusEntry.Status == CopyStatus.DisconnectedAndHealthy || statusEntry.Status == CopyStatus.FailedAndSuspended || statusEntry.Status == CopyStatus.DisconnectedAndResynchronizing || statusEntry.Status == CopyStatus.NonExchangeReplication || statusEntry.Status == CopyStatus.SeedingSource || statusEntry.Status == CopyStatus.Misconfigured);
     this.CanActivate             = (statusEntry.Status == CopyStatus.Healthy || statusEntry.Status == CopyStatus.DisconnectedAndHealthy || statusEntry.Status == CopyStatus.DisconnectedAndResynchronizing || statusEntry.Status == CopyStatus.Initializing || statusEntry.Status == CopyStatus.Resynchronizing);
     this.CanUpdate               = (statusEntry.Status == CopyStatus.Suspended || statusEntry.Status == CopyStatus.FailedAndSuspended);
 }
Ejemplo n.º 3
0
        public static int CountMountedCopy(object databaseCopies)
        {
            int num = 0;
            IEnumerable <object> enumerable = databaseCopies as IEnumerable <object>;

            if (enumerable != null)
            {
                foreach (object obj in enumerable)
                {
                    DatabaseCopyStatusEntry databaseCopyStatusEntry = obj as DatabaseCopyStatusEntry;
                    if (databaseCopyStatusEntry != null && databaseCopyStatusEntry.Status == CopyStatus.Mounted)
                    {
                        num++;
                    }
                }
            }
            return(num);
        }
Ejemplo n.º 4
0
        public static void GetMailboxCopyPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow                 dataRow                 = dataTable.Rows[0];
            MailboxDatabase         mailboxDatabase         = (MailboxDatabase)store.GetDataObject("MailboxDatabaseFoGet");
            DatabaseCopyStatusEntry databaseCopyStatusEntry = (DatabaseCopyStatusEntry)store.GetDataObject("DatabaseCopyStatusEntry");
            DatabaseCopy            databaseCopy            = null;

            foreach (DatabaseCopy databaseCopy2 in mailboxDatabase.DatabaseCopies)
            {
                if (string.Equals(databaseCopyStatusEntry.MailboxServer, databaseCopy2.HostServerName, StringComparison.InvariantCultureIgnoreCase))
                {
                    databaseCopy = databaseCopy2;
                    break;
                }
            }
            if (databaseCopy != null)
            {
                dataRow["ActivationPreference"] = databaseCopy.ActivationPreference;
                dataRow["DatabaseCopiesLength"] = mailboxDatabase.DatabaseCopies.Length;
                dataRow["ReplayLagTime"]        = databaseCopy.ReplayLagTime.ToString(TimeUnit.Day, 9);
            }
        }
        public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate)
        {
            DDIHelper.Trace(TraceType.InfoTrace, "Executing :" + base.GetType().Name);
            object[] array  = (object[])input["DeferLoadNames"];
            object[] array2 = (object[])input["DeferLoadIdentities"];
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            DataRow row = dataTable.NewRow();

            dataTable.Rows.Add(row);
            dataTable.BeginLoadData();
            for (int i = 0; i < array2.Length; i++)
            {
                object value = array2[i];
                object arg   = array[i];
                base.Command = base.PowershellFactory.CreatePSCommand().AddCommand(base.GetCommandText(store));
                base.Command.AddParameter("Identity", string.Format("{0}\\*", arg));
                DDIHelper.Trace <IPSCommandWrapper>(TraceType.InfoTrace, base.Command);
                RunResult runResult = new RunResult();
                PowerShellResults <PSObject> powerShellResults;
                base.ExecuteCmdlet(null, runResult, out powerShellResults, false);
                base.StatusReport    = powerShellResults;
                runResult.ErrorOccur = !base.StatusReport.Succeeded;
                if (!runResult.ErrorOccur && powerShellResults.Output != null && powerShellResults.Output.Length > 0)
                {
                    string     value2 = Strings.StatusUnknown.ToString();
                    bool       flag   = false;
                    int        num    = 0;
                    PSObject[] output = powerShellResults.Output;
                    int        j      = 0;
                    while (j < output.Length)
                    {
                        PSObject psobject = output[j];
                        DatabaseCopyStatusEntry databaseCopyStatusEntry = (DatabaseCopyStatusEntry)psobject.BaseObject;
                        CopyStatus status = databaseCopyStatusEntry.Status;
                        if (status == CopyStatus.Failed || status == CopyStatus.ServiceDown)
                        {
                            goto IL_186;
                        }
                        switch (status)
                        {
                        case CopyStatus.DisconnectedAndHealthy:
                        case CopyStatus.FailedAndSuspended:
                        case CopyStatus.DisconnectedAndResynchronizing:
                        case CopyStatus.Misconfigured:
                            goto IL_186;
                        }
IL_18C:
                        if (databaseCopyStatusEntry.ActiveCopy)
                        {
                            switch (databaseCopyStatusEntry.Status)
                            {
                            case CopyStatus.Mounted:
                            case CopyStatus.Mounting:
                                value2 = Strings.StatusMounted.ToString();
                                flag   = true;
                                break;

                            case CopyStatus.Dismounted:
                            case CopyStatus.Dismounting:
                                value2 = Strings.StatusDismounted.ToString();
                                flag   = false;
                                break;
                            }
                        }
                        Dictionary <string, object> dictionary = new Dictionary <string, object>();
                        list.Add(dictionary);
                        dictionary["Identity"] = value;
                        dictionary["CalcualtedMountStatus"] = value2;
                        dictionary["CalcualtedMounted"]     = flag;
                        dictionary["CalcualtedBadCopies"]   = num;
                        j++;
                        continue;
IL_186:
                        num++;
                        goto IL_18C;
                    }
                }
            }
            dataTable.Clear();
            foreach (Dictionary <string, object> dictionary2 in list)
            {
                DataRow dataRow = dataTable.NewRow();
                dataTable.Rows.Add(dataRow);
                dataRow["Identity"] = dictionary2["Identity"];
                dataRow["CalcualtedMountStatus"] = dictionary2["CalcualtedMountStatus"];
                dataRow["CalcualtedMounted"]     = dictionary2["CalcualtedMounted"];
                dataRow["CalcualtedBadCopies"]   = dictionary2["CalcualtedBadCopies"];
            }
            dataTable.EndLoadData();
            return(new RunResult());
        }