Ejemplo n.º 1
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (this.unlockMoveTarget)
     {
         ActiveManager        activeManagerInstance = ActiveManager.GetActiveManagerInstance();
         DatabaseLocationInfo serverForDatabase     = activeManagerInstance.GetServerForDatabase(this.databaseObject.Guid);
         string serverFqdn = serverForDatabase.ServerFqdn;
         if (!this.DetectOnly)
         {
             UnlockMoveTargetUtil.UnlockMoveTarget(serverFqdn, this.databaseObject.Guid, this.mailboxGuid, this.organizationId);
             this.WriteResult(this.DataObject);
         }
     }
     else
     {
         StoreIntegrityCheckRequestFlags requestFlags           = this.GetRequestFlags();
         StoreIntegrityCheckJob          storeIntegrityCheckJob = StoreIntegrityCheckAdminRpc.CreateStoreIntegrityCheckJob(this.databaseObject, this.mailboxGuid, requestFlags, this.CorruptionType, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
         if (storeIntegrityCheckJob != null)
         {
             this.WriteResult(storeIntegrityCheckJob);
         }
     }
     TaskLogger.LogExit();
 }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            IntegrityCheckQueryFlags flags = IntegrityCheckQueryFlags.None;
            Guid guid = this.requestGuid;

            if (this.jobGuid != Guid.Empty)
            {
                flags = IntegrityCheckQueryFlags.QueryJob;
                guid  = this.jobGuid;
            }
            bool details = true;

            if (base.ParameterSetName == "Identity" && this.Detailed == false)
            {
                details = false;
            }
            List <StoreIntegrityCheckJob> storeIntegrityCheckJob = StoreIntegrityCheckAdminRpc.GetStoreIntegrityCheckJob(this.databaseObject, this.mailboxGuid, guid, flags, details, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));

            if (storeIntegrityCheckJob != null)
            {
                this.WriteResult <StoreIntegrityCheckJob>(storeIntegrityCheckJob);
            }
            TaskLogger.LogExit();
        }
 internal static void RemoveStoreIntegrityCheckJob(Database database, Guid jobGuid, Task.TaskErrorLoggingDelegate writeError, Task.TaskWarningLoggingDelegate writeWarning, Task.TaskVerboseLoggingDelegate writeVerbose)
 {
     try
     {
         StoreIntegrityCheckAdminRpc.ExecuteAdminRpc(database.Guid, delegate(ExRpcAdmin rpcAdmin, string serverFqdn)
         {
             int num;
             int num2;
             rpcAdmin.GetAdminVersion(out num, out num2);
             if (num < 7 || (num == 7 && num2 < 15))
             {
                 throw new NotSupportedException();
             }
             rpcAdmin.StoreIntegrityCheckEx(database.Guid, Guid.Empty, jobGuid, 3U, 0U, null, null);
         }, writeError, writeWarning, writeVerbose);
     }
     catch (MapiExceptionNetworkError innerException)
     {
         writeError(new OnlineIsIntegRemoveJobException(database.Identity.ToString(), jobGuid.ToString(), Strings.ServiceUnavaiable, innerException), ErrorCategory.ResourceUnavailable, database.Identity);
     }
     catch (MapiExceptionMdbOffline innerException2)
     {
         writeError(new OnlineIsIntegRemoveJobException(database.Identity.ToString(), jobGuid.ToString(), Strings.DatabaseOffline, innerException2), ErrorCategory.InvalidOperation, database.Identity);
     }
     catch (MapiPermanentException ex)
     {
         writeError(new OnlineIsIntegRemoveJobException(database.Identity.ToString(), jobGuid.ToString(), Strings.UnexpectedError(ex.ToString()), ex), ErrorCategory.InvalidOperation, database.Identity);
     }
     catch (MapiRetryableException ex2)
     {
         writeError(new OnlineIsIntegRemoveJobException(database.Identity.ToString(), jobGuid.ToString(), Strings.UnexpectedError(ex2.ToString()), ex2), ErrorCategory.InvalidOperation, database.Identity);
     }
 }
        internal static List <StoreIntegrityCheckJob> GetStoreIntegrityCheckJob(Database database, Guid mailboxGuid, Guid requestGuid, IntegrityCheckQueryFlags flags, bool details, Task.TaskErrorLoggingDelegate writeError, Task.TaskWarningLoggingDelegate writeWarning, Task.TaskVerboseLoggingDelegate writeVerbose)
        {
            List <StoreIntegrityCheckJob> jobs = new List <StoreIntegrityCheckJob>();

            try
            {
                StoreIntegrityCheckAdminRpc.ExecuteAdminRpc(database.Guid, delegate(ExRpcAdmin rpcAdmin, string serverFqdn)
                {
                    int num;
                    int num2;
                    rpcAdmin.GetAdminVersion(out num, out num2);
                    if (num < 7 || (num == 7 && num2 < 15))
                    {
                        throw new NotSupportedException();
                    }
                    PropValue[][] array = rpcAdmin.StoreIntegrityCheckEx(database.Guid, mailboxGuid, requestGuid, 2U, (uint)flags, null, StoreIntegrityCheckAdminRpc.JobPropTags);
                    foreach (PropValue[] propValues in array)
                    {
                        jobs.Add(new StoreIntegrityCheckJob(new DatabaseId(null, serverFqdn, database.Name, database.Guid), propValues));
                    }
                }, writeError, writeWarning, writeVerbose);
            }
            catch (MapiExceptionNetworkError innerException)
            {
                writeError(new OnlineIsIntegQueryJobException(database.Identity.ToString(), Strings.ServiceUnavaiable, innerException), ErrorCategory.ResourceUnavailable, database.Identity);
            }
            catch (MapiExceptionMdbOffline innerException2)
            {
                writeError(new OnlineIsIntegQueryJobException(database.Identity.ToString(), Strings.DatabaseOffline, innerException2), ErrorCategory.InvalidOperation, database.Identity);
            }
            catch (MapiPermanentException ex)
            {
                writeError(new OnlineIsIntegQueryJobException(database.Identity.ToString(), Strings.UnexpectedError(ex.ToString()), ex), ErrorCategory.InvalidOperation, database.Identity);
            }
            catch (MapiRetryableException ex2)
            {
                writeError(new OnlineIsIntegQueryJobException(database.Identity.ToString(), Strings.UnexpectedError(ex2.ToString()), ex2), ErrorCategory.InvalidOperation, database.Identity);
            }
            if (details)
            {
                return(jobs);
            }
            return(new List <StoreIntegrityCheckJob>
            {
                StoreIntegrityCheckJob.Aggregate(jobs)
            });
        }
        internal static StoreIntegrityCheckJob CreateStoreIntegrityCheckJob(Database database, Guid mailboxGuid, StoreIntegrityCheckRequestFlags flags, MailboxCorruptionType[] taskIds, Task.TaskErrorLoggingDelegate writeError, Task.TaskWarningLoggingDelegate writeWarning, Task.TaskVerboseLoggingDelegate writeVerbose)
        {
            List <StoreIntegrityCheckJob> result = null;

            try
            {
                StoreIntegrityCheckAdminRpc.ExecuteAdminRpc(database.Guid, delegate(ExRpcAdmin rpcAdmin, string serverFqdn)
                {
                    uint[] array = new uint[taskIds.Length];
                    for (int i = 0; i < taskIds.Length; i++)
                    {
                        array[i] = (uint)taskIds[i];
                    }
                    int num;
                    int num2;
                    rpcAdmin.GetAdminVersion(out num, out num2);
                    if (num < 7 || (num == 7 && num2 < 15))
                    {
                        string input;
                        rpcAdmin.ISIntegCheck(database.Guid, mailboxGuid, (uint)flags, array.Length, array, out input);
                        JobFlags jobFlags = JobFlags.None;
                        if ((flags & StoreIntegrityCheckRequestFlags.DetectOnly) == StoreIntegrityCheckRequestFlags.DetectOnly)
                        {
                            jobFlags |= JobFlags.DetectOnly;
                        }
                        if ((flags & (StoreIntegrityCheckRequestFlags)2147483648U) == (StoreIntegrityCheckRequestFlags)2147483648U)
                        {
                            jobFlags |= (JobFlags)2147483648U;
                        }
                        if ((flags & StoreIntegrityCheckRequestFlags.Force) == StoreIntegrityCheckRequestFlags.None)
                        {
                            jobFlags |= JobFlags.Background;
                        }
                        StoreIntegrityCheckJob item = new StoreIntegrityCheckJob(new DatabaseId(null, serverFqdn, database.Name, database.Guid), Guid.Parse(input), jobFlags, (from x in array
                                                                                                                                                                               select(MailboxCorruptionType) x).ToArray <MailboxCorruptionType>());
                        result = new List <StoreIntegrityCheckJob>();
                        result.Add(item);
                        return;
                    }
                    PropValue[][] array2 = rpcAdmin.StoreIntegrityCheckEx(database.Guid, mailboxGuid, Guid.Empty, 1U, (uint)flags, array, StoreIntegrityCheckAdminRpc.JobPropTags);
                    result = new List <StoreIntegrityCheckJob>(array2.Length);
                    foreach (PropValue[] propValues in array2)
                    {
                        StoreIntegrityCheckJob item2 = new StoreIntegrityCheckJob(new DatabaseId(null, serverFqdn, database.Name, database.Guid), propValues);
                        result.Add(item2);
                    }
                }, writeError, writeWarning, writeVerbose);
            }
            catch (MapiExceptionNetworkError innerException)
            {
                writeError(new OnlineIsIntegException(database.Identity.ToString(), Strings.ServiceUnavaiable, innerException), ErrorCategory.ResourceUnavailable, database.Identity);
            }
            catch (MapiExceptionMdbOffline innerException2)
            {
                writeError(new OnlineIsIntegException(database.Identity.ToString(), Strings.DatabaseOffline, innerException2), ErrorCategory.InvalidOperation, database.Identity);
            }
            catch (MapiExceptionISIntegMdbTaskExceeded innerException3)
            {
                writeError(new OnlineIsIntegException(database.Identity.ToString(), Strings.DatabaseWideTasksExceeded, innerException3), ErrorCategory.InvalidOperation, database.Identity);
            }
            catch (MapiExceptionISIntegQueueFull innerException4)
            {
                writeError(new OnlineIsIntegException(database.Identity.ToString(), Strings.IsIntegQueueFull, innerException4), ErrorCategory.InvalidOperation, database.Identity);
            }
            catch (MapiExceptionUnknownUser)
            {
                writeWarning(Strings.WarningMailboxNeverBeenLoggedOn(mailboxGuid.ToString(), database.Identity.ToString()));
            }
            catch (MapiPermanentException ex)
            {
                writeError(new OnlineIsIntegException(database.Identity.ToString(), Strings.UnexpectedError(ex.ToString()), ex), ErrorCategory.InvalidOperation, database.Identity);
            }
            catch (MapiRetryableException ex2)
            {
                writeError(new OnlineIsIntegException(database.Identity.ToString(), Strings.UnexpectedError(ex2.ToString()), ex2), ErrorCategory.InvalidOperation, database.Identity);
            }
            return(StoreIntegrityCheckJob.Aggregate(result));
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     StoreIntegrityCheckAdminRpc.RemoveStoreIntegrityCheckJob(this.database, this.jobGuid, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
     TaskLogger.LogExit();
 }