示例#1
0
 /// <summary>
 /// Creates a new crawler API instance.
 /// </summary>
 /// <param name="config">The crawler configuration.</param>
 /// <param name="database">The database configuration.</param>
 /// <param name="log">The crawler log.</param>
 /// <param name="status">The crawler status.</param>
 public CrawlerApi(CrawlerConfig config, DbConfig database, Logger log, ApplicationStatus status)
 {
     this.config = config;
     this.database = database;
     this.log = log;
     this.status = status;
 }
示例#2
0
        /// <summary>
        /// Creates a new crawer global object, based on a configuration from the specified root registry key.
        /// </summary>
        /// <param name="rootKey">The root registry key.</param>
        /// <param name="rootPath">The root registry path.</param>
        public Crawler(RegistryKey rootKey, string rootPath)
        {
            // Create the configuration.
            this.config = new CrawlerConfig(rootKey, rootPath);

            // Create the crawler events.
            this.events = new CrawlerEvents();

            // Create the logger.
            this.log = new Logger(this.config.LogFileName);

            // Create the database servers.
            this.dbConfig = new DbConfig(this, rootKey, rootPath + @"\Database");

            // Create the PlanetLab configuration.
            this.plConfig = new PlConfig(rootKey, rootPath + @"\PlanetLab");

            // Create the YouTube configuration.
            this.ytConfig = new YtConfig(this.config);

            // Create the status.
            this.status = new ApplicationStatus();

            // Create the comments.
            this.comments = new CrawlerComments(this.config);

            // Create the crawler spiders.
            this.spiders = new Spiders(this);

            // Create the crawler API.
            this.api = new CrawlerApi(this.config, this.dbConfig, this.log, this.status);

            // Create the toolbox.
            this.toolbox = new Toolbox(this, rootKey, rootPath + @"\Toolbox");
        }