org.gudy.azureus2.plugins.download
Interface DownloadManager

All Known Implementing Classes:
DownloadManagerImpl, RPDownloadManager

public interface DownloadManager

The DownloadManager gives access to functions used to monitor and manage Azureus's downloads

Author:
parg

Method Summary
 void addDownload(File torrent_file)
          Add a torrent from a file.
 Download addDownload(Torrent torrent)
          Add a torrent from a "Torrent" object.
 Download addDownload(Torrent torrent, File torrent_location, File data_location)
          Add a torrent from a "Torrent" object and point it at the data location.
 void addDownload(URL url)
          add a torrent from a URL.
 void addDownload(URL url, boolean auto_download)
          Add a torrent from a URL with explicit auto-download option
 void addDownload(URL url, Map request_properties)
          add a torrent from a URL and use the supplied request properties
 void addDownload(URL url, URL referer)
          add a torrent from a URL.
 Download addDownloadStopped(Torrent torrent, File torrent_location, File data_location)
          Explicit way of adding a download in a stopped state
 void addDownloadStubListener(DownloadStubListener l, boolean inform_of_current)
           
 void addDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)
           
 void addListener(DownloadManagerListener l)
          Add a listener that will be informed when a download is added to and removed from Azureus.
 void addListener(DownloadManagerListener l, boolean notify_of_current_downloads)
          Add a listener that will be informed when a download is added to and removed from Azureus.
 Download addNonPersistentDownload(Torrent torrent, File torrent_location, File data_location)
          Add a non-persistent download.
 Download addNonPersistentDownloadStopped(Torrent torrent, File torrent_location, File data_location)
           
 boolean canPauseDownloads()
           
 boolean canResumeDownloads()
           
 void clearNonPersistentDownloadState(byte[] hash)
          Although non-persistent downloads themselves aren't rememebered across restarts, some internal stats are (for continuity, like total up/down, file allocation state) - this method allows this to be removed
 DefaultSaveLocationManager getDefaultSaveLocationManager()
          Returns the default SaveLocationManager object that controls where downloads should be placed.
 Download getDownload(byte[] hash)
          Gets a download given its hash
 Download getDownload(Torrent torrent)
          Gets the download for a particular torrent, returns null if not found
 Download[] getDownloads()
          Gets all the downloads.
 Download[] getDownloads(boolean bSorted)
          Gets all the downloads.
 int getDownloadStubCount()
           
 DownloadStub[] getDownloadStubs()
           
 DownloadEventNotifier getGlobalDownloadEventNotifier()
          Return a DownloadEventNotifier object which can be used as an easy way to register listeners against all downloads handled by Azureus.
 SaveLocationManager getSaveLocationManager()
          Returns the current SaveLocationManager object which decides where downloads should be placed.
 DownloadManagerStats getStats()
          Get the download manager statistics
 boolean isSeedingOnly()
          indicates whether or not all active downloads are in a seeding (or effective) seeding state
 DownloadStub lookupDownloadStub(byte[] hash)
           
 void pauseDownloads()
          pause all running downloads
 void removeDownloadStubListener(DownloadStubListener l)
           
 void removeDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)
           
 void removeListener(DownloadManagerListener l)
          Removes a previously added listener.
 void removeListener(DownloadManagerListener l, boolean notify_of_current_downloads)
          Removes a previously added listener.
 void resumeDownloads()
          resume previously paused downloads
 void setSaveLocationManager(SaveLocationManager manager)
          Registers an object to be in control of determining the default save location for downloads.
 void startAllDownloads()
          starts all non-running downloads
 void stopAllDownloads()
          stops all running downloads
 

Method Detail

addDownload

void addDownload(File torrent_file)
                 throws DownloadException
Add a torrent from a file. This may prompt the user for a download location etc. if required. This is an async operation, so no Download is returned. If you want to force a download to be added without prompting the user, you should create a Torrent object first, and then use an alternative addDownload method.

