コード例 #1
0
 // 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>();
 }
コード例 #2
0
 public DirectoryObject(IDirectoryProvider directory, DirectoryIdentity identity)
 {
     AnchorUtil.ThrowOnNullArgument(directory, "directory");
     AnchorUtil.ThrowOnNullArgument(identity, "identity");
     this.directory = directory;
     this.Identity  = identity;
 }
コード例 #3
0
 public RegularLoadBalancingExtractorFactory(Band[] bands, IList <Guid> nonMovableOrganizations, ILogger logger) : base(logger)
 {
     AnchorUtil.ThrowOnNullArgument(bands, "bands");
     AnchorUtil.ThrowOnNullArgument(nonMovableOrganizations, "nonMovableOrganizations");
     this.Bands = bands;
     this.NonMovableOrganizations = nonMovableOrganizations;
 }
コード例 #4
0
 // Token: 0x0600005F RID: 95 RVA: 0x00003901 File Offset: 0x00001B01
 public MigrationMailbox(ADUser user, DateTime lastRefreshed)
 {
     AnchorUtil.ThrowOnNullArgument(user, "user");
     this.User          = user;
     this.LastRefreshed = lastRefreshed;
     this.Exception     = null;
 }
コード例 #5
0
        public virtual bool TryLoad(IAnchorDataProvider dataProvider, StoreObjectId id, Action <IAnchorStoreObject> streamAction)
        {
            AnchorUtil.ThrowOnNullArgument(dataProvider, "dataProvider");
            AnchorUtil.ThrowOnNullArgument(id, "id");
            bool success = true;

            AnchorUtil.RunTimedOperation(dataProvider.AnchorContext, delegate()
            {
                using (IAnchorStoreObject anchorStoreObject = this.FindStoreObject(dataProvider, id, this.PropertyDefinitions))
                {
                    if (anchorStoreObject.GetValueOrDefault <string>(MigrationBatchMessageSchema.MigrationPersistableDictionary, null) == null)
                    {
                        success = false;
                    }
                    else
                    {
                        anchorStoreObject.Load(this.PropertyDefinitions);
                        if (!this.ReadFromMessageItem(anchorStoreObject))
                        {
                            success = false;
                        }
                        else
                        {
                            if (streamAction != null)
                            {
                                streamAction(anchorStoreObject);
                            }
                            this.LoadLinkedStoredObjects(anchorStoreObject, dataProvider);
                        }
                    }
                }
            }, this);
            return(success);
        }
コード例 #6
0
 public LoadEntity(DirectoryObject directoryObject)
 {
     AnchorUtil.ThrowOnNullArgument(directoryObject, "directoryObject");
     this.DirectoryObject         = directoryObject;
     this.DirectoryObjectIdentity = directoryObject.Identity;
     this.ConsumedLoad            = new LoadMetricStorage();
 }
コード例 #7
0
        // Token: 0x0600025C RID: 604 RVA: 0x00008ED4 File Offset: 0x000070D4
        private void Initialize(MailboxSession mailboxSession, StoreObjectId id, PropertyDefinition[] properties)
        {
            bool flag = false;

            try
            {
                AnchorUtil.ThrowOnNullArgument(mailboxSession, "dataProvider");
                AnchorUtil.ThrowOnNullArgument(id, "id");
                AnchorUtil.ThrowOnNullArgument(properties, "properties");
                this.Message = MessageItem.Bind(mailboxSession, id, properties);
                flag         = true;
            }
            catch (ArgumentException ex)
            {
                base.AnchorContext.Logger.Log(MigrationEventType.Error, ex, "Encountered an argument exception when trying to find message with id={0}", new object[]
                {
                    id.ToString()
                });
                throw new ObjectNotFoundException(ServerStrings.ExItemNotFound, ex);
            }
            finally
            {
                if (!flag)
                {
                    this.Dispose();
                }
            }
        }
コード例 #8
0
        private static ADObjectId GetADObjectIdImpl(IAnchorStoreObject item, StorePropertyDefinition propertyDefinition, bool useTryGet)
        {
            AnchorUtil.ThrowOnNullArgument(item, "item");
            AnchorUtil.ThrowOnNullArgument(propertyDefinition, "propertyDefinition");
            Exception innerException = null;

            try
            {
                byte[] array;
                if (useTryGet)
                {
                    array = item.GetValueOrDefault <byte[]>(propertyDefinition, null);
                    if (array == null)
                    {
                        return(null);
                    }
                }
                else
                {
                    array = (byte[])item[propertyDefinition];
                }
                return(new ADObjectId(array));
            }
            catch (CorruptDataException ex)
            {
                innerException = ex;
            }
            catch (ArgumentNullException ex2)
            {
                innerException = ex2;
            }
            throw new InvalidDataException(AnchorHelper.GetPropertyErrorMessage(propertyDefinition, null), innerException);
        }
