Esempio n. 1
0
 private void WriteMailboxAssociation(MailboxAssociationFromStore association, IAssociationAdaptor associationAdaptor, ADUser masterMailbox, IExtensibleLogger logger)
 {
     if (association != null)
     {
         ObjectId       objectId            = new MailboxStoreObjectId(masterMailbox.ObjectId, association.ItemId.ObjectId);
         MailboxLocator slaveMailboxLocator = associationAdaptor.GetSlaveMailboxLocator(association);
         if (base.NeedSuppressingPiiData)
         {
             objectId = SuppressingPiiData.RedactMailboxStoreObjectId(objectId);
         }
         base.WriteResult(new MailboxAssociationPresentationObject
         {
             Identity            = objectId,
             ExternalId          = slaveMailboxLocator.ExternalId,
             LegacyDn            = slaveMailboxLocator.LegacyDn,
             IsMember            = association.IsMember,
             JoinedBy            = association.JoinedBy,
             GroupSmtpAddress    = association.GroupSmtpAddress,
             UserSmtpAddress     = association.UserSmtpAddress,
             IsPin               = association.IsPin,
             ShouldEscalate      = association.ShouldEscalate,
             IsAutoSubscribed    = association.IsAutoSubscribed,
             JoinDate            = association.JoinDate,
             LastVisitedDate     = association.LastVisitedDate,
             PinDate             = association.PinDate,
             LastModified        = association.LastModified,
             CurrentVersion      = association.CurrentVersion,
             SyncedVersion       = association.SyncedVersion,
             LastSyncError       = association.LastSyncError,
             SyncAttempts        = association.SyncAttempts,
             SyncedSchemaVersion = association.SyncedSchemaVersion
         });
         return;
     }
     GetMailboxAssociation.Tracer.TraceDebug((long)this.GetHashCode(), "GetMailboxAssocaition.WriteMailboxAssociation. Skipping null MailboxAssociationFromStore.");
 }
Esempio n. 2
0
        public bool ReplicateAssociation(IAssociationAdaptor masterAdaptor, params MailboxAssociation[] associations)
        {
            ArgumentValidator.ThrowIfNull("associations", associations);
            ArgumentValidator.ThrowIfOutOfRange <int>("associations", associations.Length, 1, 1);
            ArgumentValidator.ThrowIfNull("masterAdaptor", masterAdaptor);
            MailboxAssociation mailboxAssociation = associations[0];

            InProcessAssociationReplicator.Tracer.TraceDebug <MailboxAssociation>((long)this.GetHashCode(), "InProcessAssociationReplicator::ReplicateAssociations: {0}", mailboxAssociation);
            this.Logger.LogEvent(new SchemaBasedLogEvent <MailboxAssociationLogSchema.CommandExecution>
            {
                {
                    MailboxAssociationLogSchema.CommandExecution.Command,
                    "InProcessAssociationReplicator"
                },
                {
                    MailboxAssociationLogSchema.CommandExecution.GroupMailbox,
                    mailboxAssociation.Group
                },
                {
                    MailboxAssociationLogSchema.CommandExecution.UserMailboxes,
                    mailboxAssociation.User
                }
            });
            this.PerformanceTracker.IncrementAssociationReplicationAttempts();
            MailboxLocator slaveMailboxLocator = masterAdaptor.GetSlaveMailboxLocator(mailboxAssociation);
            bool           flag = false;

            try
            {
                if (slaveMailboxLocator.IsValidReplicationTarget())
                {
                    flag = this.ExecuteReplicationToMailbox(masterAdaptor, mailboxAssociation);
                }
                else
                {
                    InProcessAssociationReplicator.Tracer.TraceDebug <MailboxAssociation>((long)this.GetHashCode(), "InProcessAssociationReplicator.ReplicateAssociation. Marking association for not replication given target type. Association = {0}", mailboxAssociation);
                    this.Logger.LogEvent(new SchemaBasedLogEvent <MailboxAssociationLogSchema.CommandExecution>
                    {
                        {
                            MailboxAssociationLogSchema.CommandExecution.Command,
                            "InProcessAssociationReplicator.MEU.Poison"
                        },
                        {
                            MailboxAssociationLogSchema.CommandExecution.GroupMailbox,
                            mailboxAssociation.Group
                        },
                        {
                            MailboxAssociationLogSchema.CommandExecution.UserMailboxes,
                            mailboxAssociation.User
                        }
                    });
                    mailboxAssociation.SyncedVersion = int.MaxValue;
                    mailboxAssociation.LastSyncError = "Target mailbox is not capable of replication";
                    flag = true;
                }
            }
            catch (MailboxNotFoundException ex)
            {
                if (this.DeleteMailboxNotFoundAssociation(mailboxAssociation, masterAdaptor, ex))
                {
                    InProcessAssociationReplicator.Tracer.TraceDebug((long)this.GetHashCode(), "InProcessAssociationReplicator.ReplicateAssociation. Succeeded deleting association for not found mailbox, reporting successful replication and skipping SaveAssociationAfterReplicationAttempt.");
                    return(true);
                }
                this.ProcessFailure(mailboxAssociation, ex.ToString());
            }
            if (!flag)
            {
                masterAdaptor.AssociationStore.SaveMailboxAsOutOfSync();
            }
            this.SaveAssociationAfterReplicationAttempt(masterAdaptor, mailboxAssociation);
            return(flag);
        }
