Ejemplo n.º 1
0
        /// <summary>
        /// Searches the list of registered location providers and asks if
        /// any claim ownership of the specified domain.
        /// </summary>
        /// <param name="domainID">Identifier of domain to claim ownership for.</param>
        /// <returns>An IDomainProvider object for the provider that claims
        /// the specified domain. A null is returned if no provider claims the
        /// domain.</returns>
        static private IDomainProvider GetDomainProvider(string domainID)
        {
            IDomainProvider provider = null;

            log.Debug("domainID {0}", domainID);

            lock (typeof(DomainProvider))
            {
                // See if there is a provider mapping for this domain.
                string idpName = domainProviderTable[domainID] as string;
                if (idpName != null)
                {
                    // There is a domain mapping already set.
                    provider = registeredProviders[idpName] as IDomainProvider;
                }
                else
                {
                    // Search for an owner for this domain.
                    foreach (IDomainProvider idp in registeredProviders.Values)
                    {
                        // See if the provider claims this domain.
                        if (idp.OwnsDomain(domainID))
                        {
                            domainProviderTable.Add(domainID, idp.Name);
                            provider = idp;
                            break;
                        }
                    }
                }
            }

            return(provider);
        }
Ejemplo n.º 2
0
 public SeleniumService(IOptions <SeleniumConfiguration> options, ILogger <SeleniumService> logger, IDomainProvider domainServiceProvider, IAzureStorage azureStorage)
 {
     this.options = options;
     this.logger  = logger;
     this.domainServiceProvider = domainServiceProvider;
     this.azureStorage          = azureStorage;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Registers the specified domain provider with the domain provider service.
 /// </summary>
 /// <param name="provider">An ILocationProvider interface object.</param>
 static public void RegisterProvider(IDomainProvider provider)
 {
     lock (typeof(DomainProvider))
     {
         log.Debug("Registering provider {0}.", provider.Name);
         registeredProviders.Add(provider.Name, provider);
     }
 }
Ejemplo n.º 4
0
 public static IDomainProvider GetInstance()
 {
     if (obj == null)
     {
         obj = new DomainProvider();
     }
     return(obj);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Informs the domain provider that the specified member object is about to be
        /// committed to the domain's member list. This allows an opportunity for the
        /// domain provider to add any domain specific attributes to the member object.
        /// </summary>
        /// <param name="domainID">Identifier of a domain.</param>
        /// <param name="member">Member object that is about to be committed to the domain's member list.</param>
        static public void PreCommit(string domainID, Member member)
        {
            IDomainProvider idp = GetDomainProvider(domainID);

            if (idp != null)
            {
                idp.PreCommit(domainID, member);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Sets a new host address for the domain.
        /// </summary>
        /// <param name="domainID">Identifier of the domain for network address
        /// to be changed.</param>
        /// <param name="hostLocation">A Uri object containing the new network
        /// address for the domain.</param>
        static public void SetHostLocation(string domainID, Uri hostLocation)
        {
            IDomainProvider idp = GetDomainProvider(domainID);

            if (idp != null)
            {
                idp.SetHostLocation(domainID, hostLocation);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// End the search for domain members.
        /// </summary>
        /// <param name="domainID">The identifier of the domain.</param>
        /// <param name="searchContext">Domain provider specific search context returned by
        /// FindFirstDomainMembers or FindNextDomainMembers methods.</param>
        static public void FindCloseDomainMembers(string domainID, string searchContext)
        {
            IDomainProvider idp = GetDomainProvider(domainID);

            if (idp != null)
            {
                log.Debug("Closing search on domain {0}.", domainID);
                idp.FindCloseDomainMembers(searchContext);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Indicates to the provider that the specified collection has
        /// been deleted and a mapping is no longer required.
        /// </summary>
        /// <param name="collection">Collection that is being deleted.</param>
        static public void DeleteLocation(Collection collection)
        {
            IDomainProvider idp = GetDomainProvider(collection.Domain);

            if (idp != null)
            {
                log.Debug("Deleting location for collection {0}.", collection.Name);
                idp.DeleteLocation(collection.Domain, collection.ID);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Performs authentication to the specified domain.
        /// </summary>
        /// <param name="domain">Domain to authenticate to.</param>
        /// <param name="httpContext">HTTP-specific request information. This is passed as a parameter so that a domain
        /// provider may modify the HTTP request by adding special headers as necessary.
        ///
        /// NOTE: The domain provider must NOT end the HTTP request.
        /// </param>
        /// <returns>The status from the authentication.</returns>
        static public Authentication.Status Authenticate(Domain domain, HttpContext httpContext)
        {
            IDomainProvider idp = GetDomainProvider(domain.ID);

            if (idp == null)
            {
                throw new DoesNotExistException("The specified domain does not exist.");
            }

            return(idp.Authenticate(domain, httpContext));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Returns the network location of the specified host.
        /// </summary>
        /// <param name="domainID">Identifier of the domain where a
        /// collection is to be created.</param>
        /// <param name="hostID">The host to resolve.</param>
        /// <returns>A Uri object that contains the network location.
        /// </returns>
        static public Uri ResolveHostAddress(string domainID, string hostID)
        {
            Uri networkLocation = null;

            IDomainProvider idp = GetDomainProvider(domainID);

            if (idp != null)
            {
                networkLocation = idp.ResolveHostAddress(domainID, hostID);
            }

            return(networkLocation);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Returns the network location of where to the specified user's POBox is located.
        /// </summary>
        /// <param name="domainID">Identifier of the domain where a
        /// collection is to be created.</param>
        /// <param name="userID">The member that will owns the POBox.</param>
        /// <returns>A Uri object that contains the network location.
        /// </returns>
        static public Uri ResolvePOBoxLocation(string domainID, string userID)
        {
            Uri networkLocation = null;

            IDomainProvider idp = GetDomainProvider(domainID);

            if (idp != null)
            {
                networkLocation = idp.ResolvePOBoxLocation(domainID, userID);
            }

            return(networkLocation);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Returns the network location for the the specified
        /// domain.
        /// </summary>
        /// <param name="domainID">Identifier for the domain.</param>
        /// <returns>A Uri object that contains the network location.
        /// </returns>
        static public Uri ResolveLocation(string domainID)
        {
            Uri networkLocation = null;

            IDomainProvider idp = GetDomainProvider(domainID);

            if (idp != null)
            {
                // See if the provider already knows about this collection.
                networkLocation = idp.ResolveLocation(domainID);
            }

            return(networkLocation);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Continues the search for domain members from the specified record location.
        /// </summary>
        /// <param name="domainID">The identifier of the domain to search for members in.</param>
        /// <param name="searchContext">Domain provider specific search context returned by FindFirstDomainMembers method.</param>
        /// <param name="offset">Record offset to return members from.</param>
        /// <param name="count">Maximum number of member objects to return.</param>
        /// <param name="memberList">Receives an array object that contains the domain Member objects.</param>
        /// <returns>True if there are more domain members. Otherwise false is returned.</returns>
        static public bool FindSeekDomainMembers(string domainID, ref string searchContext, int offset, int count, out Member[] memberList)
        {
            bool moreEntries = false;

            // Initialize the outputs.
            memberList = null;

            IDomainProvider idp = GetDomainProvider(domainID);

            if (idp != null)
            {
                moreEntries = idp.FindSeekDomainMembers(ref searchContext, offset, count, out memberList);
            }

            return(moreEntries);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Returns the network location for the the specified
        /// collection.
        /// </summary>
        /// <param name="collection">Collection to find the network
        /// location for.</param>
        /// <returns>A Uri object that contains the network location.
        /// If the network location could not be determined, a null
        /// is returned.</returns>
        static public Uri ResolveLocation(Collection collection)
        {
            Uri             networkLocation = null;
            IDomainProvider idp             = GetDomainProvider(collection.Domain);

            if (idp != null)
            {
                // See if the provider already knows about this collection.
                networkLocation = idp.ResolveLocation(collection.Domain, collection.ID);
                if ((networkLocation == null) && !collection.IsHosted)
                {
                    // This is a new collection, resolve the location that it should be created.
                    networkLocation = idp.ResolveLocation(collection.Domain, collection.Owner.UserID, collection.ID);
                }
            }

            return(networkLocation);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Starts a search for a specific set of domain members.
        /// </summary>
        /// <param name="domainID">The identifier of the domain to search for members in.</param>
        /// <param name="attributeName">Attribute name to search.</param>
        /// <param name="searchString">String that contains a pattern to search for.</param>
        /// <param name="operation">Type of search operation to perform.</param>
        /// <param name="count">Maximum number of member objects to return.</param>
        /// <param name="searchContext">Receives a provider specific search context object.</param>
        /// <param name="memberList">Receives an array object that contains the domain Member objects.</param>
        /// <param name="total">Receives the total number of objects found in the search.</param>
        /// <returns>True if there are more domain members. Otherwise false is returned.</returns>
        static public bool FindFirstDomainMembers(string domainID, string attributeName, string searchString, SearchOp operation, int count, out string searchContext, out Member[] memberList, out int total)
        {
            bool moreEntries = false;

            // Initialize the outputs.
            searchContext = null;
            memberList    = null;
            total         = 0;

            IDomainProvider idp = GetDomainProvider(domainID);

            if (idp != null)
            {
                moreEntries = idp.FindFirstDomainMembers(domainID, attributeName, searchString, operation, count, out searchContext, out memberList, out total);
            }

            return(moreEntries);
        }
Ejemplo n.º 16
0
        public DomainProducer(IDomainProvider domainProvider, IRateLimiter domainRetrievalRateLimiter, CrawlDaddyConfig config)
        {
            if (domainProvider == null)
            {
                throw new ArgumentNullException("domainProvider");
            }

            if (domainRetrievalRateLimiter == null)
            {
                throw new ArgumentNullException("domainRetrievalRateLimiter");
            }

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _domainProvider             = domainProvider;
            _domainRetrievalRateLimiter = domainRetrievalRateLimiter;
            _config = config;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Unregisters this domain provider from the domain provider service.
        /// </summary>
        /// <param name="provider">Domain provider to unregister.</param>
        static public void Unregister(IDomainProvider provider)
        {
            lock (typeof(DomainProvider))
            {
                log.Debug("Unregistering domain provider {0}.", provider.Name);

                // Remove the domain provider from the list.
                registeredProviders.Remove(provider.Name);

                // Remove all domain mappings for this provider.
                string[] domainList = new string[domainProviderTable.Count];
                domainProviderTable.Keys.CopyTo(domainList, 0);
                foreach (string domainID in domainList)
                {
                    // Is this mapping for the specified provider?
                    if (domainProviderTable[domainID] as string == provider.Name)
                    {
                        domainProviderTable.Remove(domainID);
                    }
                }
            }
        }
Ejemplo n.º 18
0
 public ScheduleBacktrackingAlgorithm(
     IDomainProvider domainProvider, IScheduleManager scheduleManager)
 {
     this.domainProvider  = domainProvider;
     this.scheduleManager = scheduleManager;
 }
Ejemplo n.º 19
0
 public WebPageProvider(IDomainProvider domainProvider)
 {
     this.domainProvider = domainProvider;
 }
Ejemplo n.º 20
0
 public CommerceStorefront(IDomainProvider domainProvider, ICurrencyProvider currencyProvider)
     : base(domainProvider, currencyProvider)
 {
 }