KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > javacoding > jspider > mod > rule > BaseURLOnlyRule


1 package net.javacoding.jspider.mod.rule;
2
3 import net.javacoding.jspider.api.model.Decision;
4 import net.javacoding.jspider.api.model.Site;
5 import net.javacoding.jspider.core.SpiderContext;
6 import net.javacoding.jspider.core.rule.impl.BaseRuleImpl;
7 import net.javacoding.jspider.core.model.DecisionInternal;
8
9 import java.net.URL JavaDoc;
10
11 /**
12  * $Id: BaseURLOnlyRule.java,v 1.1 2003/04/03 16:10:49 vanrogu Exp $
13  *
14  * @author Günther Van Roey.
15  */

16 public class BaseURLOnlyRule extends BaseRuleImpl {
17
18     public Decision apply(SpiderContext context, Site currentSite, URL JavaDoc url) {
19         boolean equals = context.getBaseURL().equals(url);
20         if (equals) {
21             return new DecisionInternal(Decision.RULE_ACCEPT, "url accepted");
22         } else {
23             return new DecisionInternal(Decision.RULE_IGNORE, "url ignored because it is not the base url");
24         }
25     }
26
27 }
28
29
Popular Tags