Parameters:
torrent_file -
Throws:
DownloadException
Since:
2.0.7.0
See Also:
addDownload(Torrent), addDownload(Torrent, File, File), TorrentManager.createFromBEncodedFile

addDownload

void addDownload(URL url)
                 throws DownloadException
add a torrent from a URL. This will prompt the user for download location etc. if required This is an async operation so no Download returned

Parameters:
url -
Throws:
DownloadException
Since:
2.0.7.0

addDownload

void addDownload(URL url,
                 boolean auto_download)
                 throws DownloadException
Add a torrent from a URL with explicit auto-download option

Parameters:
url -
auto_download -
Throws:
DownloadException
Since:
2403

addDownload

void addDownload(URL url,
                 URL referer)
add a torrent from a URL. This will prompt the user for download location etc. if required This is an async operation so no Download returned

Parameters:
url -
referer -
Throws:
DownloadException
Since:
2.1.0.6

addDownload

void addDownload(URL url,
                 Map request_properties)
add a torrent from a URL and use the supplied request properties

Parameters:
url -
request_properties -
Since:
3.0.5.3

addDownload

Download addDownload(Torrent torrent)
                     throws DownloadException
Add a torrent from a "Torrent" object. The default torrent file and data locations will be used if defined - a DownloadException will be thrown if they're not. You can explicitly set these values by using the addDownload(Torrent, File, File) method.

Parameters:
torrent -
Returns:
Throws:
DownloadException
Since:
2.0.8.0
See Also:
addDownload(Torrent, File, File)

addDownload

Download addDownload(Torrent torrent,
                     File torrent_location,
                     File data_location)
                     throws DownloadException
Add a torrent from a "Torrent" object and point it at the data location. The torrent_location should be the location of where the torrent file is on disk. This will be the torrent file that Azureus will use internally. If null is passed, then a file to store the torrent data in will be automatically created by Azureus.

Parameters:
torrent - The torrent object to create a download with.
torrent_location - The location of the file on disk - if null, a file to store the torrent data into will be created automatically.
data_location - null -> user default data save location if defined
Returns:
support for null params for torrent_location/data_location since 2.1.0.4
Throws:
DownloadException
Since:
2.0.7.0

addDownloadStopped

Download addDownloadStopped(Torrent torrent,
                            File torrent_location,
                            File data_location)
                            throws DownloadException
Explicit way of adding a download in a stopped state

Parameters:
torrent -
torrent_location -
data_location -
Returns:
Throws:
DownloadException
Since:
3013

addNonPersistentDownload

Download addNonPersistentDownload(Torrent torrent,
                                  File torrent_location,
                                  File data_location)
                                  throws DownloadException
Add a non-persistent download. Such downloads are not persisted by Azureus and as such will not be remembered across an Azureus close and restart.

Parameters:
torrent -
torrent_location -
data_location -
Returns:
Throws:
DownloadException
Since:
2.0.7.0

addNonPersistentDownloadStopped

Download addNonPersistentDownloadStopped(Torrent torrent,
                                         File torrent_location,
                                         File data_location)
                                         throws DownloadException
Throws:
DownloadException

clearNonPersistentDownloadState

void clearNonPersistentDownloadState(byte[] hash)
Although non-persistent downloads themselves aren't rememebered across restarts, some internal stats are (for continuity, like total up/down, file allocation state) - this method allows this to be removed

Parameters:
hash -

getDownload

Download getDownload(Torrent torrent)
Gets the download for a particular torrent, returns null if not found

Parameters:
torrent -
Returns:
Since:
2.0.7.0

getDownload

Download getDownload(byte[] hash)
                     throws DownloadException
Gets a download given its hash

Parameters:
hash -
Returns:
Throws:
DownloadException
Since:
2.3.0.7

getDownloads

Download[] getDownloads()
Gets all the downloads. Returned in Download "index" order

Returns:
Since:
2.0.7.0

getDownloads

Download[] getDownloads(boolean bSorted)
Gets all the downloads.

Parameters:
bSorted - true - Returned in Download "index" order.
false - Order not guaranteed. Faster retrieval.
Returns:
array of Download object
Since:
2.0.8.0

pauseDownloads

void pauseDownloads()
pause all running downloads

Since:
2.1.0.5

canPauseDownloads

boolean canPauseDownloads()

resumeDownloads

void resumeDownloads()
resume previously paused downloads

Since:
2.1.0.5

canResumeDownloads

boolean canResumeDownloads()

startAllDownloads

void startAllDownloads()
starts all non-running downloads

Since:
2.1.0.5

stopAllDownloads

void stopAllDownloads()
stops all running downloads

Since:
2.1.0.5

getStats

DownloadManagerStats getStats()
Get the download manager statistics

Returns:

isSeedingOnly

boolean isSeedingOnly()
indicates whether or not all active downloads are in a seeding (or effective) seeding state

Returns:
Since:
2.3.0.5

addListener

void addListener(DownloadManagerListener l)
Add a listener that will be informed when a download is added to and removed from Azureus.

Invoking this method is equivalent to addListener(l, true).

Parameters:
l - The listener to add.
Since:
2.0.7.0
See Also:
addListener(DownloadManagerListener, boolean)

addListener

void addListener(DownloadManagerListener l,
                 boolean notify_of_current_downloads)
Add a listener that will be informed when a download is added to and removed from Azureus.

Parameters:
l - The listener to add.
notify_of_current_downloads - true - if you want the listener to have its downloadAdded method invoked immediately with all downloads currently managed by Azureus. false - if you only want to be notified about new downloads added after this method is called.
Since:
3.0.0.7

removeListener

void removeListener(DownloadManagerListener l,
                    boolean notify_of_current_downloads)
Removes a previously added listener.

Parameters:
l - The listener to remove.
notify_of_current_downloads - true - if you want the listener to have its downloadRemoved method invoked immediately with all downloads currently managed by Azureus, false otherwise.
Since:
3.0.0.7

removeListener

void removeListener(DownloadManagerListener l)
Removes a previously added listener.

Invoking this method is equivalent to removeListener(l, false).

Parameters:
l - The listener to remove.
Since:
2.0.7.0
See Also:
removeListener(DownloadManagerListener, boolean)

addDownloadWillBeAddedListener

void addDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)

removeDownloadWillBeAddedListener

void removeDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)

getGlobalDownloadEventNotifier

DownloadEventNotifier getGlobalDownloadEventNotifier()
Return a DownloadEventNotifier object which can be used as an easy way to register listeners against all downloads handled by Azureus.

Since:
3.0.1.5

setSaveLocationManager

void setSaveLocationManager(SaveLocationManager manager)
Registers an object to be in control of determining the default save location for downloads. You can set it to null to remove any object which was previously set.

By default, Azureus will use its default save location manager which handles on-completion and on-removal events.

Parameters:
manager - The new manager object to use.
Since:
3.0.5.3

getSaveLocationManager

SaveLocationManager getSaveLocationManager()
Returns the current SaveLocationManager object which decides where downloads should be placed.

Returns:
The manager object currently in use.
Since:
3.0.5.3

getDefaultSaveLocationManager

DefaultSaveLocationManager getDefaultSaveLocationManager()
Returns the default SaveLocationManager object that controls where downloads should be placed.

Returns:
The default save location manager object.
Since:
3.0.5.3

getDownloadStubs

DownloadStub[] getDownloadStubs()

lookupDownloadStub

DownloadStub lookupDownloadStub(byte[] hash)

getDownloadStubCount

int getDownloadStubCount()

addDownloadStubListener

void addDownloadStubListener(DownloadStubListener l,
                             boolean inform_of_current)

removeDownloadStubListener

void removeDownloadStubListener(DownloadStubListener l)