org.erowid.sperowider
Class DownloadRunner

java.lang.Object
  extended byorg.erowid.sperowider.DownloadRunner

public class DownloadRunner
extends Object

Does the downloading, using repeated calls to a Downloader class.

Version:
$Header: /cvsroot/sperowider/SPEROWIDER_MODULE/javasource/org/erowid/sperowider/DownloadRunner.java,v 1.21 2005/03/12 19:28:13 gurustu Exp $
Author:
Stu Statman

Field Summary
static int WHEN_LIMIT_IS_REACHED
          The termination type indicating that files should be downloaded and spidered until the limit (as set via setLimit(int)) is reached, or until no more URLs are found.
static int WHEN_NO_MORE_URLS
          The termination type indicating that files should be downloaded and spidered until no more valid files are found.
 
Constructor Summary
DownloadRunner(SperowiderContext context, int terminationType)
          Instantiates a downloader, with a given download model.
 
Method Summary
 int getDownloadStatisticCount(int downloadStatus)
          Returns the number of downloads that have resulted in the passed in status.
 int getHttpResponseCodeCount(int httpResponseCode)
          Returns the number of Http responses of each kind.
 int getTotalDownloadAttempts()
          Returns the total number of download attempts.
 int getTotalHttpAttempts()
          Returns the total number of download attempts.
 int run()
          Starts downloading and spidering, with the passed in URL as the first URL.
 void setLimit(int limit)
          Sets the total number of files to download.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHEN_NO_MORE_URLS

public static final int WHEN_NO_MORE_URLS
The termination type indicating that files should be downloaded and spidered until no more valid files are found.

See Also:
Constant Field Values

WHEN_LIMIT_IS_REACHED

public static final int WHEN_LIMIT_IS_REACHED
The termination type indicating that files should be downloaded and spidered until the limit (as set via setLimit(int)) is reached, or until no more URLs are found.

See Also:
Constant Field Values
Constructor Detail

DownloadRunner

public DownloadRunner(SperowiderContext context,
                      int terminationType)
Instantiates a downloader, with a given download model. The download root is where it should download to.

Method Detail

setLimit

public void setLimit(int limit)
Sets the total number of files to download.


getDownloadStatisticCount

public int getDownloadStatisticCount(int downloadStatus)
Returns the number of downloads that have resulted in the passed in status. Valid values are current : ASpiderBase.SUCCESS, ASpiderBase.ALREADY_GRABBED, ASpiderBase.BAD_HTTP_RESPONSE, ASpiderBase.EXCEPTION, ASpiderBase.FILTER_FAILURE, ASpiderBase.SUCCESS.


getHttpResponseCodeCount

public int getHttpResponseCodeCount(int httpResponseCode)
Returns the number of Http responses of each kind.


getTotalDownloadAttempts

public int getTotalDownloadAttempts()
Returns the total number of download attempts. This is one per filename found while spidering.


getTotalHttpAttempts

public int getTotalHttpAttempts()
Returns the total number of download attempts. This will be more that getTotalDownloadAttempts(), because this counts each 302 as an Http attempt.


run

public int run()
Starts downloading and spidering, with the passed in URL as the first URL.


spero logo small Sperowider is
© 2005 Erowid.org