KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > javacoding > jspider > core > Agent


1 package net.javacoding.jspider.core;
2
3
4 import net.javacoding.jspider.core.event.CoreEvent;
5 import net.javacoding.jspider.core.exception.TaskAssignmentException;
6 import net.javacoding.jspider.core.task.WorkerTask;
7
8 import java.net.URL JavaDoc;
9
10
11 /**
12  * Inteface of the JSpider agent, the instance to which all worker tasks will
13  * report and via which tasks can be obtained from the scheduler.
14  *
15  * $Id: Agent.java,v 1.5 2003/03/27 17:44:01 vanrogu Exp $
16  *
17  * @author Günther Van Roey
18  */

19 public interface Agent {
20
21     public void start ( );
22
23     /**
24      * Registers that a certain taks is completed.
25      * @param task the Thinker task that is completed
26      */

27     public void flagDone ( WorkerTask task );
28
29     /**
30      * Returns a thinker task that must be executed
31      * @return the task to be carried out
32      * @throws net.javacoding.jspider.core.exception.TaskAssignmentException if there are no tasks (for now or anymore)
33      */

34     public WorkerTask getThinkerTask() throws TaskAssignmentException;
35
36     /**
37      * Returns a spider task that must be executed
38      * @return the task to be carried out
39      * @throws net.javacoding.jspider.core.exception.TaskAssignmentException if there are no tasks (for now or anymore)
40      */

41     public WorkerTask getSpiderTask() throws TaskAssignmentException;
42
43     /**
44      * Asks to schedule spidering on a certain URL.
45      * @param url the URL to be spidered
46      */

47     public void scheduleForSpidering ( URL JavaDoc url );
48
49     /**
50      * Asks to schedule parsing for a certain fetched URL.
51      * @param url the URL to be spidered
52      */

53     public void scheduleForParsing ( URL JavaDoc url );
54
55     /**
56      * Notifies the agent of a certain event.
57      * @param url the URL that was being processed while the event was raised
58      * @param event the event that was raised
59      */

60     public void registerEvent(URL JavaDoc url, CoreEvent event);
61
62 }
63
Popular Tags