internal AnchorFolder(AnchorContext context, Folder folder) { AnchorUtil.ThrowOnNullArgument(context, "context"); AnchorUtil.ThrowOnNullArgument(folder, "folder"); base.AnchorContext = context; this.Folder = folder; }
private static Folder GetFolder(AnchorContext context, MailboxSession mailboxSession, StoreObjectId rootFolderId, string folderName) { AnchorUtil.ThrowOnNullArgument(mailboxSession, "mailboxSession"); AnchorUtil.ThrowOnNullArgument(rootFolderId, "rootFolderId"); AnchorUtil.ThrowOnNullArgument(folderName, "folderName"); Folder result; using (DisposeGuard disposeGuard = default(DisposeGuard)) { Folder folder = null; StoreObjectId storeObjectId = AnchorFolder.GetFolderId(context, mailboxSession, rootFolderId, folderName); if (storeObjectId == null) { folder = Folder.Create(mailboxSession, rootFolderId, StoreObjectType.Folder, folderName, CreateMode.OpenIfExists); disposeGuard.Add <Folder>(folder); folder.Save(); folder.Load(AnchorFolder.FolderIdPropertyDefinition); storeObjectId = folder.Id.ObjectId; } if (folder == null) { folder = Folder.Bind(mailboxSession, storeObjectId, AnchorFolder.FolderIdPropertyDefinition); disposeGuard.Add <Folder>(folder); } disposeGuard.Success(); result = folder; } return(result); }
// Token: 0x06000068 RID: 104 RVA: 0x00003979 File Offset: 0x00001B79 public MigrationMailboxCache(AnchorContext context) { AnchorUtil.ThrowOnNullArgument(context, "context"); this.Context = context; this.LastRefreshed = DateTime.MinValue; this.MigrationMailboxes = new Dictionary <Guid, BatchCreatorScheduler.MigrationMailbox>(); }
// Token: 0x060001DF RID: 479 RVA: 0x00006E88 File Offset: 0x00005088 public static AnchorDataProvider CreateProviderForMigrationMailboxFolder(AnchorContext context, AnchorADProvider activeDirectoryProvider, string folderName) { AnchorUtil.ThrowOnNullArgument(context, "context"); AnchorUtil.ThrowOnNullArgument(activeDirectoryProvider, "activeDirectoryProvider"); AnchorUtil.ThrowOnNullArgument(folderName, "folderName"); return(AnchorDataProvider.CreateProviderForMailboxSession(context, activeDirectoryProvider, folderName, new Func <ExchangePrincipal, MailboxSession>(AnchorDataProvider.OpenMailboxSession))); }
protected AnchorAttachment(AnchorContext anchorContext, Stream stream, ExDateTime lastModifiedTime, string id) { AnchorUtil.ThrowOnNullArgument(anchorContext, "anchorContext"); AnchorUtil.ThrowOnNullArgument(stream, "stream"); this.anchorContext = anchorContext; this.stream = stream; this.lastModifiedTime = lastModifiedTime; this.Id = id; }
public UpgradeBatchCreatorScheduler(AnchorContext context, IOrganizationOperation orgOperationProxyInstance, WaitHandle stopEvent) : base(context, stopEvent) { this.orgOperationProxy = orgOperationProxyInstance; if (orgOperationProxyInstance is OrgOperationProxy) { ((OrgOperationProxy)this.orgOperationProxy).Context = context; } this.e14CountsUpdateInterval = base.Context.Config.GetConfig <TimeSpan>("E14CountUpdateInterval"); }
bool IAnchorService.Initialize(AnchorContext anchorContext) { LoadBalanceAnchorContext loadBalanceAnchorContext = (LoadBalanceAnchorContext)anchorContext; this.anchorContext = loadBalanceAnchorContext; this.directoryProvider = loadBalanceAnchorContext.Directory; this.logger = loadBalanceAnchorContext.Logger; return(loadBalanceAnchorContext.Settings.IsEnabled); }
// Token: 0x060001D4 RID: 468 RVA: 0x00006D20 File Offset: 0x00004F20 private AnchorDataProvider(AnchorContext anchorContext, AnchorADProvider activeDirectoryProvider, MailboxSession mailboxSession, AnchorFolder folder, bool ownSession) { AnchorUtil.ThrowOnNullArgument(anchorContext, "anchorContext"); AnchorUtil.ThrowOnNullArgument(activeDirectoryProvider, "activeDirectoryProvider"); AnchorUtil.ThrowOnNullArgument(mailboxSession, "mailboxSession"); AnchorUtil.ThrowOnNullArgument(folder, "folder"); this.anchorContext = anchorContext; this.activeDirectoryProvider = activeDirectoryProvider; this.MailboxSession = mailboxSession; this.folder = folder; this.ownSession = ownSession; }
// Token: 0x060001E7 RID: 487 RVA: 0x000073B4 File Offset: 0x000055B4 public IAnchorDataProvider GetProviderForFolder(AnchorContext context, string folderName) { IAnchorDataProvider result; using (DisposeGuard disposeGuard = default(DisposeGuard)) { AnchorFolder disposable = AnchorFolder.GetFolder(this.anchorContext, this.MailboxSession, folderName); disposeGuard.Add <AnchorFolder>(disposable); AnchorDataProvider anchorDataProvider = new AnchorDataProvider(context, this.activeDirectoryProvider, this.MailboxSession, disposable, false); disposeGuard.Success(); result = anchorDataProvider; } return(result); }
internal static AnchorFolder GetFolder(AnchorContext context, MailboxSession mailboxSession, string folderName) { AnchorFolder result; using (DisposeGuard disposeGuard = default(DisposeGuard)) { Folder folder = AnchorFolder.GetFolder(context, mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Root), folderName); disposeGuard.Add <Folder>(folder); AnchorFolder anchorFolder = new AnchorFolder(context, folder); disposeGuard.Success(); result = anchorFolder; } return(result); }
private static StoreObjectId GetFolderId(AnchorContext context, MailboxSession mailboxSession, StoreObjectId rootFolderId, string folderName) { AnchorUtil.ThrowOnNullArgument(mailboxSession, "mailboxSession"); AnchorUtil.ThrowOnNullArgument(rootFolderId, "rootFolderId"); AnchorUtil.ThrowOnNullArgument(folderName, "folderName"); try { using (Folder folder = Folder.Bind(mailboxSession, rootFolderId)) { using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.None, null, null, new PropertyDefinition[] { FolderSchema.Id, StoreObjectSchema.DisplayName })) { QueryFilter seekFilter = new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.DisplayName, folderName); if (queryResult.SeekToCondition(SeekReference.OriginBeginning, seekFilter)) { object[][] rows = queryResult.GetRows(1); if (rows.Length > 0) { VersionedId versionedId = (VersionedId)rows[0][0]; return(versionedId.ObjectId); } } } } context.Logger.Log(MigrationEventType.Warning, "Couldn't find subfolder {0}", new object[] { folderName }); } catch (ObjectNotFoundException exception) { context.Logger.Log(MigrationEventType.Warning, exception, "Folder {0} missing, will try to create it", new object[] { folderName }); } catch (StorageTransientException exception2) { context.Logger.Log(MigrationEventType.Warning, exception2, "Transient exception when trying to get Folder {0} will try to create it", new object[] { folderName }); } return(null); }
internal TenantDataCollectorScheduler(AnchorContext context, IOrganizationOperation orgOperationProxyInstance, ISymphonyProxy symphonyProxyInstance, WaitHandle stopEvent) : base(context, stopEvent) { this.ForestName = NativeHelpers.GetForestName().Split(new char[] { '.' })[0]; this.orgOperationProxy = orgOperationProxyInstance; if (orgOperationProxyInstance is OrgOperationProxy) { ((OrgOperationProxy)this.orgOperationProxy).Context = context; } this.symphonyProxy = symphonyProxyInstance; if (symphonyProxyInstance is SymphonyProxy) { ((SymphonyProxy)this.symphonyProxy).WorkloadUri = new Uri(context.Config.GetConfig <Uri>("WebServiceUri"), "WorkloadService.svc"); ((SymphonyProxy)this.symphonyProxy).Cert = CertificateHelper.GetExchangeCertificate(context.Config.GetConfig <string>("CertificateSubject")); } }
// Token: 0x060001EA RID: 490 RVA: 0x00007478 File Offset: 0x00005678 private static AnchorDataProvider CreateProviderForMailboxSession(AnchorContext context, AnchorADProvider activeDirectoryProvider, string folderName, Func <ExchangePrincipal, MailboxSession> mailboxSessionCreator) { AnchorUtil.ThrowOnNullArgument(mailboxSessionCreator, "mailboxSessionCreator"); AnchorDataProvider result; using (DisposeGuard disposeGuard = default(DisposeGuard)) { ExchangePrincipal mailboxOwner = activeDirectoryProvider.GetMailboxOwner(AnchorDataProvider.GetMailboxFilter(context.AnchorCapability)); MailboxSession disposable = mailboxSessionCreator(mailboxOwner); disposeGuard.Add <MailboxSession>(disposable); AnchorFolder disposable2 = AnchorFolder.GetFolder(context, disposable, folderName); disposeGuard.Add <AnchorFolder>(disposable2); AnchorDataProvider anchorDataProvider = new AnchorDataProvider(context, activeDirectoryProvider, disposable, disposable2, true); disposeGuard.Success(); result = anchorDataProvider; } return(result); }
internal static AnchorAttachment GetAttachment(AnchorContext context, MessageItem message, string name, PropertyOpenMode openMode) { AnchorUtil.ThrowOnNullArgument(message, "message"); AnchorUtil.ThrowOnNullOrEmptyArgument(name, "name"); if (openMode != PropertyOpenMode.ReadOnly && openMode != PropertyOpenMode.Modify) { throw new ArgumentException("Invalid OpenMode for GetAttachment", "openMode"); } AnchorAttachment anchorAttachment = null; foreach (AttachmentHandle handle in message.AttachmentCollection) { StreamAttachment streamAttachment = null; try { AttachmentType type = AttachmentType.Stream; streamAttachment = (StreamAttachment)message.AttachmentCollection.Open(handle, type); if (streamAttachment.FileName.Equals(name, StringComparison.OrdinalIgnoreCase)) { anchorAttachment = new AnchorAttachment(context, streamAttachment, openMode); streamAttachment = null; break; } } finally { if (streamAttachment != null) { streamAttachment.Dispose(); streamAttachment = null; } } } if (anchorAttachment == null) { throw new MigrationAttachmentNotFoundException(name); } return(anchorAttachment); }
internal static void RunUpdateOperation(AnchorContext context, Action updateOperation) { for (int i = 1; i <= 3; i++) { try { updateOperation(); break; } catch (TransientException ex) { context.Logger.Log(MigrationEventType.Warning, "Encountered a transient exception", new object[] { ex }); if (i == 3) { throw; } } } }
internal static AnchorAttachment CreateAttachment(AnchorContext context, MessageItem message, string name) { AnchorUtil.ThrowOnNullArgument(message, "message"); AnchorUtil.ThrowOnNullOrEmptyArgument(name, "name"); AttachmentType type = AttachmentType.Stream; AttachmentId attachmentId = null; foreach (AttachmentHandle handle in message.AttachmentCollection) { using (StreamAttachment streamAttachment = (StreamAttachment)message.AttachmentCollection.Open(handle, type)) { if (streamAttachment.FileName.Equals(name, StringComparison.OrdinalIgnoreCase)) { attachmentId = streamAttachment.Id; break; } } } context.Logger.Log(MigrationEventType.Information, "Creating a new attachment with name {0}", new object[] { name }); StreamAttachment streamAttachment2 = (StreamAttachment)message.AttachmentCollection.Create(type); streamAttachment2.FileName = name; if (attachmentId != null) { context.Logger.Log(MigrationEventType.Information, "Found an existing attachment with name {0} and id {1}, removing old one", new object[] { name, attachmentId.ToBase64String() }); message.AttachmentCollection.Remove(attachmentId); } return(new AnchorAttachment(context, streamAttachment2, PropertyOpenMode.Create)); }
internal UpgradeHandlerScheduler(AnchorContext context, IOrganizationOperation orgOperationProxyInstance, ISymphonyProxy symphonyProxyInstance, WaitHandle stopEvent) : base(context, stopEvent) { string domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName; AnchorUtil.AssertOrThrow(!string.IsNullOrEmpty(domainName), "Expect to have valid domain name set", new object[0]); int num = domainName.IndexOf('.'); AnchorUtil.AssertOrThrow(num >= 0, "Expect a valid dns name {0}", new object[] { domainName }); this.ForestName = domainName.Substring(0, num); this.orgOperationProxy = orgOperationProxyInstance; if (orgOperationProxyInstance is OrgOperationProxy) { ((OrgOperationProxy)this.orgOperationProxy).Context = context; } this.symphonyProxy = symphonyProxyInstance; if (symphonyProxyInstance is SymphonyProxy) { ((SymphonyProxy)this.symphonyProxy).WorkloadUri = new Uri(context.Config.GetConfig <Uri>("WebServiceUri"), "WorkloadService.svc"); ((SymphonyProxy)this.symphonyProxy).Cert = CertificateHelper.GetExchangeCertificate(context.Config.GetConfig <string>("CertificateSubject")); } }
// Token: 0x06000033 RID: 51 RVA: 0x000029FB File Offset: 0x00000BFB internal BatchCreatorScheduler(AnchorContext context, WaitHandle stopEvent) : this(context, stopEvent, LoadBalanceServiceAdapter.Create(context.Logger)) { }
// Token: 0x0600004F RID: 79 RVA: 0x000036F0 File Offset: 0x000018F0 public OccupantContext(AnchorContext context, MigrationOccupantType occupantType) { this.LogContext = new BatchCreatorScheduler.OccupantContext.OccupantLogContext(occupantType); this.ConfigContext = new GenericSettingsContext("MigrationOccupantType", occupantType.ToString(), null).Activate(); AnchorLogContext.Current.SetSummarizable(this.LogContext); }
// Token: 0x0600005D RID: 93 RVA: 0x000038E5 File Offset: 0x00001AE5 public IDisposable ActivateContext(AnchorContext context) { return(new BatchCreatorScheduler.OccupantContext(context, this.OccupantType)); }
internal AnchorEmailMessageItem(AnchorContext context, IAnchorADProvider adProvider, MessageItem message) { this.context = context; this.ADProvider = adProvider; this.Message = message; }
// Token: 0x0600024F RID: 591 RVA: 0x00008DF2 File Offset: 0x00006FF2 internal AnchorMessageItem(AnchorContext context, MailboxSession mailboxSession, StoreObjectId id) { base.AnchorContext = context; this.Initialize(mailboxSession, id, AnchorStoreObject.IdPropertyDefinition); }
// Token: 0x0600024E RID: 590 RVA: 0x00008DDC File Offset: 0x00006FDC internal AnchorMessageItem(AnchorContext context, MessageItem message) { base.AnchorContext = context; this.Message = message; }
// Token: 0x0600027A RID: 634 RVA: 0x0000930E File Offset: 0x0000750E public AnchorXmlSerializableObject(AnchorContext context) : base(context) { }
protected AnchorPersistableBase(AnchorContext context) { this.AnchorContext = context; this.ExtendedProperties = new PersistableDictionary(); }
public static bool RemoveFolder(AnchorContext context, MailboxSession mailboxSession, string folderName) { StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Root); StoreObjectId folderId = AnchorFolder.GetFolderId(context, mailboxSession, defaultFolderId, folderName); if (folderId == null) { context.Logger.Log(MigrationEventType.Verbose, "couldn't find folder with name {0} treating as success", new object[] { folderName }); return(true); } using (Folder folder = Folder.Bind(mailboxSession, folderId, AnchorFolder.FolderIdPropertyDefinition)) { context.Logger.Log(MigrationEventType.Information, "About to remove all messages & subfolders from {0} with id {1}", new object[] { folderName, folderId }); GroupOperationResult groupOperationResult = folder.DeleteAllObjects(DeleteItemFlags.HardDelete, true); if (groupOperationResult.OperationResult != OperationResult.Succeeded) { context.Logger.Log(MigrationEventType.Warning, "unsuccessfully removed messages & subfolders from {0} with id {1} with result {2}", new object[] { folderName, folderId, groupOperationResult }); return(false); } } bool result; using (Folder folder2 = Folder.Bind(mailboxSession, defaultFolderId)) { context.Logger.Log(MigrationEventType.Information, "About to remove folder {0} with id {1}", new object[] { folderName, folderId }); AggregateOperationResult aggregateOperationResult = folder2.DeleteObjects(DeleteItemFlags.HardDelete, new StoreId[] { folderId }); if (aggregateOperationResult.OperationResult != OperationResult.Succeeded) { context.Logger.Log(MigrationEventType.Warning, "unsuccessfully removed folder {0} with id {1} with result {2}", new object[] { folderName, folderId, aggregateOperationResult }); result = false; } else { result = true; } } return(result); }
internal AnchorAttachment(AnchorContext anchorContext, StreamAttachment attachment, PropertyOpenMode openMode) : this(anchorContext, attachment.GetContentStream(openMode), attachment.LastModifiedTime, null) { this.attachment = attachment; }
// Token: 0x06000034 RID: 52 RVA: 0x00002A10 File Offset: 0x00000C10 protected BatchCreatorScheduler(AnchorContext context, WaitHandle stopEvent, ILoadBalanceServicePort loadBalanceClient) : base(context, stopEvent) { this.MailboxCache = new BatchCreatorScheduler.MigrationMailboxCache(context); this.OccupantCreators = new Dictionary <MigrationOccupantType, BatchCreatorScheduler.OccupantCreator>(); this.LoadBalanceClient = loadBalanceClient; }