KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > javacoding > jspider > core > rule > Ruleset


1 package net.javacoding.jspider.core.rule;
2
3
4 import net.javacoding.jspider.api.model.Decision;
5 import net.javacoding.jspider.api.model.Site;
6 import net.javacoding.jspider.core.SpiderContext;
7 import net.javacoding.jspider.spi.Rule;
8
9 import java.net.URL JavaDoc;
10
11
12 /**
13  * Interface of a RuleSet, a set of Rules that will be applied as a group
14  * on URLs.
15  *
16  * $Id: Ruleset.java,v 1.8 2003/04/03 16:24:53 vanrogu Exp $
17  *
18  * @author Günther Van Roey
19  */

20 public interface Ruleset {
21
22     /** A general ruleset applied to all urls in the system. */
23     public static final int RULESET_GENERAL = 1;
24
25     /** A site-specific ruleset, only applied to urls of that site. */
26     public static final int RULESET_SITE = 2;
27
28     /**
29      * Applies the ruleset to the given URL.
30      * @param context context we're spidering under
31      * @param url the url to decide on
32      * @param currentSite the site currently being spidered
33      * @return Decision object expressing the ruleset's decision about the
34      * given url in the given context.
35      */

36     public Decision applyRules(SpiderContext context, Site currentSite, URL JavaDoc url);
37
38     /**
39      * Adds a rule to the ruleset.
40      * @param rule rule to be added
41      */

42     public void addRule(Rule rule);
43
44     /**
45      * Returns the type of the ruleset - GENERAL or SITE.
46      * @return type of the ruleset
47      */

48     public int getType ( );
49
50 }
51
Popular Tags