|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gudy.azureus2.pluginsimpl.local.download.DownloadManagerImpl
public class DownloadManagerImpl
Field Summary | |
---|---|
protected static AEMonitor |
class_mon
|
protected static DownloadManagerImpl |
singleton
|
Fields inherited from interface org.gudy.azureus2.core3.download.DownloadManagerInitialisationAdapter |
---|
ACT_ASSIGNS_TAGS, ACT_NONE, ACT_PROCESSES_TAGS |
Constructor Summary | |
---|---|
protected |
DownloadManagerImpl(AzureusCore _azureus_core)
|
Method Summary | |
---|---|
void |
addDownload(java.io.File fileName)
Add a torrent from a file. |
Download |
addDownload(Torrent torrent)
Add a torrent from a "Torrent" object. |
Download |
addDownload(Torrent torrent,
java.io.File torrent_file,
java.io.File data_location)
Add a torrent from a "Torrent" object and point it at the data location. |
Download |
addDownload(Torrent torrent,
java.io.File torrent_file,
java.io.File data_location,
int initial_state)
|
void |
addDownload(java.net.URL url)
add a torrent from a URL. |
void |
addDownload(java.net.URL url,
boolean auto_download)
Add a torrent from a URL with explicit auto-download option |
void |
addDownload(java.net.URL url,
java.util.Map request_properties)
add a torrent from a URL and use the supplied request properties |
void |
addDownload(java.net.URL url,
java.net.URL referrer)
add a torrent from a URL. |
void |
addDownload(java.net.URL url,
java.net.URL referrer,
boolean auto_download,
java.util.Map request_properties)
|
protected void |
addDownloadManager(DownloadManager dm)
|
Download |
addDownloadStopped(Torrent torrent,
java.io.File torrent_location,
java.io.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 |
addExternalDownload(Download download)
|
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,
java.io.File torrent_file,
java.io.File data_location)
Add a non-persistent download. |
Download |
addNonPersistentDownloadStopped(Torrent torrent,
java.io.File torrent_file,
java.io.File data_location)
|
boolean |
canPauseDownloads()
|
boolean |
canResumeDownloads()
|
boolean |
canStubbify(DownloadImpl download)
|
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 |
protected Download |
destubbify(DownloadStubImpl stub)
|
int |
getActions()
Unfortuately order can be important when firing off initialisation adapters, in particular if one listener assigns tags to a download it needs to do this before any other listeners that might process a download's tags |
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(DiskManager dm)
|
protected DownloadImpl |
getDownload(DownloadManager dm)
|
Download |
getDownload(Torrent _torrent)
Gets the download for a particular torrent, returns null if not found |
protected Download |
getDownload(TOTorrent torrent)
|
Download[] |
getDownloads()
Gets all the downloads. |
Download[] |
getDownloads(boolean bSorted)
Gets all the downloads. |
static Download |
getDownloadStatic(DiskManager dm)
|
static DownloadImpl |
getDownloadStatic(DownloadManager dm)
Retrieve the plugin Downlaod object related to the DownloadManager |
static DownloadImpl[] |
getDownloadStatic(DownloadManager[] dm)
|
static Download |
getDownloadStatic(TOTorrent torrent)
|
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. |
protected int |
getInitialState()
|
SaveLocationManager |
getSaveLocationManager()
Returns the current SaveLocationManager object which decides
where downloads should be placed. |
static DownloadManagerImpl |
getSingleton(AzureusCore azureus_core)
|
DownloadManagerStats |
getStats()
Get the download manager statistics |
static TOTorrent |
getStubTorrent(byte[] hash)
|
protected TOTorrent |
getTorrent(DownloadStubImpl stub)
|
void |
initialised(DownloadManager manager,
boolean for_seeding)
|
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 |
protected void |
remove(DownloadStubImpl stub)
|
void |
removeDownloadStubListener(DownloadStubListener l)
|
void |
removeDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)
|
void |
removeExternalDownload(Download download)
|
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 |
protected DownloadStub |
stubbify(DownloadImpl download)
|
protected void |
updated(DownloadStubImpl stub)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static DownloadManagerImpl singleton
protected static AEMonitor class_mon
Constructor Detail |
---|
protected DownloadManagerImpl(AzureusCore _azureus_core)
Method Detail |
---|
public static DownloadManagerImpl getSingleton(AzureusCore azureus_core)
public void addDownload(java.io.File fileName)
DownloadManager
addDownload
in interface DownloadManager
DownloadManager.addDownload(Torrent)
,
DownloadManager.addDownload(Torrent, File, File)
,
TorrentManager.createFromBEncodedFile
public void addDownload(java.net.URL url)
DownloadManager
addDownload
in interface DownloadManager
public void addDownload(java.net.URL url, boolean auto_download) throws DownloadException
DownloadManager
addDownload
in interface DownloadManager
DownloadException
public void addDownload(java.net.URL url, java.net.URL referrer)
DownloadManager
addDownload
in interface DownloadManager
public void addDownload(java.net.URL url, java.util.Map request_properties)
DownloadManager
addDownload
in interface DownloadManager
public void addDownload(java.net.URL url, java.net.URL referrer, boolean auto_download, java.util.Map request_properties)
protected void addDownloadManager(DownloadManager dm)
public Download addDownload(Torrent torrent) throws DownloadException
DownloadManager
addDownload(Torrent, File, File)
method.
addDownload
in interface DownloadManager
DownloadException
DownloadManager.addDownload(Torrent, File, File)
public Download addDownload(Torrent torrent, java.io.File torrent_file, java.io.File data_location) throws DownloadException
DownloadManager
addDownload
in interface DownloadManager
torrent
- The torrent object to create a download with.torrent_file
- 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
DownloadException
public Download addDownload(Torrent torrent, java.io.File torrent_file, java.io.File data_location, int initial_state) throws DownloadException
DownloadException
public Download addDownloadStopped(Torrent torrent, java.io.File torrent_location, java.io.File data_location) throws DownloadException
DownloadManager
addDownloadStopped
in interface DownloadManager
DownloadException
public Download addNonPersistentDownload(Torrent torrent, java.io.File torrent_file, java.io.File data_location) throws DownloadException
DownloadManager
addNonPersistentDownload
in interface DownloadManager
DownloadException
public Download addNonPersistentDownloadStopped(Torrent torrent, java.io.File torrent_file, java.io.File data_location) throws DownloadException
addNonPersistentDownloadStopped
in interface DownloadManager
DownloadException
public void clearNonPersistentDownloadState(byte[] hash)
DownloadManager
clearNonPersistentDownloadState
in interface DownloadManager
protected int getInitialState()
protected DownloadImpl getDownload(DownloadManager dm) throws DownloadException
DownloadException
public static DownloadImpl[] getDownloadStatic(DownloadManager[] dm)
public static DownloadImpl getDownloadStatic(DownloadManager dm) throws DownloadException
dm
- DownloadManager to find
DownloadException
public static Download getDownloadStatic(DiskManager dm) throws DownloadException
DownloadException
public Download getDownload(DiskManager dm) throws DownloadException
DownloadException
protected Download getDownload(TOTorrent torrent) throws DownloadException
DownloadException
public static Download getDownloadStatic(TOTorrent torrent) throws DownloadException
DownloadException
public Download getDownload(Torrent _torrent)
DownloadManager
getDownload
in interface DownloadManager
public Download getDownload(byte[] hash)
DownloadManager
getDownload
in interface DownloadManager
public Download[] getDownloads()
DownloadManager
getDownloads
in interface DownloadManager
public Download[] getDownloads(boolean bSorted)
DownloadManager
getDownloads
in interface DownloadManager
bSorted
- true - Returned in Download "index" order.public void pauseDownloads()
DownloadManager
pauseDownloads
in interface DownloadManager
public boolean canPauseDownloads()
canPauseDownloads
in interface DownloadManager
public void resumeDownloads()
DownloadManager
resumeDownloads
in interface DownloadManager
public boolean canResumeDownloads()
canResumeDownloads
in interface DownloadManager
public void startAllDownloads()
DownloadManager
startAllDownloads
in interface DownloadManager
public void stopAllDownloads()
DownloadManager
stopAllDownloads
in interface DownloadManager
public DownloadManagerStats getStats()
DownloadManager
getStats
in interface DownloadManager
public boolean isSeedingOnly()
DownloadManager
isSeedingOnly
in interface DownloadManager
public void addListener(DownloadManagerListener l)
DownloadManager
addListener(l, true)
.
addListener
in interface DownloadManager
l
- The listener to add.DownloadManager.addListener(DownloadManagerListener, boolean)
public void addListener(DownloadManagerListener l, boolean notify_of_current_downloads)
DownloadManager
addListener
in interface DownloadManager
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.public void removeListener(DownloadManagerListener l)
DownloadManager
removeListener(l, false)
.
removeListener
in interface DownloadManager
l
- The listener to remove.DownloadManager.removeListener(DownloadManagerListener, boolean)
public void removeListener(DownloadManagerListener l, boolean notify_of_current_downloads)
DownloadManager
removeListener
in interface DownloadManager
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.public void initialised(DownloadManager manager, boolean for_seeding)
initialised
in interface DownloadManagerInitialisationAdapter
public int getActions()
DownloadManagerInitialisationAdapter
getActions
in interface DownloadManagerInitialisationAdapter
public void addDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)
addDownloadWillBeAddedListener
in interface DownloadManager
public void removeDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)
removeDownloadWillBeAddedListener
in interface DownloadManager
public void addExternalDownload(Download download)
public void removeExternalDownload(Download download)
public DownloadEventNotifier getGlobalDownloadEventNotifier()
DownloadManager
DownloadEventNotifier
object which can be used as
an easy way to register listeners against all downloads handled by
Azureus.
getGlobalDownloadEventNotifier
in interface DownloadManager
public void setSaveLocationManager(SaveLocationManager manager)
DownloadManager
By default, Azureus will use its default save location manager which handles on-completion and on-removal events.
setSaveLocationManager
in interface DownloadManager
manager
- The new manager object to use.public SaveLocationManager getSaveLocationManager()
DownloadManager
SaveLocationManager
object which decides
where downloads should be placed.
getSaveLocationManager
in interface DownloadManager
public DefaultSaveLocationManager getDefaultSaveLocationManager()
DownloadManager
SaveLocationManager
object that controls
where downloads should be placed.
getDefaultSaveLocationManager
in interface DownloadManager
public boolean canStubbify(DownloadImpl download)
protected DownloadStub stubbify(DownloadImpl download) throws DownloadException, DownloadRemovalVetoException
DownloadException
DownloadRemovalVetoException
protected Download destubbify(DownloadStubImpl stub) throws DownloadException
DownloadException
protected void remove(DownloadStubImpl stub)
public static TOTorrent getStubTorrent(byte[] hash)
protected TOTorrent getTorrent(DownloadStubImpl stub)
protected void updated(DownloadStubImpl stub)
public DownloadStub[] getDownloadStubs()
getDownloadStubs
in interface DownloadManager
public int getDownloadStubCount()
getDownloadStubCount
in interface DownloadManager
public DownloadStub lookupDownloadStub(byte[] hash)
lookupDownloadStub
in interface DownloadManager
public void addDownloadStubListener(DownloadStubListener l, boolean inform_of_current)
addDownloadStubListener
in interface DownloadManager
public void removeDownloadStubListener(DownloadStubListener l)
removeDownloadStubListener
in interface DownloadManager
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |