1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.archive.crawler.event;
20
21 import java.io.File;
22
23 import org.archive.crawler.framework.CrawlController;
24
25
26 /***
27 * Listen for CrawlStatus events.
28 *
29 * Classes that implement this interface can register themselves with
30 * a CrawlController to receive notifications about the events that
31 * affect a crawl job's current status.
32 *
33 * @author Kristinn Sigurdsson
34 *
35 * @see org.archive.crawler.framework.CrawlController#addCrawlStatusListener(CrawlStatusListener)
36 */
37
38 public interface CrawlStatusListener {
39 /***
40 * Called on crawl start.
41 * @param message Start message.
42 */
43 public void crawlStarted(String message);
44
45 /***
46 * Called when a CrawlController is ending a crawl (for any reason)
47 *
48 * @param sExitMessage Type of exit. Should be one of the STATUS constants
49 * in defined in CrawlJob.
50 *
51 * @see org.archive.crawler.admin.CrawlJob
52 */
53 public void crawlEnding(String sExitMessage);
54
55 /***
56 * Called when a CrawlController has ended a crawl and is about to exit.
57 *
58 * @param sExitMessage Type of exit. Should be one of the STATUS constants
59 * in defined in CrawlJob.
60 *
61 * @see org.archive.crawler.admin.CrawlJob
62 */
63 public void crawlEnded(String sExitMessage);
64
65 /***
66 * Called when a CrawlController is going to be paused.
67 *
68 * @param statusMessage Should be
69 * {@link org.archive.crawler.admin.CrawlJob#STATUS_WAITING_FOR_PAUSE
70 * STATUS_WAITING_FOR_PAUSE}. Passed for convenience
71 */
72 public void crawlPausing(String statusMessage);
73
74 /***
75 * Called when a CrawlController is actually paused (all threads are idle).
76 *
77 * @param statusMessage Should be
78 * {@link org.archive.crawler.admin.CrawlJob#STATUS_PAUSED}. Passed for
79 * convenience
80 */
81 public void crawlPaused(String statusMessage);
82
83 /***
84 * Called when a CrawlController is resuming a crawl that had been paused.
85 *
86 * @param statusMessage Should be
87 * {@link org.archive.crawler.admin.CrawlJob#STATUS_RUNNING}. Passed for
88 * convenience
89 */
90 public void crawlResuming(String statusMessage);
91
92 /***
93 * Called by {@link CrawlController} when checkpointing.
94 * @param checkpointDir Checkpoint dir. Write checkpoint state here.
95 * @throws Exception A fatal exception. Any exceptions
96 * that are let out of this checkpoint are assumed fatal
97 * and terminate further checkpoint processing.
98 */
99 public void crawlCheckpoint(File checkpointDir) throws Exception;
100 }