Ejemplo n.º 1
0
        private IEnumerable <NonConnectedMailbox> GetDisconnectedMailboxesForDatabaseInternal(DirectoryDatabase database, IPhysicalDatabase physicalDatabase)
        {
            this.logger.LogVerbose("Getting soft deleted mailboxes for database '{0}'", new object[]
            {
                database.Name
            });
            IOperationRetryManager retryManager = LoadBalanceOperationRetryManager.Create(this.logger);

            foreach (IPhysicalMailbox disconnectedMailbox in physicalDatabase.GetNonConnectedMailboxes())
            {
                NonConnectedMailbox nonConnectedMailbox = null;
                IPhysicalMailbox    mailbox             = disconnectedMailbox;
                retryManager.TryRun(delegate
                {
                    nonConnectedMailbox = new NonConnectedMailbox(this, DirectoryIdentity.CreateNonConnectedMailboxIdentity(mailbox.Guid, mailbox.OrganizationId), new IPhysicalMailbox[]
                    {
                        mailbox
                    });
                    nonConnectedMailbox.Parent = database;
                    this.NotifyObjectLoaded(nonConnectedMailbox);
                });
                if (disconnectedMailbox != null)
                {
                    yield return(nonConnectedMailbox);
                }
            }
            yield break;
        }
Ejemplo n.º 2
0
        protected override SoftDeleteMailboxRemovalCheckRemoval CheckRemoval()
        {
            DirectoryIdentity targetDatabase  = base.Data.TargetDatabase;
            DirectoryMailbox  mailbox         = base.TargetDatabase.GetMailbox(base.Data.MailboxIdentity);
            IPhysicalMailbox  physicalMailbox = mailbox.PhysicalMailboxes.FirstOrDefault((IPhysicalMailbox mbx) => mbx.Guid == base.Data.MailboxIdentity.Guid);

            if (physicalMailbox == null)
            {
                return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval("An active mailbox for {0} could not be found.", new object[]
                {
                    base.Data.MailboxIdentity
                }));
            }
            if (base.Data.ItemCount > (long)physicalMailbox.ItemCount)
            {
                string reasonMessage = "Cannot remove soft deleted mailbox {0} because its ItemCount is {1} which is greater than the active copy's ItemCount of {2} on database '{3}'.";
                return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval(reasonMessage, new object[]
                {
                    base.Data.MailboxIdentity.Guid,
                    base.Data.ItemCount,
                    physicalMailbox.ItemCount,
                    targetDatabase.Name
                }));
            }
            return(null);
        }
Ejemplo n.º 3
0
        private void AddPhysicalMailboxToList(Guid mailboxGuid, Guid databaseGuid, IPhysicalDatabase physicalDatabaseConnection, List <IPhysicalMailbox> physicalMailboxes, bool isArchive)
        {
            IPhysicalMailbox physicalMailbox = null;

            if (physicalDatabaseConnection == null)
            {
                physicalMailbox = new VirtualPhysicalMailbox(this.clientFactory, this.GetDatabase(databaseGuid), mailboxGuid, this.logger, isArchive);
            }
            else if (physicalDatabaseConnection.DatabaseGuid == databaseGuid)
            {
                physicalMailbox = physicalDatabaseConnection.GetMailbox(mailboxGuid);
            }
            if (physicalMailbox != null)
            {
                physicalMailboxes.Add(physicalMailbox);
            }
        }