Beispiel #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();
 }
Beispiel #2
0
        private StoreIntegrityCheckRequestFlags GetRequestFlags()
        {
            StoreIntegrityCheckRequestFlags storeIntegrityCheckRequestFlags = StoreIntegrityCheckRequestFlags.None;

            if (this.DetectOnly)
            {
                storeIntegrityCheckRequestFlags |= StoreIntegrityCheckRequestFlags.DetectOnly;
            }
            if (this.Force)
            {
                storeIntegrityCheckRequestFlags |= StoreIntegrityCheckRequestFlags.Force;
            }
            return(storeIntegrityCheckRequestFlags);
        }
        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));
        }