コード例 #9
0
 public InjectMoveRequest(string batchName, DirectoryMailbox mailbox, ILogger logger, bool protect, RequestPriority requestPriority, ADObjectId mailboxObjectId, DirectoryIdentity targetDatabaseIdentity, ILoadBalanceSettings settings, CmdletExecutionPool cmdletPool) : base("New-MoveRequest", cmdletPool, logger)
 {
     this.settings       = settings;
     this.TargetDatabase = targetDatabaseIdentity;
     this.BatchName      = batchName;
     this.Mailbox        = mailbox;
     this.Protect        = protect;
     AnchorUtil.ThrowOnNullArgument(mailbox, "mailbox");
     base.Command.AddParameter("Identity", mailboxObjectId);
     base.Command.AddParameter("WorkloadType", RequestWorkloadType.LoadBalancing);
     if (!string.IsNullOrWhiteSpace(batchName))
     {
         base.Command.AddParameter("BatchName", batchName);
     }
     if (targetDatabaseIdentity != null)
     {
         DatabaseIdParameter value = new DatabaseIdParameter(targetDatabaseIdentity.ADObjectId);
         if (mailbox.IsArchiveOnly)
         {
             base.Command.AddParameter("ArchiveTargetDatabase", value);
             base.Command.AddParameter("ArchiveOnly");
         }
         else
         {
             base.Command.AddParameter("TargetDatabase", value);
             base.Command.AddParameter("PrimaryOnly");
         }
     }
     base.Command.AddParameter("CompletedRequestAgeLimit", 0);
     base.Command.AddParameter("Priority", requestPriority);
     if (protect)
     {
         base.Command.AddParameter("Protect");
     }
 }
コード例 #10
0
 internal static void SetDictionaryProperty(IPropertyBag item, PropertyDefinition propertyDefinition, PersistableDictionary persistDictionary)
 {
     AnchorUtil.ThrowOnNullArgument(item, "item");
     AnchorUtil.ThrowOnNullArgument(propertyDefinition, "propertyDefinition");
     AnchorUtil.ThrowOnNullArgument(persistDictionary, "persistDictionary");
     item[propertyDefinition] = persistDictionary.Serialize();
 }
コード例 #11
0
 public virtual bool ReadFromMessageItem(IAnchorStoreObject message)
 {
     AnchorUtil.ThrowOnNullArgument(message, "message");
     this.ExtendedProperties = AnchorHelper.GetDictionaryProperty(message, MigrationBatchMessageSchema.MigrationPersistableDictionary, true);
     this.ReadStoreObjectIdProperties(message);
     return(true);
 }
コード例 #12
0
 internal AnchorFolder(AnchorContext context, Folder folder)
 {
     AnchorUtil.ThrowOnNullArgument(context, "context");
     AnchorUtil.ThrowOnNullArgument(folder, "folder");
     base.AnchorContext = context;
     this.Folder        = folder;
 }
コード例 #13
0
 // 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)));
 }
コード例 #14
0
        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);
        }
コード例 #15
0
 protected TopologyExtractor(DirectoryObject directoryObject, TopologyExtractorFactory extractorFactory)
 {
     AnchorUtil.ThrowOnNullArgument(directoryObject, "directoryObject");
     AnchorUtil.ThrowOnNullArgument(extractorFactory, "extractorFactory");
     this.DirectoryObject  = directoryObject;
     this.ExtractorFactory = extractorFactory;
 }
コード例 #16
0
 public MailboxProcessorDispatcher(LoadBalanceAnchorContext context, Func <IRequestQueueManager, IList <MailboxProcessor> > processors)
 {
     AnchorUtil.ThrowOnNullArgument(context, "context");
     AnchorUtil.ThrowOnNullArgument(processors, "processors");
     this.context    = context;
     this.processors = processors;
 }
