1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.archive.crawler.processor.recrawl;
24
25 import java.io.File;
26
27 import org.archive.crawler.datamodel.CrawlURI;
28 import org.archive.crawler.event.CrawlStatusListener;
29
30 import com.sleepycat.je.DatabaseException;
31
32 /***
33 * Store CrawlURI attributes from latest fetch to persistent storage for
34 * consultation by a later recrawl.
35 *
36 * @author gojomo
37 * @version $Date: 2006-09-25 20:19:54 +0000 (Mon, 25 Sep 2006) $, $Revision: 4654 $
38 */
39 public class PersistStoreProcessor extends PersistOnlineProcessor
40 implements CrawlStatusListener {
41 private static final long serialVersionUID = -8308356194337303758L;
42
43 /***
44 * Usual constructor
45 *
46 * @param name
47 */
48 public PersistStoreProcessor(String name) {
49 super(name, "PersistStoreProcessor. Stores CrawlURI attributes " +
50 "from latest fetch for consultation by a later recrawl.");
51 }
52
53 protected void initialTasks() {
54 super.initialTasks();
55
56 getController().addCrawlStatusListener(this);
57 }
58
59 @Override
60 protected void innerProcess(CrawlURI curi) throws InterruptedException {
61 if(shouldStore(curi)) {
62 store.put(persistKeyFor(curi),curi.getPersistentAList());
63 }
64 }
65
66 public void crawlCheckpoint(File checkpointDir) throws Exception {
67
68 try {
69 historyDb.sync();
70 } catch (DatabaseException e) {
71
72 throw new RuntimeException(e);
73 }
74 }
75
76 public void crawlEnded(String sExitMessage) {
77
78
79 }
80
81 public void crawlEnding(String sExitMessage) {
82
83
84 }
85
86 public void crawlPaused(String statusMessage) {
87
88
89 }
90
91 public void crawlPausing(String statusMessage) {
92
93
94 }
95
96 public void crawlResuming(String statusMessage) {
97
98
99 }
100
101 public void crawlStarted(String message) {
102
103 }
104 }