01: package net.javacoding.jspider.core;
02:
03: import net.javacoding.jspider.core.event.CoreEvent;
04: import net.javacoding.jspider.core.exception.TaskAssignmentException;
05: import net.javacoding.jspider.core.task.WorkerTask;
06:
07: import java.net.URL;
08:
09: /**
10: * Inteface of the JSpider agent, the instance to which all worker tasks will
11: * report and via which tasks can be obtained from the scheduler.
12: *
13: * $Id: Agent.java,v 1.5 2003/03/27 17:44:01 vanrogu Exp $
14: *
15: * @author Günther Van Roey
16: */
17: public interface Agent {
18:
19: public void start();
20:
21: /**
22: * Registers that a certain taks is completed.
23: * @param task the Thinker task that is completed
24: */
25: public void flagDone(WorkerTask task);
26:
27: /**
28: * Returns a thinker task that must be executed
29: * @return the task to be carried out
30: * @throws net.javacoding.jspider.core.exception.TaskAssignmentException if there are no tasks (for now or anymore)
31: */
32: public WorkerTask getThinkerTask() throws TaskAssignmentException;
33:
34: /**
35: * Returns a spider task that must be executed
36: * @return the task to be carried out
37: * @throws net.javacoding.jspider.core.exception.TaskAssignmentException if there are no tasks (for now or anymore)
38: */
39: public WorkerTask getSpiderTask() throws TaskAssignmentException;
40:
41: /**
42: * Asks to schedule spidering on a certain URL.
43: * @param url the URL to be spidered
44: */
45: public void scheduleForSpidering(URL url);
46:
47: /**
48: * Asks to schedule parsing for a certain fetched URL.
49: * @param url the URL to be spidered
50: */
51: public void scheduleForParsing(URL url);
52:
53: /**
54: * Notifies the agent of a certain event.
55: * @param url the URL that was being processed while the event was raised
56: * @param event the event that was raised
57: */
58: public void registerEvent(URL url, CoreEvent event);
59:
60: }
|