コード例 #17
0
        public DirectoryObject GetDirectoryObject(DirectoryIdentity directoryObjectIdentity)
        {
            AnchorUtil.ThrowOnNullArgument(directoryObjectIdentity, "directoryObjectIdentity");
            switch (directoryObjectIdentity.ObjectType)
            {
            case DirectoryObjectType.Forest:
                return(this.GetLocalForest());

            case DirectoryObjectType.DatabaseAvailabilityGroup:
                return(this.GetDatabaseAvailabilityGroups().FirstOrDefault((DirectoryDatabaseAvailabilityGroup d) => d.Guid == directoryObjectIdentity.Guid));

            case DirectoryObjectType.Server:
                return(this.GetServer(directoryObjectIdentity.Guid));

            case DirectoryObjectType.Database:
                return(this.GetDatabase(directoryObjectIdentity.Guid));

            case DirectoryObjectType.Mailbox:
            case DirectoryObjectType.CloudArchive:
            case DirectoryObjectType.ConsumerMailbox:
                return(this.GetMailboxObject(directoryObjectIdentity));

            case DirectoryObjectType.ConstraintSet:
                return(this.GetConstraintSetObject(directoryObjectIdentity));
            }
            throw new NotSupportedException(string.Format("ObjectType '{0}' is not supported.", directoryObjectIdentity.ObjectType));
        }
コード例 #18
0
 internal ClientFactory(ILogger logger, LoadBalanceAnchorContext serviceContext)
 {
     AnchorUtil.ThrowOnNullArgument(serviceContext, "serviceContext");
     AnchorUtil.ThrowOnNullArgument(logger, "logger");
     this.logger         = logger;
     this.serviceContext = serviceContext;
 }
コード例 #19
0
        public void ProcessRebalanceRequest(BandMailboxRebalanceData rebalanceRequest)
        {
            AnchorUtil.ThrowOnNullArgument(rebalanceRequest, "rebalanceRequest");
            BandRebalanceRequest request         = new BandRebalanceRequest(rebalanceRequest, this.clientFactory, this.logger);
            LoadContainer        sourceDatabase  = rebalanceRequest.SourceDatabase;
            IRequestQueue        processingQueue = this.GetProcessingQueue(sourceDatabase);

            processingQueue.EnqueueRequest(request);
        }
コード例 #20
0
 protected BandRandomEntitySelector(Band band, LoadContainer sourceContainer, string constraintSetIdentity)
 {
     AnchorUtil.ThrowOnNullArgument(band, "band");
     AnchorUtil.ThrowOnNullArgument(sourceContainer, "sourceContainer");
     this.band           = band;
     this.SourceEntities = (from x in sourceContainer.Children
                            where x.DirectoryObjectIdentity.Name == constraintSetIdentity
                            select x).Cast <LoadContainer>().SelectMany((LoadContainer x) => x.Children).Where(new Func <LoadEntity, bool>(this.IsAcceptedEntity));
 }
コード例 #21
0
 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;
 }
コード例 #22
0
 public ProcessMailboxRequest(DirectoryMailbox mailbox, MailboxProcessor processor, ILogger logger, CmdletExecutionPool cmdletPool)
 {
     AnchorUtil.ThrowOnNullArgument(mailbox, "mailbox");
     AnchorUtil.ThrowOnNullArgument(processor, "processor");
     this.Mailbox    = mailbox;
     this.Processor  = processor;
     this.logger     = logger;
     this.cmdletPool = cmdletPool;
 }
コード例 #23
0
 public FactorBasedBatchSizeReducer(double factor, ILogger logger)
 {
     AnchorUtil.ThrowOnNullArgument(logger, "logger");
     if (factor > 1.0 || factor < 0.0)
     {
         throw new ArgumentOutOfRangeException("factor", factor, "Factor must be between 0 and 1.");
     }
     this.logger = logger;
     this.factor = factor;
 }
コード例 #24
0
 public CachingTopologyExtractor(TopologyExtractorFactory topologyExtractorFactory, DirectoryObject directoryObject, ILogger logger, TopologyExtractor topologyExtractor, ITimer timer) : base(directoryObject, topologyExtractorFactory)
 {
     AnchorUtil.ThrowOnNullArgument(logger, "logger");
     AnchorUtil.ThrowOnNullArgument(timer, "timer");
     this.directoryObject   = directoryObject;
     this.logger            = logger;
     this.timer             = timer;
     this.topologyExtractor = (topologyExtractor ?? base.ExtractorFactory.GetExtractor(this.directoryObject));
     this.timer.SetAction(new Action(this.RefreshCachedValue), true);
 }
コード例 #25
0
 public ForestLoadBalanceRequest(ILoadBalance loadBalancer, bool startMoves, ILogger logger, IRebalancingRequestProcessor moveStarter, LoadContainer forestTopology, PartitionExtractor partitionExtractor)
 {
     AnchorUtil.ThrowOnNullArgument(loadBalancer, "loadBalancer");
     AnchorUtil.ThrowOnNullArgument(logger, "logger");
     this.loadBalancer       = loadBalancer;
     this.startMoves         = startMoves;
     this.logger             = logger;
     this.moveStarter        = moveStarter;
     this.forestTopology     = forestTopology;
     this.partitionExtractor = partitionExtractor;
 }
