001package votorola.a.diff.harvest.run; 002 003import java.io.InputStream; 004 005/** 006 * Interface to talk to {@linkplain HarvestRunner}. 007 * 008 * Set archiveUrl and url before scheduling the job and access the inpustream 009 * and status-code in the run() method. 010 * 011 */ 012public interface Fetcher extends Runnable { 013 014 /** 015 * This is the identifier of the forum necessary to balance requests for 016 * each forum. 017 * 018 * @return archiveUrl 019 */ 020 public String archiveUrl(); 021 022 /** 023 * The actual Url to fetch. 024 * 025 * @return url 026 */ 027 public String url(); 028 029 /** 030 * Used by {@linkplain HarvestRunner} to give the job access to the fetched 031 * result. 032 * 033 * @param in 034 */ 035 public void setInputStream(InputStream in); 036 037 /** 038 * Used by {@linkplain HarvestRunner} to set the return code of the result 039 * for error handling. 040 * 041 * @param code 042 */ 043 public void setStatusCode(int code); 044 045 /** 046 * The Runnable is called once the input stream and code is set. 047 */ 048 @Override 049 public void run(); 050 051 /** 052 * This is called instead of run if something below the HTTP layer goes 053 * wrong. 054 */ 055 public void fault(final String msg); 056}