private void ExtractConstraintSetHierarchy(LoadContainer databaseContainer)
        {
            DirectoryDatabase directoryDatabase           = (DirectoryDatabase)base.DirectoryObject;
            Dictionary <string, LoadContainer> dictionary = new Dictionary <string, LoadContainer>();

            foreach (DirectoryMailbox directoryMailbox in directoryDatabase.GetMailboxes())
            {
                TopologyExtractor extractor = base.ExtractorFactory.GetExtractor(directoryMailbox);
                IMailboxProvisioningConstraints mailboxProvisioningConstraints = directoryMailbox.MailboxProvisioningConstraints;
                string text = null;
                if (mailboxProvisioningConstraints != null)
                {
                    text = mailboxProvisioningConstraints.HardConstraint.Value;
                }
                text = (text ?? string.Empty);
                if (!dictionary.ContainsKey(text))
                {
                    DirectoryIdentity identity        = new DirectoryIdentity(DirectoryObjectType.ConstraintSet, Guid.NewGuid(), text, directoryMailbox.Identity.OrganizationId);
                    DirectoryObject   directoryObject = new DirectoryObject(base.DirectoryObject.Directory, identity);
                    LoadContainer     value           = new LoadContainer(directoryObject, ContainerType.ConstraintSet);
                    dictionary.Add(text, value);
                    databaseContainer.AddChild(dictionary[text]);
                }
                LoadEntity extractedEntity = extractor.ExtractEntity();
                this.AddEntityToContainer(dictionary[text], extractedEntity);
            }
        }
        public override TopologyExtractor GetExtractor(DirectoryObject directoryObject)
        {
            if (directoryObject is DirectoryMailbox)
            {
                return(this.realFactory.GetExtractor(directoryObject));
            }
            TopologyExtractor value;

            if (!this.extractors.TryGetValue(directoryObject.Guid, out value))
            {
                TopologyExtractor extractor = this.realFactory.GetExtractor(directoryObject);
                if (extractor != null)
                {
                    value = new CachingTopologyExtractor(this.realFactory, directoryObject, base.Logger, extractor, SimpleTimer.CreateTimer(LoadBalanceADSettings.Instance.Value.LocalCacheRefreshPeriod));
                }
                this.extractors.TryAdd(directoryObject.Guid, value);
            }
            return(this.extractors[directoryObject.Guid]);
        }
Esempio n. 3
0
 public ChildContainerExtractor(DirectoryObject child, LoadContainer loadContainer, ILogger logger, TopologyExtractor extractor)
 {
     this.child          = child;
     this.loadContainer  = loadContainer;
     this.logger         = logger;
     this.childExtractor = extractor;
 }
 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);
 }