コード例 #26
0
 public DatabaseDrainRequest(DirectoryDatabase directoryDatabase, MoveInjector moveInjector, LoadBalanceAnchorContext serviceContext, BatchName batchName)
 {
     AnchorUtil.ThrowOnNullArgument(directoryDatabase, "directoryDatabase");
     AnchorUtil.ThrowOnNullArgument(moveInjector, "moveInjector");
     AnchorUtil.ThrowOnNullArgument(serviceContext, "serviceContext");
     AnchorUtil.ThrowOnNullArgument(batchName, "batchName");
     this.directoryDatabase = directoryDatabase;
     this.moveInjector      = moveInjector;
     this.serviceContext    = serviceContext;
     this.logger            = serviceContext.Logger;
     this.batchName         = batchName;
 }
コード例 #27
0
 // 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;
 }
コード例 #28
0
 public PhysicalDatabase(DirectoryDatabase database, IStorePort storePort, ILogger logger)
 {
     AnchorUtil.ThrowOnNullArgument(database, "database");
     AnchorUtil.ThrowOnNullArgument(storePort, "storePort");
     this.databaseLoadLock      = new object();
     this.database              = database;
     this.logger                = logger;
     this.DatabaseGuid          = database.Guid;
     this.physicalMailboxes     = new Dictionary <Guid, IPhysicalMailbox>();
     this.nonConnectedMailboxes = new List <IPhysicalMailbox>();
     this.storePort             = storePort;
 }
コード例 #29
0
 internal PersistedBandDefinition(Band band, bool isEnabled = false)
 {
     AnchorUtil.ThrowOnNullArgument(band, "band");
     this.BandProfile = band.Profile;
     this.MaxSize     = band.MaxSize.ToBytes();
     this.MinSize     = band.MinSize.ToBytes();
     this.IsEnabled   = isEnabled;
     this.IncludeOnlyPhysicalMailboxes = band.IncludeOnlyPhysicalMailboxes;
     this.MinLastLogonAgeTicks         = PersistedBandDefinition.GetPersistableLogonAge(band.MinLastLogonAge);
     this.MaxLastLogonAgeTicks         = PersistedBandDefinition.GetPersistableLogonAge(band.MaxLastLogonAge);
     this.WeightFactor = band.MailboxSizeWeightFactor;
 }
コード例 #30
0
        private ServiceHost StartServiceEndpoint(object serviceInstance, ServiceEndpointAddress serviceAddress)
        {
            AnchorUtil.ThrowOnNullArgument(serviceInstance, "serviceInstance");
            ServiceHost result;

            try
            {
                ServiceHost serviceHost = new ServiceHost(serviceInstance, serviceAddress.GetBaseUris());
                serviceHost.AddDefaultEndpoints();
                this.logger.Log(MigrationEventType.Verbose, "Opening service host for {0}, with service type {1} and namespace {2}.", new object[]
                {
                    serviceHost.Description.Name,
                    serviceHost.Description.ServiceType.FullName,
                    serviceHost.Description.Namespace
                });
                ServiceDebugBehavior serviceDebugBehavior = serviceHost.Description.Behaviors.Find <ServiceDebugBehavior>();
                if (serviceDebugBehavior == null)
                {
                    serviceDebugBehavior = new ServiceDebugBehavior();
                    serviceHost.Description.Behaviors.Add(serviceDebugBehavior);
                }
                serviceDebugBehavior.IncludeExceptionDetailInFaults = true;
                foreach (System.ServiceModel.Description.ServiceEndpoint serviceEndpoint in serviceHost.Description.Endpoints)
                {
                    NetTcpBinding netTcpBinding = serviceEndpoint.Binding as NetTcpBinding;
                    if (netTcpBinding != null)
                    {
                        netTcpBinding.MaxReceivedMessageSize = 10485760L;
                        netTcpBinding.ReceiveTimeout         = TimeSpan.FromMinutes(10.0);
                        netTcpBinding.SendTimeout            = TimeSpan.FromMinutes(10.0);
                    }
                    this.logger.LogVerbose("Using binging: {0} ({1})", new object[]
                    {
                        serviceEndpoint.Binding.Name,
                        serviceEndpoint.Binding.MessageVersion
                    });
                    LoadBalanceUtils.UpdateAndLogServiceEndpoint(this.logger, serviceEndpoint);
                }
                serviceHost.Open();
                result = serviceHost;
            }
            catch (Exception exception)
            {
                this.logger.LogError(exception, "Failed to register endpoint for service {0}", new object[]
                {
                    serviceInstance.GetType().Name
                });
                throw;
            }
            return(result);
        }