Exemplo n.º 1
0
        // Token: 0x0600105D RID: 4189 RVA: 0x0005F918 File Offset: 0x0005DB18
        private void LogCompletion(DtmfMapGeneratorTaskContext taskContext, RecipientType recipientType)
        {
            base.Logger.TraceDebug(null, "Entering DtmfMapGenerator.LogCompletion recipientType='{0}'", new object[]
            {
                recipientType
            });
            UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapGenerationSuccessful, null, new object[]
            {
                base.RunData.TenantId,
                base.RunData.RunId,
                recipientType
            });
            DateTime runStartTime              = base.RunStartTime;
            DateTime lastFullUpdateTimeUtc     = taskContext.IsFullUpdate ? base.RunStartTime : taskContext.Metadata.LastFullUpdateTimeUtc;
            DtmfMapGenerationMetadata metadata = new DtmfMapGenerationMetadata(1, base.TenantId, base.RunId, Utils.GetLocalHostFqdn(), "15.00.1497.010", runStartTime, lastFullUpdateTimeUtc);
            string metadataFileName            = this.GetMetadataFileName(recipientType);
            string dtmfMapFolderPath           = GrammarFileDistributionShare.GetDtmfMapFolderPath(base.RunData.OrgId, base.RunData.MailboxGuid);

            base.Logger.TraceDebug(this, "LogCompletion folderPath='{0}', fileName='{1}'", new object[]
            {
                dtmfMapFolderPath,
                metadataFileName
            });
            string text = DtmfMapGenerationMetadata.Serialize(metadata, metadataFileName, dtmfMapFolderPath);

            if (text != null)
            {
                this.UploadMetadata(text, metadataFileName);
            }
        }
Exemplo n.º 2
0
        // Token: 0x0600105A RID: 4186 RVA: 0x0005F57C File Offset: 0x0005D77C
        private bool ProcessNextChunk(DtmfMapGeneratorTaskContext taskContext)
        {
            base.Logger.TraceDebug(this, "Entering DtmfMapGenerator.ProcessNextChunk", new object[0]);
            IRecipientSession writableSession = this.CreateWritableSession(base.RunData.OrgId);
            List <ADObjectId> recipientIds;
            bool recipientIds2 = this.GetRecipientIds(taskContext, out recipientIds);

            if (recipientIds.Count > 0)
            {
                Result <ADRecipient>[] recipients = null;
                Exception ex = Utilities.RunSafeADOperation(this.Trace, delegate
                {
                    recipients = writableSession.ReadMultiple(recipientIds.ToArray());
                }, "DtmfMapGenerator.ProcessNextChunk: Batched read of users matching given list of ADObjectIds");
                if (ex != null)
                {
                    throw ex;
                }
                for (int i = 0; i < recipients.Length; i++)
                {
                    Result <ADRecipient> result = recipients[i];
                    if (result.Error == null)
                    {
                        ADRecipient recipient = result.Data;
                        Utilities.RunSafeADOperation(this.Trace, delegate
                        {
                            this.Logger.TraceDebug(this, "DtmfMapGenerator.ProcessNextChunk - Processing recipient='{0}'", new object[]
                            {
                                recipient
                            });
                            recipient.PopulateDtmfMap(true);
                            if (recipient.UMDtmfMap.Changed)
                            {
                                writableSession.Save(recipient);
                            }
                        }, "DtmfMapGenerator.ProcessNextChunk : Calculating and saving DTMF map for user");
                    }
                    else
                    {
                        UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapUpdateFailed, null, new object[]
                        {
                            recipientIds[i],
                            base.RunData.TenantId,
                            base.RunData.RunId
                        });
                    }
                    base.RunData.ThrowIfShuttingDown();
                }
            }
            base.Logger.TraceDebug(this, "DtmfMapGenerator.ProcessNextChunk - Number of recipients processed='{0}'", new object[]
            {
                recipientIds.Count
            });
            return(recipientIds2);
        }
Exemplo n.º 3
0
        // Token: 0x06001058 RID: 4184 RVA: 0x0005F290 File Offset: 0x0005D490
        protected override DirectoryProcessorBaseTaskContext DoChunkWork(DirectoryProcessorBaseTaskContext context, RecipientType recipientType)
        {
            ValidateArgument.NotNull(context, "context");
            base.Logger.TraceDebug(this, "Entering DtmfMapGenerator.DoChunkWork recipientType='{0}'", new object[]
            {
                recipientType
            });
            if ((RecipientType.Group == recipientType && (context.TaskStatus & TaskStatus.DLADCrawlerFailed) != TaskStatus.NoError) || (RecipientType.User == recipientType && (context.TaskStatus & TaskStatus.UserADCrawlerFailed) != TaskStatus.NoError))
            {
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapGenerationSkippedNoADFile, null, new object[]
                {
                    base.TenantId,
                    base.RunId,
                    recipientType
                });
                return(null);
            }
            DtmfMapGeneratorTaskContext dtmfMapGeneratorTaskContext = context as DtmfMapGeneratorTaskContext;

            if (dtmfMapGeneratorTaskContext == null)
            {
                base.Logger.TraceDebug(this, "First time DtmfMapGenerator.DoChunkWork is called", new object[0]);
                dtmfMapGeneratorTaskContext = this.InitializeTask(recipientType, context);
            }
            DtmfMapGeneratorTaskContext dtmfMapGeneratorTaskContext2 = dtmfMapGeneratorTaskContext;

            try
            {
                if (this.ProcessNextChunk(dtmfMapGeneratorTaskContext))
                {
                    this.LogCompletion(dtmfMapGeneratorTaskContext, recipientType);
                    dtmfMapGeneratorTaskContext2 = null;
                }
            }
            catch (Exception)
            {
                dtmfMapGeneratorTaskContext2 = null;
                throw;
            }
            finally
            {
                if (dtmfMapGeneratorTaskContext2 == null)
                {
                    dtmfMapGeneratorTaskContext.Dispose();
                }
            }
            return(dtmfMapGeneratorTaskContext2);
        }
