SpiderNest.java
上传用户:qing5858
上传日期:2015-10-27
资源大小:6056k
文件大小:1k
源码类别:

搜索引擎

开发平台:

Java

  1. package net.javacoding.jspider.core;
  2. import net.javacoding.jspider.core.impl.SpiderImpl;
  3. import net.javacoding.jspider.core.util.config.*;
  4. /**
  5.  *
  6.  * $Id: SpiderNest.java,v 1.6 2003/04/02 20:54:59 vanrogu Exp $
  7.  *
  8.  * @author G黱ther Van Roey
  9.  */
  10. public class SpiderNest {
  11.     public static final int DEFAULT_SPIDER_THREADS = 1;
  12.     public static final int DEFAULT_THINKER_THREADS = 1;
  13.     public SpiderNest() {
  14.     }
  15.     public Spider breedSpider(SpiderContext context) {
  16.         PropertySet props = ConfigurationFactory.getConfiguration().getJSpiderConfiguration();
  17.         PropertySet threadProps = new MappedPropertySet ( ConfigConstants.CONFIG_THREADING, props);
  18.         PropertySet spidersProps = new MappedPropertySet ( ConfigConstants.CONFIG_THREADING_SPIDERS, threadProps);
  19.         PropertySet thinkerProps = new MappedPropertySet ( ConfigConstants.CONFIG_THREADING_THINKERS, threadProps);
  20.         int spiderThreads = spidersProps.getInteger(ConfigConstants.CONFIG_THREADING_COUNT, DEFAULT_SPIDER_THREADS);
  21.         int thinkerThreads = thinkerProps.getInteger(ConfigConstants.CONFIG_THREADING_COUNT, DEFAULT_THINKER_THREADS);
  22.         return new SpiderImpl(context, spiderThreads, thinkerThreads);
  23.     }
  24. }