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

搜索引擎

开发平台:

Java

  1. package net.javacoding.jspider.mod.rule;
  2. import net.javacoding.jspider.api.model.Decision;
  3. import net.javacoding.jspider.api.model.Site;
  4. import net.javacoding.jspider.core.SpiderContext;
  5. import net.javacoding.jspider.core.rule.impl.BaseRuleImpl;
  6. import net.javacoding.jspider.core.model.DecisionInternal;
  7. import java.net.URL;
  8. /**
  9.  * Rule implementation that accepts all given URLs.
  10.  *
  11.  * $Id: AcceptAllRule.java,v 1.1 2003/04/03 16:10:48 vanrogu Exp $
  12.  *
  13.  * @author G黱ther Van Roey
  14.  */
  15. public class AcceptAllRule extends BaseRuleImpl {
  16.     /**
  17.      * Applies the rule to the given url.
  18.      * @param context the context we're spidering under
  19.      * @param currentSite the site we're currently spidering
  20.      * @param url the url to be evaluated
  21.      * @return Decision object telling whether the url should be accepted.
  22.      * This implementation always returns an accept decision.
  23.      */
  24.     public Decision apply(SpiderContext context, Site currentSite, URL url) {
  25.         return new DecisionInternal(Decision.RULE_ACCEPT, "accept all rule - so resource is accepted");
  26.     }
  27. }