Created
June 21, 2016 04:52
-
-
Save sjdirect/99f6529e7b9e1a46bff6333060d30cc1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using AbotX.Core; | |
using AbotX.Crawler; | |
using AbotX.Poco; | |
namespace AbotX.Parallel | |
{ | |
public class ManualWebCrawlerFactory : IWebCrawlerFactory | |
{ | |
private readonly CrawlConfigurationX _sharedConfig; | |
public ManualWebCrawlerFactory() | |
:this(null) | |
{ | |
} | |
/// <summary> | |
/// Constructor to set a sharedConfig object that will be used by every instance created by this factory. Any changes to this | |
/// object will effect all current and future crawls. | |
/// </summary> | |
/// <param name="sharedConfig"></param> | |
public ManualWebCrawlerFactory(CrawlConfigurationX sharedConfig) | |
{ | |
_sharedConfig = sharedConfig; | |
} | |
public ICrawlerX CreateInstance() | |
{ | |
return CreateInstance(null); | |
} | |
public ICrawlerX CreateInstance(SiteToCrawl siteToCrawl) | |
{ | |
var configToUse = _sharedConfig ?? new CrawlConfigurationX(); | |
return new CrawlerX(configToUse, new ImplementationOverride(configToUse)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment