|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DownloadManager
The list of all downloads in progress. DownloadManager has a
fixed number of download slots given by the MAX_SIM_DOWNLOADS property. It
is responsible for starting downloads and scheduling and queueing them as
needed. This class is thread safe.
As with other classes in this package, a DownloadManager instance
may not be used until initialize(..) is called. The arguments to this are
not passed in to the constructor in case there are circular dependencies.
DownloadManager provides ways to serialize download state to
disk. Reads are initiated by RouterService, since we have to wait until the
GUI is initiated. Writes are initiated by this, since we need to be notified
of completed downloads. Downloads in the COULDNT_DOWNLOAD state are not
serialized.
| Method Summary | |
|---|---|
boolean |
acceptPushedSocket(String file,
int index,
byte[] clientGUID,
Socket socket)
Accept the newly-connected push socket The given file, index & clientGUID were identified during the push. |
void |
addNewDownloader(CoreDownloader downloader)
Adds a new downloader that this will manager. |
void |
bumpPriority(Downloader downl,
boolean up,
int amt)
Bumps the priority of an inactive download either up or down by an amount (if amt==0, bump to start/end of list). |
boolean |
conflicts(URN urn,
long fileSize,
File... fileName)
Returns true if there already is a download with the same urn. |
boolean |
contains(Downloader downloader)
Returns true if the given downloader is in either the waiting or active lists. |
Downloader |
download(DownloadInformation info,
long now)
Downloads an InNetwork update, using the info from the DownloadInformation. |
Downloader |
download(File incompleteFile)
Starts a resume download for the given incomplete file. |
Downloader |
download(MagnetOptions magnet,
boolean overwrite,
File saveDir,
String fileName)
Creates a new MAGNET downloader. |
Downloader |
download(RemoteFileDesc[] files,
List<? extends RemoteFileDesc> alts,
GUID queryGUID,
boolean overwrite,
File saveDir,
String fileName)
Tries to "smart download" any of the given files. |
Downloader |
downloadFromMozilla(MozillaDownload listener)
Creates a Downloader wrapping the MozillaDownloadListener. |
Downloader |
downloadFromStore(RemoteFileDesc rfd,
boolean overwrite,
File saveDir,
String fileName)
Creates a new LimeWire Store (LWS) download. |
int |
downloadsInProgress()
|
Downloader |
downloadTorrent(BTMetaInfo info,
boolean overwrite)
Downloads the given torrent specified by the meta info object. |
Downloader |
downloadTorrent(File torrentFile,
boolean overwrite)
Opens the torrent for the specified file, and begins the torrent download. |
Downloader |
downloadTorrent(URI torrentURI,
boolean overwrite)
Downloads the torrent file from the specified URI then begins the torrent download as a seperate item. |
Iterable<CoreDownloader> |
getAllDownloaders()
|
float |
getAverageBandwidth()
returns the summed average of the downloads |
Downloader |
getDownloaderForIncompleteFile(File file)
Returns the active or waiting downloader that uses or will use file as incomplete file. |
Downloader |
getDownloaderForURN(URN sha1)
|
IncompleteFileManager |
getIncompleteFileManager()
Returns the IncompleteFileManager used by this DownloadManager and all ManagedDownloaders. |
float |
getLastMeasuredBandwidth()
Returns the measured bandwidth as calculated from the last getMeasuredBandwidth() call. |
float |
getMeasuredBandwidth()
Returns the total upload throughput, i.e., the sum over all uploads. |
int |
getNumActiveDownloads()
Inner network traffic and downloads from the LWS don't count towards overall download activity. |
int |
getNumIndividualDownloaders()
|
int |
getNumWaitingDownloads()
|
void |
handleQueryReply(QueryReply qr,
Address address)
Adds all responses (and alternates) in qr to any downloaders, if
appropriate. |
boolean |
hasInNetworkDownload()
Determines if an 'In Network' download exists in either active or waiting. |
boolean |
isActivelyDownloading(URN urn)
Returns whether or not we are actively downloading this file. |
boolean |
isGuidForQueryDownloading(GUID guid)
|
boolean |
isIncomplete(URN urn)
Determines if the given URN has an incomplete file. |
boolean |
isSavedDownloadsLoaded()
True if saved downloads have been loaded from disk. |
boolean |
isSaveLocationTaken(File candidateFile)
Returns true if there already is a download that is or
will be saving to this file location. |
void |
killDownloadersNotListed(Collection<? extends DownloadInformation> updates)
Kills all in-network downloaders that are not present in the list of DownloadInformations |
void |
loadSavedDownloadsAndScheduleWriting()
Performs the slow, low-priority initialization tasks: reading in snapshots and scheduling snapshot checkpointing. |
void |
measureBandwidth()
Calls measureBandwidth on each uploader. |
void |
remove(CoreDownloader downloader,
boolean completed)
Removes downloader entirely from the list of current downloads. |
void |
sendQuery(QueryRequest query)
Attempts to send the given requery to provide the given downloader with more sources to download. |
void |
start()
Initializes this manager. |
void |
writeSnapshot()
Writes a snapshot of all downloaders in this and all incomplete files to the file named DOWNLOAD_SNAPSHOT_FILE. |
| Methods inherited from interface com.limegroup.gnutella.downloader.LWSIntegrationServicesDelegate |
|---|
visitDownloads |
| Methods inherited from interface org.limewire.listener.ListenerSupport |
|---|
addListener, removeListener |
| Method Detail |
|---|
void addNewDownloader(CoreDownloader downloader)
void start()
void loadSavedDownloadsAndScheduleWriting()
boolean isSavedDownloadsLoaded()
boolean hasInNetworkDownload()
void killDownloadersNotListed(Collection<? extends DownloadInformation> updates)
updates - a current set of DownloadInformation that we are
downloading in-network.
boolean acceptPushedSocket(String file,
int index,
byte[] clientGUID,
Socket socket)
PushedSocketHandler
acceptPushedSocket in interface PushedSocketHandlerboolean isIncomplete(URN urn)
boolean isActivelyDownloading(URN urn)
IncompleteFileManager getIncompleteFileManager()
int downloadsInProgress()
int getNumIndividualDownloaders()
int getNumActiveDownloads()
int getNumWaitingDownloads()
Downloader getDownloaderForURN(URN sha1)
Downloader getDownloaderForIncompleteFile(File file)
file as incomplete file.
file - the incomplete file candidate
null if no downloader for the file is foundboolean isGuidForQueryDownloading(GUID guid)
Downloader download(RemoteFileDesc[] files,
List<? extends RemoteFileDesc> alts,
GUID queryGUID,
boolean overwrite,
File saveDir,
String fileName)
throws SaveLocationException
If any of the files already being downloaded (or queued for downloaded) has the same temporary name as any of the files in 'files', throws AlreadyDownloadingException. Note, however, that this doesn't guarantee that a successfully downloaded file can be moved to the library.
If overwrite==false, then if any of the files already exists in the download directory, FileExistsException is thrown and no files are modified. If overwrite==true, the files may be overwritten.
Otherwise returns a Downloader that allows you to stop and resume this download. The DownloadCallback will also be notified of this download, so the return value can usually be ignored. The download begins immediately, unless it is queued. It stops after any of the files succeeds.
files - a group of "similar" files to smart downloadalts - a List of secondary RFDs to use for other sourcesqueryGUID - the guid of the query that resulted in the RFDs being
downloaded.overwrite - whether or not to overwrite the filesaveDir - can be null, then the default save directory is usedfileName - can be null, then the first filename of one of element of
files is taken.
SaveLocationException - when there was an error setting the
location of the final download destination.
Downloader download(MagnetOptions magnet,
boolean overwrite,
File saveDir,
String fileName)
throws IllegalArgumentException,
SaveLocationException
magnet - information fields extracted from a magnet linkoverwrite - whether or not to overwrite the filesaveDir - can be null, then the default save directory is usedfilename - the final file name, or null if unknown
IllegalArgumentException - if the magnet is not downloadable
SaveLocationException - if the file can't save because of an
existing file in the location
Downloader downloadFromStore(RemoteFileDesc rfd,
boolean overwrite,
File saveDir,
String fileName)
throws IllegalArgumentException,
SaveLocationException
rfd - Descriptor describing the download from the store including URNoverwrite - true if same file names should be overwritten; false if
the user should be notified of a duplicate file namesaveDir - directory to save the completed file intofileName - name of the completed file
IllegalArgumentException - if there is a bad argument
SaveLocationException - if the file is already downloading
Downloader download(File incompleteFile)
throws CantResumeException,
SaveLocationException
CantResumeException - incompleteFile is not a valid
incomplete file
SaveLocationException - if the file can't save because of an
existing file in the location
Downloader download(DownloadInformation info,
long now)
throws SaveLocationException
SaveLocationException
Downloader downloadTorrent(URI torrentURI,
boolean overwrite)
throws SaveLocationException
SaveLocationException
Downloader downloadTorrent(File torrentFile,
boolean overwrite)
throws SaveLocationException
SaveLocationException
Downloader downloadTorrent(BTMetaInfo info,
boolean overwrite)
throws SaveLocationException
SaveLocationException
boolean conflicts(URN urn,
long fileSize,
File... fileName)
true if there already is a download with the same urn.
urn - may be null, then a check based on the fileName
and the fileSize is performed
boolean isSaveLocationTaken(File candidateFile)
true if there already is a download that is or
will be saving to this file location.
isSaveLocationTaken in interface SaveLocationManagercandidateFile - the final file location.
void handleQueryReply(QueryReply qr,
Address address)
qr to any downloaders, if
appropriate.
address - can be null, otherwise overrides the address information in qr
void remove(CoreDownloader downloader,
boolean completed)
void bumpPriority(Downloader downl,
boolean up,
int amt)
void sendQuery(QueryRequest query)
query - the requery to send, which should have a marked GUID.
Queries are subjected to global rate limiting if and only if they have marked
requery GUIDs.void measureBandwidth()
measureBandwidth in interface BandwidthTrackerfloat getMeasuredBandwidth()
getMeasuredBandwidth in interface BandwidthTrackerfloat getAverageBandwidth()
getAverageBandwidth in interface BandwidthTrackerfloat getLastMeasuredBandwidth()
Iterable<CoreDownloader> getAllDownloaders()
void writeSnapshot()
Downloader downloadFromMozilla(MozillaDownload listener)
boolean contains(Downloader downloader)
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||