Exemplo n.º 4
0
        // Token: 0x06001059 RID: 4185 RVA: 0x0005F390 File Offset: 0x0005D590
        private DtmfMapGeneratorTaskContext InitializeTask(RecipientType recipientType, DirectoryProcessorBaseTaskContext context)
        {
            base.Logger.TraceDebug(null, "Entering DtmfMapGenerator.InitializeTask recipientType='{0}'", new object[]
            {
                recipientType
            });
            string text = null;

            if (recipientType != RecipientType.User)
            {
                if (recipientType != RecipientType.Group)
                {
                    ExAssert.RetailAssert(false, "Unsupported recipient type");
                }
                else
                {
                    text = "DistributionList";
                }
            }
            else
            {
                text = "User";
            }
            string entriesFilePath = ADCrawler.GetEntriesFilePath(base.RunData.RunFolderPath, text);

            base.Logger.TraceDebug(null, "DtmfMapGenerator.InitializeTask adEntriesFileName='{0}', entriesFilePath='{1}'", new object[]
            {
                text,
                entriesFilePath
            });
            XmlReader adEntriesReader            = XmlReader.Create(entriesFilePath);
            DtmfMapGenerationMetadata   metadata = this.GetMetadata(recipientType);
            DtmfMapGeneratorTaskContext dtmfMapGeneratorTaskContext = new DtmfMapGeneratorTaskContext(context.MailboxData, context.Job, context.TaskQueue, context.Step, context.TaskStatus, adEntriesReader, metadata, this.IsFullUpdateRequired(metadata), context.RunData, context.DeferredFinalizeTasks);

            UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapGenerationStarted, null, new object[]
            {
                base.TenantId,
                base.RunId,
                recipientType.ToString(),
                dtmfMapGeneratorTaskContext.IsFullUpdate
            });
            return(dtmfMapGeneratorTaskContext);
        }
Exemplo n.º 5
0
        // Token: 0x0600105B RID: 4187 RVA: 0x0005F730 File Offset: 0x0005D930
        private bool GetRecipientIds(DtmfMapGeneratorTaskContext taskContext, out List <ADObjectId> recipientIds)
        {
            base.Logger.TraceDebug(this, "Entering DtmfMapGenerator.GetRecipientIds", new object[0]);
            recipientIds = new List <ADObjectId>(100);
            bool      result          = true;
            XmlReader adEntriesReader = taskContext.AdEntriesReader;

            while (adEntriesReader.ReadToFollowing("ADEntry"))
            {
                base.Logger.TraceDebug(this, "DtmfMapGenerator.GetRecipientIds - Read next recipient id", new object[0]);
                Guid          guid          = new Guid(adEntriesReader.GetAttribute(GrammarRecipientHelper.LookupProperties[3].Name));
                RecipientType recipientType = (RecipientType)Enum.Parse(typeof(RecipientType), adEntriesReader.GetAttribute(GrammarRecipientHelper.LookupProperties[4].Name));
                string        attribute     = adEntriesReader.GetAttribute(GrammarRecipientHelper.LookupProperties[7].Name);
                DateTime      dateTime      = this.ParseDateTime(attribute);
                base.Logger.TraceDebug(this, "DtmfMapGenerator.GetRecipientIds - objectGuid='{0}', recipientType='{1}', whenChangedUtcString='{2}', whenChangedUtc='{3}'", new object[]
                {
                    guid,
                    recipientType,
                    attribute,
                    dateTime
                });
                DateTime lastIncrementalUpdateTimeUtc = taskContext.Metadata.LastIncrementalUpdateTimeUtc;
                if (recipientType != RecipientType.DynamicDistributionGroup && (taskContext.IsFullUpdate || dateTime > lastIncrementalUpdateTimeUtc))
                {
                    base.Logger.TraceDebug(this, "DtmfMapGenerator.GetRecipientIds - Adding objectGuid='{0}'", new object[]
                    {
                        guid
                    });
                    recipientIds.Add(new ADObjectId(guid));
                    if (recipientIds.Count >= 100)
                    {
                        base.Logger.TraceDebug(this, "Max ids read from file in this chunk='{0}'", new object[]
                        {
                            recipientIds.Count
                        });
                        result = false;
                        break;
                    }
                }
            }
            return(result);
        }