예제 #1
0
        protected virtual ILoadBalanceService CreateLoadBalancerClient(DirectoryServer server, IDirectoryProvider directory)
        {
            ILoadBalanceService result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                LoadBalancerClient loadBalancerClient = LoadBalancerClient.Create(server.Fqdn, directory, this.logger);
                disposeGuard.Add <LoadBalancerClient>(loadBalancerClient);
                bool flag = true;
                ILoadBalanceService loadBalanceService = loadBalancerClient;
                if (!loadBalancerClient.ServerVersion[1])
                {
                    flag = false;
                    loadBalanceService = this.CreateCompatibilityLoadBalanceClient(server);
                }
                else if (!loadBalancerClient.ServerVersion[2])
                {
                    loadBalanceService = new SoftDeletedRemovalCapabilityDecorator(loadBalanceService, server);
                }
                if (!loadBalancerClient.ServerVersion[3])
                {
                    loadBalanceService = new ConsumerMetricsLoadBalanceCapabilityDecorator(loadBalanceService, server);
                }
                if (!loadBalancerClient.ServerVersion[5])
                {
                    loadBalanceService = new CapacitySummaryCapabilityDecorator(loadBalanceService, server, this.serviceContext);
                }
                if (flag)
                {
                    disposeGuard.Success();
                }
                result = loadBalanceService;
            }
            return(result);
        }
        protected virtual SoftDeleteMailboxRemovalCheckRemoval GetMailboxRemovalReadiness(NonConnectedMailbox mailbox)
        {
            DirectoryIdentity directoryIdentity = DirectoryIdentity.CreateMailboxIdentity(mailbox.Guid, mailbox.OrganizationId, DirectoryObjectType.Mailbox);
            DirectoryIdentity identity          = this.database.Identity;
            DirectoryDatabase databaseForMailbox;

            try
            {
                databaseForMailbox = this.context.Directory.GetDatabaseForMailbox(directoryIdentity);
            }
            catch (RecipientNotFoundException)
            {
                return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval("Recipient for mailbox '{0}' and organizationId '{1}' could not be found so removal can not take place", new object[]
                {
                    directoryIdentity,
                    mailbox.Identity.OrganizationId
                }));
            }
            if (databaseForMailbox == null)
            {
                return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval("Could not identify a database for mailbox '{0}' and organizationId '{1}'", new object[]
                {
                    directoryIdentity,
                    mailbox.Identity.OrganizationId
                }));
            }
            SoftDeletedRemovalData data = new SoftDeletedRemovalData(identity, databaseForMailbox.Identity, directoryIdentity, mailbox.ItemCount, mailbox.DisconnectDate);
            SoftDeleteMailboxRemovalCheckRemoval result;

            using (ILoadBalanceService loadBalanceClientForDatabase = this.context.ClientFactory.GetLoadBalanceClientForDatabase(databaseForMailbox))
            {
                result = loadBalanceClientForDatabase.CheckSoftDeletedMailboxRemoval(data);
            }
            return(result);
        }
예제 #3
0
 protected override void ProcessRequest()
 {
     using (ILoadBalanceService loadBalanceClientForDatabase = this.clientFactory.GetLoadBalanceClientForDatabase(this.directoryObject))
     {
         loadBalanceClientForDatabase.CleanupSoftDeletedMailboxesOnDatabase(this.directoryObject.Identity, this.targetSize);
     }
 }
예제 #4
0
 public Band[] GetActiveBands()
 {
     Band[] activeBands;
     using (ILoadBalanceService loadBalanceClientForCentralServer = this.ClientFactory.GetLoadBalanceClientForCentralServer())
     {
         activeBands = loadBalanceClientForCentralServer.GetActiveBands();
     }
     return(activeBands);
 }
예제 #5
0
        private void RequestRebalancingOnRemoteServer()
        {
            DirectoryDatabase database = (DirectoryDatabase)this.rebalanceRequest.SourceDatabase.DirectoryObject;

            using (ILoadBalanceService loadBalanceClientForDatabase = this.clientFactory.GetLoadBalanceClientForDatabase(database))
            {
                loadBalanceClientForDatabase.BeginMailboxMove(this.rebalanceRequest, PhysicalSize.Instance);
            }
        }
