01: /* PersistLoadProcessor.java
02: *
03: * Created on Feb 13, 2005
04: *
05: * Copyright (C) 2007 Internet Archive.
06: *
07: * This file is part of the Heritrix web crawler (crawler.archive.org).
08: *
09: * Heritrix is free software; you can redistribute it and/or modify
10: * it under the terms of the GNU Lesser Public License as published by
11: * the Free Software Foundation; either version 2.1 of the License, or
12: * any later version.
13: *
14: * Heritrix is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: * GNU Lesser Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser Public License
20: * along with Heritrix; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: */
23: package org.archive.crawler.processor.recrawl;
24:
25: import java.util.Iterator;
26:
27: import org.archive.crawler.datamodel.CrawlURI;
28:
29: import st.ata.util.AList;
30:
31: /**
32: * Store CrawlURI attributes from latest fetch to persistent storage for
33: * consultation by a later recrawl.
34: *
35: * @author gojomo
36: * @version $Date: 2006-09-25 20:19:54 +0000 (Mon, 25 Sep 2006) $, $Revision: 4654 $
37: */
38: public class PersistLoadProcessor extends PersistOnlineProcessor {
39: private static final long serialVersionUID = -1917169316015093131L;
40:
41: /**
42: * Usual constructor
43: *
44: * @param name
45: */
46: public PersistLoadProcessor(String name) {
47: super (name, "PersistLoadProcessor. Loads CrawlURI attributes "
48: + "from a previous crawl for current consultation.");
49: }
50:
51: @Override
52: protected void innerProcess(CrawlURI curi)
53: throws InterruptedException {
54: if (shouldLoad(curi)) {
55: AList prior = (AList) store.get(persistKeyFor(curi));
56: if (prior != null) {
57: // merge in keys
58: Iterator iter = prior.getKeys();
59: curi.getAList().copyKeysFrom(iter, prior);
60: }
61: }
62: }
63: }
|