// Token: 0x06000F62 RID: 3938 RVA: 0x0005B979 File Offset: 0x00059B79 public SplitOperationFactory(IPublicFolderSession publicFolderSession, IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, IXSOFactory xsoFactory) { this.publicFolderSession = publicFolderSession; this.logger = logger; this.powershellFactory = powershellFactory; this.xsoFactory = xsoFactory; }
// Token: 0x06000E7A RID: 3706 RVA: 0x00057118 File Offset: 0x00055318 private static void RunTimedOperation(Action operation, object debugInfo, IPublicFolderMailboxLoggerBase logger) { AssistantRunspaceProxy.RunTimedOperation <int>(delegate() { operation(); return(0); }, debugInfo, logger); }
// Token: 0x06000E75 RID: 3701 RVA: 0x00056F2C File Offset: 0x0005512C public T RunPSCommand <T>(PSCommand command, out ErrorRecord error, IPublicFolderMailboxLoggerBase logger) where T : class { Collection <ErrorRecord> collection = null; Collection <T> collection2 = this.RunPSCommand <T>(command, out collection, logger); if (collection != null && collection.Count > 0) { error = collection[0]; } else { error = null; } if (collection2 != null && collection2.Count > 0) { return(collection2[0]); } return(default(T)); }
// Token: 0x06000F17 RID: 3863 RVA: 0x0005A154 File Offset: 0x00058354 public static Unlimited <ByteQuantifiedSize> GetMailboxQuota(IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, Guid mailboxGuid, OrganizationId organizationId, ISplitOperationState splitOperationState) { ADObjectId mailboxDatabase = null; bool useDatabaseQuotaDefaults = false; Unlimited <ByteQuantifiedSize> mailboxQuota = Unlimited <ByteQuantifiedSize> .UnlimitedValue; string value = string.Format("{0}\\{1}", organizationId.OrganizationalUnit.Name, mailboxGuid.ToString()); PSCommand psCommand = new PSCommand(); psCommand.AddCommand("Get-Mailbox"); psCommand.AddParameter("PublicFolder"); psCommand.AddParameter("Identity", value); Mailbox publicFolderMailbox = null; PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error) { error = null; originOfException = "GetMailboxQuota - RunPSCommand: Get-Mailbox -PublicFolder"; IAssistantRunspaceProxy assistantRunspaceProxy = powershellFactory.CreateRunspaceForDatacenterAdmin(organizationId); publicFolderMailbox = assistantRunspaceProxy.RunPSCommand <Mailbox>(psCommand, out error, logger); if (error == null) { mailboxQuota = publicFolderMailbox.ProhibitSendQuota; useDatabaseQuotaDefaults = (publicFolderMailbox.UseDatabaseQuotaDefaults ?? false); MailboxDatabase mailboxDatabase = publicFolderMailbox.Database; if (useDatabaseQuotaDefaults && mailboxDatabase != null) { psCommand.Clear(); psCommand.AddCommand("Get-MailboxDatabase"); psCommand.AddParameter("Identity", mailboxDatabase.Name); originOfException = "GetMailboxQuota - RunPSCommand: Get-MailboxDatabase"; mailboxDatabase = assistantRunspaceProxy.RunPSCommand <MailboxDatabase>(psCommand, out error, logger); if (error == null) { mailboxQuota = mailboxDatabase.ProhibitSendQuota; } } } }, splitOperationState); return(mailboxQuota); }
// Token: 0x06000F16 RID: 3862 RVA: 0x00059F68 File Offset: 0x00058168 public static Unlimited <ByteQuantifiedSize> GetActualItemSize(IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, Guid mailboxGuid, OrganizationId organizationId, ISplitOperationState splitOperationState) { Unlimited <ByteQuantifiedSize> actualItemSize = ByteQuantifiedSize.Zero; Collection <PSObject> output = null; Collection <ErrorRecord> errors = null; Dictionary <string, string> paramDictionary = new Dictionary <string, string> { { "Mailbox", mailboxGuid.ToString() }, { "Organization", organizationId.OrganizationalUnit.Name } }; string text = Path.Combine(ExchangeSetupContext.InstallPath, "Scripts"); if (string.IsNullOrEmpty(text)) { throw new SplitProcessorException("PublicFolderSplitHelper::GetActualItemSize - GetExchangeScriptsPath", new Exception("ExchangeScriptsPath is null or empty")); } string scriptFullPath = Path.Combine(text, "Get-PublicFolderMailboxSize.ps1"); PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error) { error = null; originOfException = "GetActualItemSize - RunPowershellScript Get-PublicFolderMailboxSize.ps1"; IAssistantRunspaceProxy assistantRunspaceProxy = powershellFactory.CreateRunspaceForDatacenterAdmin(organizationId); output = assistantRunspaceProxy.RunPowershellScript(scriptFullPath, paramDictionary, out errors, logger); if (errors == null && output != null && output.Count > 0) { actualItemSize = (ByteQuantifiedSize)output[0].BaseObject; return; } error = errors[0]; }, splitOperationState); return(actualItemSize); }
// Token: 0x06000F15 RID: 3861 RVA: 0x00059E04 File Offset: 0x00058004 public static Unlimited <ByteQuantifiedSize> GetTotalItemSize(IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, Guid mailboxGuid, OrganizationId organizationId, ISplitOperationState splitOperationState) { Unlimited <ByteQuantifiedSize> totalItemSize = ByteQuantifiedSize.Zero; string value = string.Format("{0}\\{1}", organizationId.OrganizationalUnit.Name, mailboxGuid.ToString()); PSCommand cmd = new PSCommand(); cmd.AddCommand("Get-MailboxStatistics"); cmd.AddParameter("NoADLookup"); cmd.AddParameter("Identity", value); MailboxStatistics publicFolderMailboxStatistics = null; PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error) { error = null; originOfException = "GetTotalItemSize - RunPSCommand Get-MailboxStatistics"; IAssistantRunspaceProxy assistantRunspaceProxy = powershellFactory.CreateRunspaceForDatacenterAdmin(organizationId); publicFolderMailboxStatistics = assistantRunspaceProxy.RunPSCommand <MailboxStatistics>(cmd, out error, logger); if (error == null && publicFolderMailboxStatistics != null) { totalItemSize = publicFolderMailboxStatistics.TotalItemSize; } }, splitOperationState); return(totalItemSize); }
// Token: 0x06000E7B RID: 3707 RVA: 0x00057148 File Offset: 0x00055348 private static T RunTimedOperation <T>(Func <T> operation, object debugInfo, IPublicFolderMailboxLoggerBase logger) { Stopwatch stopwatch = Stopwatch.StartNew(); T result; try { result = operation(); } finally { stopwatch.Stop(); TimeSpan timeoutForSynchronousOperation = PublicFolderSplitConfig.Instance.TimeoutForSynchronousOperation; if (timeoutForSynchronousOperation < stopwatch.Elapsed) { logger.LogEvent(LogEventType.Error, string.Format("SLOW Operation: took {0}s using '{1}' stack trace {2}", stopwatch.Elapsed.Seconds, debugInfo, AssistantRunspaceProxy.GetCurrentStackTrace())); } else { logger.LogEvent(LogEventType.Verbose, string.Format("Operation: took {0} using '{1}'", stopwatch.Elapsed, debugInfo)); } } return(result); }
// Token: 0x06000F2A RID: 3882 RVA: 0x0005A822 File Offset: 0x00058A22 private PublicFolderSplitProcessor(IPublicFolderSession publicFolderSession, ITracer tracer, IXSOFactory xsoFactory, IPublicFolderMailboxLoggerBase logger, IPublicFolderMailboxLoggerBase completionLogger, IAssistantRunspaceFactory powershellFactory) : base(publicFolderSession, tracer) { this.disposeTracker = this.GetDisposeTracker(); this.logger = logger; this.completionLogger = completionLogger; this.xsoFactory = xsoFactory; this.powershellFactory = powershellFactory; }
// Token: 0x06000E77 RID: 3703 RVA: 0x00057014 File Offset: 0x00055214 public Collection <PSObject> RunPowershellScript(string scriptFile, Dictionary <string, string> scriptParameters, out Collection <ErrorRecord> errors, IPublicFolderMailboxLoggerBase logger) { errors = null; Command command = new Command(scriptFile, false); if (scriptParameters != null) { foreach (KeyValuePair <string, string> keyValuePair in scriptParameters) { CommandParameter item; if (keyValuePair.Value.ToString().Contains("SwitchValue")) { item = new CommandParameter(keyValuePair.Key, new SwitchParameter(true)); } else { item = new CommandParameter(keyValuePair.Key, keyValuePair.Value); } command.Parameters.Add(item); } } PSCommand pscommand = new PSCommand(); pscommand.AddCommand(command); return(this.RunPSCommand <PSObject>(pscommand, out errors, logger)); }
// Token: 0x06000F28 RID: 3880 RVA: 0x0005A78C File Offset: 0x0005898C internal PublicFolderSplitProcessor(IPublicFolderSession publicFolderSession, ITracer tracer, IPublicFolderMailboxLoggerBase logger, IPublicFolderMailboxLoggerBase completionLogger, IAssistantRunspaceFactory powershellFactory) : this(publicFolderSession, tracer, new XSOFactory(), logger, completionLogger, powershellFactory) { this.quotaVerifier = new SplitQuotaVerifier(publicFolderSession, this.logger, this.powershellFactory); this.operationFactory = new SplitOperationFactory(publicFolderSession, this.logger, this.powershellFactory, this.xsoFactory); this.splitStateAdapter = new SplitStateAdapter(publicFolderSession, this.xsoFactory, this.logger); }
// Token: 0x06000F82 RID: 3970 RVA: 0x0005BF4D File Offset: 0x0005A14D internal SplitStateAdapter(IPublicFolderSession publicFolderSession, IXSOFactory xsoFactory, IPublicFolderMailboxLoggerBase logger) { this.publicFolderSession = publicFolderSession; this.xsoFactory = xsoFactory; this.logger = logger; }
// Token: 0x06000E76 RID: 3702 RVA: 0x00056FB0 File Offset: 0x000551B0 private Collection <T> RunPSCommand <T>(PSCommand command, out Collection <ErrorRecord> errors, IPublicFolderMailboxLoggerBase logger) { errors = null; PowerShellProxy powerShellProxy = null; Collection <T> result = AssistantRunspaceProxy.RunTimedOperation <Collection <T> >(delegate() { powerShellProxy = new PowerShellProxy(this.runspaceProxy, command); return(powerShellProxy.Invoke <T>()); }, AssistantRunspaceProxy.GetCommandString(command), logger); if (powerShellProxy.Failed) { errors = powerShellProxy.Errors; } return(result); }
// Token: 0x06000E94 RID: 3732 RVA: 0x00057748 File Offset: 0x00055948 internal IdentifyTargetMailboxOperation(IPublicFolderSplitState splitState, IPublicFolderSession publicFolderSession, IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory) : base(IdentifyTargetMailboxOperation.OperationName, publicFolderSession, splitState, logger, powershellFactory, splitState.IdentifyTargetMailboxState, SplitProgressState.IdentifyTargetMailboxStarted, SplitProgressState.IdentifyTargetMailboxCompleted) { }
// Token: 0x06000F1B RID: 3867 RVA: 0x0005A338 File Offset: 0x00058538 public static bool IsSyncRequired(Guid mailboxGuid, OrganizationId organizationId, out bool isLongRunningOp, IXSOFactory xsoFactory, IPublicFolderMailboxLoggerBase logger) { isLongRunningOp = false; bool flag = true; using (PublicFolderSession publicFolderSession = PublicFolderSession.OpenAsAdmin(organizationId, null, mailboxGuid, null, CultureInfo.CurrentCulture, string.Format("{0};Action={1}", "Client=TBA", "PublicFolderSplitHelper"), null)) { using (Folder folder = xsoFactory.BindToFolder(publicFolderSession, publicFolderSession.GetTombstonesRootFolderId()) as Folder) { using (UserConfiguration configuration = UserConfiguration.GetConfiguration(folder, new UserConfigurationName("PublicFolderSyncInfo", ConfigurationNameKind.Name), UserConfigurationTypes.Dictionary)) { IDictionary dictionary = configuration.GetDictionary(); int? num = dictionary.Contains("NumberOfFoldersToBeSynced") ? ((int?)dictionary["NumberOfFoldersToBeSynced"]) : null; int? num2 = dictionary.Contains("NumberOfFoldersSynced") ? ((int?)dictionary["NumberOfFoldersSynced"]) : null; int? num3 = (num == null) ? null : (num - (num2 ?? 0)); flag = (num3 == null || num3 > 0); isLongRunningOp = (flag && (num3 == null || num3 > PublicFolderSplitConfig.Instance.LongRunningSyncChangeCount)); logger.LogEvent(LogEventType.Statistics, string.Format("PublicFolderSplitHelper::IsSyncRequired - FTBS={0},FS={1},FTBSN={2}", num, num2, num3)); } } } return(flag); }
// Token: 0x06000F5C RID: 3932 RVA: 0x0005B6FC File Offset: 0x000598FC internal PrepareTargetMailboxOperation(IPublicFolderSplitState splitState, IPublicFolderSession publicFolderSession, IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, IXSOFactory xsoFactory) : base(PrepareTargetMailboxOperation.OperationName, publicFolderSession, splitState, logger, powershellFactory, splitState.PrepareTargetMailboxState, SplitProgressState.PrepareTargetMailboxStarted, SplitProgressState.PrepareTargetMailboxCompleted) { this.xsoFactory = xsoFactory; }
// Token: 0x06000E73 RID: 3699 RVA: 0x00056DF4 File Offset: 0x00054FF4 public static AssistantRunspaceProxy CreateRunspaceForPartner(ADObjectId ownerId, ADUser tenantAdmin, string tenantOrganization, IPublicFolderMailboxLoggerBase logger) { ArgumentValidator.ThrowIfNull("ownerId", ownerId); ArgumentValidator.ThrowIfNull("tenantAdmin", tenantAdmin); ArgumentValidator.ThrowIfNullOrEmpty("tenantOrganization", tenantOrganization); logger.LogEvent(LogEventType.Verbose, string.Format("AssistantRunspaceProxy. Creating partner runspace proxy for user {0}", tenantAdmin.Name)); ExchangeRunspaceConfigurationSettings configSettings = new ExchangeRunspaceConfigurationSettings(ExchangeRunspaceConfigurationSettings.ExchangeApplication.SimpleDataMigration, tenantOrganization, ExchangeRunspaceConfigurationSettings.GetDefaultInstance().CurrentSerializationLevel); return(new AssistantRunspaceProxy(AssistantRunspaceProxy.RunspaceFactoryWithDCAffinity.CreateRbacFactory(tenantAdmin.OrganizationId, new GenericSidIdentity(tenantAdmin.Name, string.Empty, tenantAdmin.Sid), configSettings))); }
// Token: 0x06000F29 RID: 3881 RVA: 0x0005A7F9 File Offset: 0x000589F9 internal PublicFolderSplitProcessor(IPublicFolderSession publicFolderSession, ITracer tracer, IXSOFactory xsoFactory, ISplitQuotaVerifier quotaVerifier, IPublicFolderMailboxLoggerBase logger, IPublicFolderMailboxLoggerBase completionLogger, ISplitStateAdapter adapter, ISplitOperationFactory operationFactory, IAssistantRunspaceFactory powershellFactory) : this(publicFolderSession, tracer, xsoFactory, logger, completionLogger, powershellFactory) { this.splitStateAdapter = adapter; this.quotaVerifier = quotaVerifier; this.operationFactory = operationFactory; }
// Token: 0x06000F79 RID: 3961 RVA: 0x0005BAC0 File Offset: 0x00059CC0 internal PrepareSplitPlanOperation(IPublicFolderSplitState splitState, IPublicFolderSession session, IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, string splitScriptPath) : base(PrepareSplitPlanOperation.OperationName, session, splitState, logger, powershellFactory, splitState.PrepareSplitPlanState, SplitProgressState.PrepareSplitPlanStarted, SplitProgressState.PrepareSplitPlanCompleted) { this.splitPlanScriptPath = splitScriptPath; }
// Token: 0x06000E8B RID: 3723 RVA: 0x00057438 File Offset: 0x00055638 internal SplitOperationBase(string name, IPublicFolderSession publicFolderSession, IPublicFolderSplitState splitState, IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, ISplitOperationState splitOperationState, SplitProgressState startState, SplitProgressState completionState) { this.name = name; this.publicFolderSession = publicFolderSession; this.splitState = splitState; this.logger = logger; this.powershellFactory = powershellFactory; this.startState = startState; this.completionState = completionState; this.splitOperationState = splitOperationState; }
// Token: 0x06000F80 RID: 3968 RVA: 0x0005BDBA File Offset: 0x00059FBA public SplitQuotaVerifier(IPublicFolderSession publicFolderSession, IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory) { this.publicFolderSession = publicFolderSession; this.logger = logger; this.powershellFactory = powershellFactory; }
// Token: 0x06000F19 RID: 3865 RVA: 0x0005A248 File Offset: 0x00058448 public static void SyncAndWaitForCompletion(Guid mailboxGuid, OrganizationId organizationId, IXSOFactory xsoFactory, IPublicFolderMailboxLoggerBase logger, ISplitOperationState splitOperationState) { ExchangePrincipal contentMailboxPrincipal; if (!PublicFolderSession.TryGetPublicFolderMailboxPrincipal(organizationId, mailboxGuid, false, out contentMailboxPrincipal)) { throw new ObjectNotFoundException(ServerStrings.PublicFolderMailboxNotFound); } PublicFolderSyncJobState publicFolderSyncJobState = PublicFolderSyncJobRpc.StartSyncHierarchy(contentMailboxPrincipal, true); int num = 0; while (publicFolderSyncJobState.JobStatus != PublicFolderSyncJobState.Status.Completed && publicFolderSyncJobState.LastError == null && (double)num++ < PublicFolderSplitConfig.Instance.TimeoutForSynchronousOperation.TotalMilliseconds / PublicFolderSplitConfig.Instance.QuerySyncStatusInterval.TotalMilliseconds) { Thread.Sleep(PublicFolderSplitConfig.Instance.QuerySyncStatusInterval.Milliseconds); publicFolderSyncJobState = PublicFolderSyncJobRpc.QueryStatusSyncHierarchy(contentMailboxPrincipal); } bool flag; if (publicFolderSyncJobState.JobStatus != PublicFolderSyncJobState.Status.Completed || PublicFolderSplitHelper.IsSyncRequired(mailboxGuid, organizationId, out flag, xsoFactory, logger)) { splitOperationState.Error = new SyncInProgressException(organizationId.OrganizationalUnit.Name, mailboxGuid.ToString()); return; } if (PublicFolderSplitHelper.HasSyncFailure(publicFolderSyncJobState)) { splitOperationState.Error = publicFolderSyncJobState.LastError; } }