// Token: 0x0600124D RID: 4685 RVA: 0x000694E0 File Offset: 0x000676E0
        public AssistantTaskContext FinishProcessingOAB(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;

            OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.FinishProcessingOAB: start", new object[0]);
            try
            {
                OABLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_OABGenerationCompletedGeneration, new object[]
                {
                    oabgeneratorTaskContext.CurrentOAB.ToString(),
                    oabgeneratorTaskContext.CurrentOAB.DistinguishedName,
                    oabgeneratorTaskContext.CurrentOAB.Id.ObjectGuid,
                    (oabgeneratorTaskContext.OABGenerator.Stats != null) ? oabgeneratorTaskContext.OABGenerator.Stats.GetStringForLogging() : string.Empty
                });
            }
            finally
            {
                if (oabgeneratorTaskContext.Cleanup != null)
                {
                    oabgeneratorTaskContext.Cleanup(oabgeneratorTaskContext);
                }
                oabgeneratorTaskContext.ClearPerOABData();
                OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.FinishProcessingOAB: finish", new object[0]);
            }
            if (oabgeneratorTaskContext.OABsToGenerate != null && oabgeneratorTaskContext.OABsToGenerate.Count > 0)
            {
                oabgeneratorTaskContext.CurrentOAB = oabgeneratorTaskContext.OABsToGenerate.Dequeue();
                oabgeneratorTaskContext.OABStep    = new AssistantStep(this.BeginProcessingOAB);
                return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
            }
            return(null);
        }
        // Token: 0x06001249 RID: 4681 RVA: 0x00068BAC File Offset: 0x00066DAC
        public override AssistantTaskContext InitialStep(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;

            oabgeneratorTaskContext.OABStep = new AssistantStep(this.InitializeOABGeneration);
            oabgeneratorTaskContext.Step    = new AssistantStep(this.ProcessAssistantStep);
            return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
        }
        // Token: 0x0600124C RID: 4684 RVA: 0x00069300 File Offset: 0x00067500
        public AssistantTaskContext BeginProcessingOAB(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;
            AssistantStep           assistantStep           = null;

            OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.BeginProcessingOAB: start", new object[0]);
            OABGeneratorMailboxData oabgeneratorMailboxData = (OABGeneratorMailboxData)oabgeneratorTaskContext.Args.MailboxData;

            try
            {
                lock (this.currentOABsInProcessing)
                {
                    if (this.currentOABsInProcessing.Contains(oabgeneratorTaskContext.CurrentOAB.Id.ObjectGuid))
                    {
                        OABGeneratorAssistant.Tracer.TraceDebug <ADObjectId>((long)this.GetHashCode(), "OABGeneratorAssistant.BeginProcessingOAB: ignoring on-demand request requested OAB is already in processing: {0}.", oabgeneratorTaskContext.CurrentOAB.Id);
                        return(null);
                    }
                    this.currentOABsInProcessing.Add(oabgeneratorTaskContext.CurrentOAB.Id.ObjectGuid);
                }
                OABGeneratorTaskContext oabgeneratorTaskContext2 = oabgeneratorTaskContext;
                oabgeneratorTaskContext2.Cleanup     = (Action <OABGeneratorTaskContext>)Delegate.Combine(oabgeneratorTaskContext2.Cleanup, new Action <OABGeneratorTaskContext>(this.RemoveCurrentOABFromInProcessingList));
                oabgeneratorTaskContext.OABGenerator = new OABGenerator(oabgeneratorTaskContext.PerOrgAdSystemConfigSession, oabgeneratorTaskContext.CurrentOAB, oabgeneratorMailboxData.MailboxSid, oabgeneratorMailboxData.MailboxDomain, new Action(this.AbortProcessingOnShutdown));
                OABLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_OABGenerationStartGeneration, new object[]
                {
                    oabgeneratorTaskContext.CurrentOAB,
                    oabgeneratorTaskContext.CurrentOAB.DistinguishedName,
                    oabgeneratorTaskContext.CurrentOAB.Id.ObjectGuid
                });
                oabgeneratorTaskContext.OABGenerator.Initialize();
                oabgeneratorTaskContext.ReturnStep.Push(new AssistantStep(this.FinishProcessingOAB));
                assistantStep = new AssistantStep(oabgeneratorTaskContext.OABGenerator.PrepareFilesForOABGeneration);
            }
            finally
            {
                OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.BeginProcessingOAB: finish", new object[0]);
                if (assistantStep != null)
                {
                    oabgeneratorTaskContext.OABStep = assistantStep;
                }
            }
            return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
        }