Esempio n. 3
0
        private MailboxAssociation GetAssociationWithPriority(IAssociationAdaptor masterAdaptor, params MailboxAssociation[] associations)
        {
            MailboxAssociation result = null;

            if (this.priorityLocator != null)
            {
                result = associations.FirstOrDefault((MailboxAssociation association) => this.ShouldPrioritize(masterAdaptor.GetSlaveMailboxLocator(association)));
            }
            return(result);
        }
        internal bool UpdateAssociation(MailboxAssociationFromStore association, IAssociationAdaptor associationAdaptor)
        {
            bool           result = false;
            MailboxLocator slaveMailboxLocator = associationAdaptor.GetSlaveMailboxLocator(association);

            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.ExternalId))
            {
                slaveMailboxLocator.ExternalId = this.ExternalId;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.LegacyDn))
            {
                slaveMailboxLocator.LegacyDn = this.LegacyDn;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.IsMember))
            {
                association.IsMember = this.IsMember;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.JoinedBy))
            {
                association.JoinedBy = this.JoinedBy;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.GroupSmtpAddress))
            {
                association.GroupSmtpAddress = this.GroupSmtpAddress;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.UserSmtpAddress))
            {
                association.UserSmtpAddress = this.UserSmtpAddress;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.IsPin))
            {
                association.IsPin = this.IsPin;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.ShouldEscalate))
            {
                association.ShouldEscalate = this.ShouldEscalate;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.IsAutoSubscribed))
            {
                association.IsAutoSubscribed = this.IsAutoSubscribed;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.JoinDate))
            {
                association.JoinDate = this.JoinDate;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.LastVisitedDate))
            {
                association.LastVisitedDate = this.LastVisitedDate;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.PinDate))
            {
                association.PinDate = this.PinDate;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.CurrentVersion))
            {
                association.CurrentVersion = this.CurrentVersion;
                result = true;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.SyncedVersion))
            {
                association.SyncedVersion = this.SyncedVersion;
                result = true;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.LastSyncError))
            {
                association.LastSyncError = this.LastSyncError;
                result = true;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.SyncAttempts))
            {
                association.SyncAttempts = this.SyncAttempts;
                result = true;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.SyncedSchemaVersion))
            {
                association.SyncedSchemaVersion = this.SyncedSchemaVersion;
                result = true;
            }
            return(result);
        }