예제 #6
0
        public virtual DatabaseSizeInfo GetSize()
        {
            DatabaseSizeInfo databaseSizeInformation;

            using (ILoadBalanceService loadBalanceClientForDatabase = this.clientFactory.GetLoadBalanceClientForDatabase(this))
            {
                databaseSizeInformation = loadBalanceClientForDatabase.GetDatabaseSizeInformation(base.Identity);
            }
            return(databaseSizeInformation);
        }
예제 #7
0
        public override LoadContainer ExtractTopology()
        {
            LoadContainer localServerData;

            using (ILoadBalanceService loadBalanceClientForServer = this.clientFactory.GetLoadBalanceClientForServer((DirectoryServer)base.DirectoryObject, true))
            {
                localServerData = loadBalanceClientForServer.GetLocalServerData(this.bands);
            }
            return(localServerData);
        }
예제 #8
0
        private HeatMapCapacityData GetServerCapacityDatum(DirectoryIdentity objectIdentity, bool refreshData, DirectoryIdentity localServerIdentity)
        {
            if (objectIdentity.Equals(localServerIdentity))
            {
                return(this.serviceContext.LocalServerHeatMap.ToCapacityData());
            }
            DirectoryServer     server = (DirectoryServer)this.serviceContext.Directory.GetDirectoryObject(objectIdentity);
            HeatMapCapacityData capacitySummary;

            using (ILoadBalanceService loadBalanceClientForServer = this.serviceContext.ClientFactory.GetLoadBalanceClientForServer(server, false))
            {
                capacitySummary = loadBalanceClientForServer.GetCapacitySummary(objectIdentity, refreshData);
            }
            return(capacitySummary);
        }
예제 #9
0
        private HeatMapCapacityData GetDatabaseCapacityDatum(DirectoryIdentity objectIdentity, bool refreshData, DirectoryIdentity localServerIdentity)
        {
            DirectoryDatabase directoryDatabase = (DirectoryDatabase)this.serviceContext.Directory.GetDirectoryObject(objectIdentity);
            DirectoryServer   directoryServer   = directoryDatabase.ActivationOrder.FirstOrDefault <DirectoryServer>();

            if (directoryServer == null || localServerIdentity.Equals(directoryServer.Identity))
            {
                TopologyExtractorFactoryContext topologyExtractorFactoryContext = this.serviceContext.GetTopologyExtractorFactoryContext();
                TopologyExtractorFactory        loadBalancingLocalFactory       = topologyExtractorFactoryContext.GetLoadBalancingLocalFactory(refreshData);
                LoadContainer loadContainer = loadBalancingLocalFactory.GetExtractor(directoryDatabase).ExtractTopology();
                return(loadContainer.ToCapacityData());
            }
            HeatMapCapacityData capacitySummary;

            using (ILoadBalanceService loadBalanceClientForDatabase = this.serviceContext.ClientFactory.GetLoadBalanceClientForDatabase(directoryDatabase))
            {
                capacitySummary = loadBalanceClientForDatabase.GetCapacitySummary(objectIdentity, refreshData);
            }
            return(capacitySummary);
        }
 public BandAsMetricCapabilityDecorator(ILoadBalanceService service, LoadBalanceAnchorContext serviceContext, DirectoryServer targetServer) : base(service, targetServer)
 {
     AnchorUtil.ThrowOnNullArgument(serviceContext, "serviceContext");
     this.serviceContext = serviceContext;
 }
예제 #11
0
 public SoftDeletedRemovalCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer) : base(service, targetServer)
 {
 }
 public CapacitySummaryCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer, LoadBalanceAnchorContext context) : base(service, targetServer)
 {
     this.context = context;
 }
 public CachedLoadBalanceClient(ILoadBalanceService client) : base(client as IWcfClient)
 {
     this.client = client;
 }
예제 #14
0
 public ConsumerMetricsLoadBalanceCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer) : base(service, targetServer)
 {
 }
예제 #15
0
 protected MissingCapabilityLoadBalanceClientDecorator(ILoadBalanceService service, DirectoryServer targetServer)
 {
     this.TargetServer = targetServer;
     this.service      = service;
 }