Ejemplo n.º 4
0
        // Token: 0x06001338 RID: 4920 RVA: 0x0006FD1C File Offset: 0x0006DF1C
        public AssistantTaskContext ProduceSortedFlatFile(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;
            AssistantStep           oabstep = oabgeneratorTaskContext.ReturnStep.Pop();

            OABLogger.LogRecord(TraceType.FunctionTrace, "AddressListFileGenerator.ProduceSortedFlatFile: start", new object[0]);
            try
            {
                using (new StopwatchPerformanceTracker("Total", this.stats))
                {
                    using (new CpuPerformanceTracker("Total", this.stats))
                    {
                        using (new StopwatchPerformanceTracker("ProduceSortedFlatFile", this.stats))
                        {
                            using (new CpuPerformanceTracker("ProduceSortedFlatFile", this.stats))
                            {
                                this.stats.DomainControllersUsed.Add(this.adAddressListEnumerator.LastUsedDc);
                                this.uncompressedSortedFlatFile = this.fileSet.Create("OAB");
                                if (this.allResultsInSinglePage)
                                {
                                    this.CreateFlatFileFromSinglePageOfResults(this.uncompressedSortedFlatFile, this.sortedEntries);
                                }
                                else
                                {
                                    this.CreateFlatFileFromMultiplePagesOfResults(this.uncompressedSortedFlatFile, this.tempFiles);
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                OABLogger.LogRecord(TraceType.FunctionTrace, "AddressListFileGenerator.ProduceSortedFlatFile: finish", new object[0]);
                oabgeneratorTaskContext.OABStep = oabstep;
            }
            return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
        }
Ejemplo n.º 5
0
        // Token: 0x06001337 RID: 4919 RVA: 0x0006F84C File Offset: 0x0006DA4C
        public AssistantTaskContext ProcessOnePageOfADResults(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;
            AssistantStep           oabstep = new AssistantStep(this.ProduceSortedFlatFile);

            OABLogger.LogRecord(TraceType.FunctionTrace, "AddressListFileGenerator.ProcessOnePageOfADResults: start", new object[0]);
            try
            {
                using (new StopwatchPerformanceTracker("Total", this.stats))
                {
                    using (new CpuPerformanceTracker("Total", this.stats))
                    {
                        using (new StopwatchPerformanceTracker("ProcessOnePageOfADResults", this.stats))
                        {
                            using (new CpuPerformanceTracker("ProcessOnePageOfADResults", this.stats))
                            {
                                if (this.adAddressListEnumerator.RetrievedAllData == null || !this.adAddressListEnumerator.RetrievedAllData.Value)
                                {
                                    this.sortedEntries          = this.adAddressListEnumerator.GetNextPageSorted();
                                    this.allResultsInSinglePage = (this.firstPage && this.adAddressListEnumerator.RetrievedAllData != null && this.adAddressListEnumerator.RetrievedAllData.Value);
                                    this.firstPage = false;
                                    if (!this.allResultsInSinglePage)
                                    {
                                        using (new StopwatchPerformanceTracker("ProcessOnePageOfADResults.ResolveLinks", this.stats))
                                        {
                                            using (new CpuPerformanceTracker("ProcessOnePageOfADResults.ResolveLinks", this.stats))
                                            {
                                                using (new ADPerformanceTracker("ProcessOnePageOfADResults.ResolveLinks", this.stats))
                                                {
                                                    using (new ActiveManagerPerformanceTracker("ProcessOnePageOfADResults.ResolveLinks", this.stats))
                                                    {
                                                        this.propertyManager.ResolveLinks(this.sortedEntries);
                                                    }
                                                }
                                            }
                                        }
                                        FileStream fileStream = this.fileSet.Create("TMP");
                                        this.tempFiles.Add(fileStream);
                                        this.stats.TotalNumberOfTempFiles++;
                                        using (new StopwatchPerformanceTracker("ProcessOnePageOfADResults.WriteTempFiles", this.stats))
                                        {
                                            using (new CpuPerformanceTracker("ProcessOnePageOfADResults.WriteTempFiles", this.stats))
                                            {
                                                using (IOCostStream iocostStream = new IOCostStream(new NoCloseStream(fileStream)))
                                                {
                                                    using (new FileSystemPerformanceTracker("ProcessOnePageOfADResults.WriteTempFiles", iocostStream, this.stats))
                                                    {
                                                        using (BinaryWriter binaryWriter = new BinaryWriter(iocostStream))
                                                        {
                                                            foreach (ADRawEntry adrawEntry in this.sortedEntries)
                                                            {
                                                                this.abortProcessingOnShutdown();
                                                                OABFileRecord oabfileRecord = this.CreateDetailsRecord(adrawEntry);
                                                                binaryWriter.Write(((Guid)adrawEntry[ADObjectSchema.ExchangeObjectId]).ToByteArray());
                                                                oabfileRecord.WriteTo(binaryWriter);
                                                            }
                                                            this.stats.IODuration += iocostStream.Writing;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (this.adAddressListEnumerator.RetrievedAllData == null || !this.adAddressListEnumerator.RetrievedAllData.Value)
                                {
                                    oabstep = new AssistantStep(this.ProcessOnePageOfADResults);
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                OABLogger.LogRecord(TraceType.FunctionTrace, "AddressListFileGenerator.ProcessOnePageOfADResults: finish", new object[0]);
                oabgeneratorTaskContext.OABStep = oabstep;
            }
            return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
        }
        // Token: 0x0600124B RID: 4683 RVA: 0x00069084 File Offset: 0x00067284
        public AssistantTaskContext InitializeOABGeneration(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;
            AssistantStep           oabstep = new AssistantStep(this.BeginProcessingOAB);

            OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.InitialStep: start", new object[0]);
            OABGeneratorMailboxData oabgeneratorMailboxData = (OABGeneratorMailboxData)oabgeneratorTaskContext.Args.MailboxData;

            try
            {
                OrganizationId organizationId = oabgeneratorMailboxData.OrganizationId;
                if (organizationId == null)
                {
                    throw new ArgumentException("unable to determine organization Id");
                }
                oabgeneratorTaskContext.PerOrgAdSystemConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(organizationId), 502, "InitializeOABGeneration", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\OABGenerator\\OABGeneratorAssistant.cs");
                if (oabgeneratorMailboxData.OfflineAddressBook == Guid.Empty)
                {
                    OABLogger.LogRecord(TraceType.InfoTrace, "OABGenerator invoked for scheduled generation of OABs for Org '{0}' on DatabaseGuid={1}", new object[]
                    {
                        organizationId,
                        oabgeneratorTaskContext.Args.MailboxData.DatabaseGuid
                    });
                    oabgeneratorTaskContext.OABsToGenerate = this.GetOABsFromAD(oabgeneratorTaskContext, Guid.Empty);
                }
                else
                {
                    OABLogger.LogRecord(TraceType.InfoTrace, "OABGenerator invoked {0} for on-demand generation of OAB {1} for Org {2} DatabaseGuid={3}, MailboxGuid={4}", new object[]
                    {
                        oabgeneratorMailboxData.JobDescription,
                        oabgeneratorMailboxData.OfflineAddressBook,
                        organizationId,
                        oabgeneratorTaskContext.Args.MailboxData.DatabaseGuid,
                        oabgeneratorMailboxData.MailboxGuid
                    });
                    oabgeneratorTaskContext.OABsToGenerate = this.GetOABsFromAD(oabgeneratorTaskContext, oabgeneratorMailboxData.OfflineAddressBook);
                    if (oabgeneratorTaskContext.OABsToGenerate == null || oabgeneratorTaskContext.OABsToGenerate.Count != 1)
                    {
                        OABLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_CannotFindOAB, new object[]
                        {
                            oabgeneratorMailboxData.OfflineAddressBook
                        });
                    }
                }
                if (oabgeneratorTaskContext.OABsToGenerate == null || oabgeneratorTaskContext.OABsToGenerate.Count == 0)
                {
                    OABLogger.LogRecord(TraceType.InfoTrace, "InvokeInternal. No OABs found to generate for DatabaseGuid={0}, MailboxGuid={1}", new object[]
                    {
                        oabgeneratorMailboxData.DatabaseGuid,
                        oabgeneratorMailboxData.MailboxGuid.ToString(),
                        oabgeneratorMailboxData.Guid
                    });
                    if (oabgeneratorTaskContext.Cleanup != null)
                    {
                        oabgeneratorTaskContext.Cleanup(oabgeneratorTaskContext);
                    }
                    return(null);
                }
                OABLogger.LogRecord(TraceType.InfoTrace, "Found {0} OAB(s) to generate", new object[]
                {
                    oabgeneratorTaskContext.OABsToGenerate.Count
                });
                oabgeneratorTaskContext.CurrentOAB = oabgeneratorTaskContext.OABsToGenerate.Dequeue();
            }
            finally
            {
                OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.InitialStep: finish", new object[0]);
                oabgeneratorTaskContext.OABStep = oabstep;
            }
            return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
        }