FileDocCategorySizeDatePackage
DownloadManager.javaAPI DocAzureus 3.0.3.416698Fri Sep 07 07:50:24 BST 2007org.gudy.azureus2.core3.download

DownloadManager

public interface DownloadManager

Fields Summary
public static final int
STATE_START_OF_DAY
public static final int
STATE_WAITING
public static final int
STATE_INITIALIZING
public static final int
STATE_INITIALIZED
public static final int
STATE_ALLOCATING
public static final int
STATE_CHECKING
public static final int
STATE_READY
public static final int
STATE_DOWNLOADING
public static final int
STATE_FINISHING
public static final int
STATE_SEEDING
public static final int
STATE_STOPPING
public static final int
STATE_STOPPED
public static final int
STATE_CLOSED
public static final int
STATE_QUEUED
public static final int
STATE_ERROR
public static final int
WEALTH_STOPPED
public static final int
WEALTH_NO_TRACKER
public static final int
WEALTH_NO_REMOTE
public static final int
WEALTH_OK
public static final int
WEALTH_KO
public static final int
WEALTH_ERROR
Constructors Summary
Methods Summary
public voidaddActivationListener(DownloadManagerActivationListener listener)

public voidaddDiskListener(DownloadManagerDiskListener listener)

public voidaddListener(DownloadManagerListener listener)

public voidaddPeerListener(DownloadManagerPeerListener listener)

public voidaddPeerListener(DownloadManagerPeerListener listener, boolean bDispatchForExisting)

public voidaddRateLimiter(com.aelitis.azureus.core.networkmanager.LimitedRateGroup group, boolean upload)

public voidaddTrackerListener(DownloadManagerTrackerListener listener)

public java.io.File[]calculateDefaultPaths(boolean for_moving)
Returns an array of size 2 indicating the appropriate locations for this download's data files and torrent file, based on Azureus's rules regarding default save paths, and move on completion rules. This method takes one argument - for_moving. This essentially indicates whether you are getting this information for purposes of just finding where Azureus would store these files by default, or whether you are considering moving the files from its current location. If for_moving is false, this method will determine locations for the download and the torrent file where Azureus would store them by default (it may return the current paths used by this download). If for_moving is true, then this method will consider the download's current location, and whether it is allowed to move it - you may not be allowed to move this download (based on Azureus's current rules) if the download doesn't exist within a default save directory already. If a download is complete, we consider whether we are allowed to move downloads on completion, and whether that includes downloads outside the default save directory. In this case, the array may contain null indicating that the Azureus doesn't believe that the download should be moved (based on the current rules the user has set out). However, you are not prevented from changing the location of the torrent file or download.

since
2.5.0.2
param
for_moving Indicates whether you want this information for the purposes of moving the download or not.
author
amc1
return
An array of type File of size 2, first element containing the calculated location for the download's data files, and the second element containing the location for the download's torrent file.

public booleancanForceRecheck()

public voiddestroy(boolean is_duplicate)
Indicates that the download manager is no longer needed

param
is_duplicate indicates whether this dm is being destroyed because it is a duplicate

public booleanfilesExist()
Checks if all the files the user wants to download from this torrent actually exist on their filesystem.

If a file does not exist, the download will be set to error state.

return
Whether all the non-skipped (non-DND) files exist

public voidforceRecheck()

public voidforceRecheck(ForceRecheckListener l)

param
l
since
3.0.0.7

public voidgenerateEvidence(org.gudy.azureus2.core3.util.IndentWriter writer)

public java.io.FilegetAbsoluteSaveLocation()

public intgetActivationCount()

public booleangetAssumedComplete()
Retrieve whether this download is assumed complete.

Assumed complete status is kept while the torrent is in a non-running state, even if it has no data.

When the torrent starts up, the real complete level will be checked, and if the torrent actually does have missing data, the download will be thrown into error state.

Only a forced-recheck should clear this flag.

see
{@link #requestAssumedCompleteMode()}

public longgetCreationTime()
gives the time this download was created (not the torrent but the download itself)

return

public intgetCryptoLevel()

public PEPeer[]getCurrentPeers()

public PEPiece[]getCurrentPieces()

public java.lang.ObjectgetData(java.lang.String key)
To retreive arbitrary objects against this object.

public DiskManagergetDiskManager()

public DiskManagerFileInfo[]getDiskManagerFileInfo()

public java.lang.StringgetDisplayName()

public DownloadManagerStategetDownloadState()

public intgetEffectiveMaxUploads()
Returns the max uploads depending on whether the download is seeding and it has a separate rate for this

return

public intgetEffectiveUploadRateLimitBytesPerSecond()
returns the currently in force upload speed limit which may vary from the stats. value as this gives the fixed per-torrent limit

return

public java.lang.StringgetErrorDetails()

public GlobalManagergetGlobalManager()

public intgetHealthStatus()

return
the wealthy status of this download

public java.lang.StringgetInternalName()
returns a name based on the torrent hash or an empty string if torrent invalid

return

public intgetMaxUploads()

public intgetNATStatus()
See plugin ConnectionManager.NAT_ constants for return values

return

public intgetNbPeers()

public intgetNbPieces()

public intgetNbSeeds()

public PEPeerManagergetPeerManager()

public java.lang.StringgetPieceLength()

public intgetPosition()

public java.io.FilegetSaveLocation()

public intgetSeedingRank()

public longgetSize()

public intgetState()

public DownloadManagerStatsgetStats()

public int[]getStorageType(DiskManagerFileInfo[] infos)

public intgetSubState()
For stopping this returns the target state after stopping (stopped/queued)

return

public TOTorrentgetTorrent()

public java.lang.StringgetTorrentComment()

public java.lang.StringgetTorrentCreatedBy()

public longgetTorrentCreationDate()

public java.lang.StringgetTorrentFileName()

public TRTrackerAnnouncergetTrackerClient()

public TRTrackerScraperResponsegetTrackerScrapeResponse()

public java.lang.StringgetTrackerStatus()

public intgetTrackerTime()

public voidinitialize()

public booleanisDataAlreadyAllocated()
Determine whether disk allocation has already been done. Used for checking if data is missing on a previously-loaded torrent.

return
true if data files have already been allocated

public booleanisDownloadComplete(boolean bIncludingDND)
Retrieves whether the download is complete

param
bIncludingDND true- include files marked as Do Not Download.
false- don't include files marked DND.

If there are DND files and you choose to include DND in the calculation, false will always be returned.

return
whether download is complete

public booleanisExtendedMessagingEnabled()
Is extended messaging enabled for this download (meaning AzMP and LTEP support).

return
true if enabled, false if disabled

public booleanisForceStart()

public booleanisInDefaultSaveDir()
Returns true if the download is being saved to one of the default save directories.

since
2.5.0.2

public booleanisPaused()

public booleanisPersistent()

public voidmoveDataFiles(java.io.File new_parent_dir)
Move data files to new location. Torrent must be in stopped/error state

param
new_parent_dir
return

public voidmoveDataFiles(java.io.File new_parent_dir, java.lang.String new_name)
Move the files and rename a download in one go. For convenience - either argument can be null, but not both.

see
#moveDataFiles(File)
see
#renameDownload(String)

public voidmoveTorrentFile(java.io.File new_parent_dir)
Move torrent file to new location. Download must be stopped/error

param
new_parent_dir
return

public booleanpause()

public voidrecheckFile(DiskManagerFileInfo file)
Recheck a particular file. Download must be stopped

param
file

public voidremoveActivationListener(DownloadManagerActivationListener listener)

public voidremoveDiskListener(DownloadManagerDiskListener listener)

public voidremoveListener(DownloadManagerListener listener)

public voidremovePeerListener(DownloadManagerPeerListener listener)

public voidremoveRateLimiter(com.aelitis.azureus.core.networkmanager.LimitedRateGroup group, boolean upload)

public voidremoveTrackerListener(DownloadManagerTrackerListener listener)

public voidrenameDownload(java.lang.String new_name)
Rename the download - this means the name of the file being downloaded (for single file torrents), or the name of the directory holding the files (in a multi-file torrent). This does not alter the displayed name of the download.

param
new_name
throws
DownloadManagerException

public booleanrequestAssumedCompleteMode()
Will set this download to be "assumed complete" for if the download is already complete (excluding DND)

return
true- success; false- failure, download not complete

public voidrequestTrackerAnnounce(boolean immediate)

public voidrequestTrackerScrape(boolean immediate)

public voidresetFile(DiskManagerFileInfo file)
Reset the file download state to totally undownloaded. Download must be stopped

param
file

public voidresume()

public voidsaveDownload()
persist any general download related information, excluding resume data which is managed separately by saveResumeData

public voidsaveResumeData()
persist resume data

public booleanseedPieceRecheck()
Gives the download an opportunity to schedule seeding mode piece rechecks if desired

return
true if a piece has been rechecked

public voidsetAZMessagingEnabled(boolean enable)
Enable or disable extended messaging messaging for this download.

param
enable true to enabled, false to disabled
deprecated
Want to get rid of this if possible.

public voidsetAnnounceResult(org.gudy.azureus2.plugins.download.DownloadAnnounceResult result)

public voidsetCreationTime(long t)

public voidsetCryptoLevel(int level)

public voidsetData(java.lang.String key, java.lang.Object value)
To store arbitrary objects against this object.

public voidsetDataAlreadyAllocated(boolean already_allocated)
Set whether data allocation has already been done, so we know when to allocate and when to throw a missing-data error message.

param
already_allocated

public voidsetForceStart(boolean forceStart)

public voidsetMaxUploads(int max_slots)

public voidsetPieceCheckingEnabled(boolean enabled)
Use with care - introduced to support speed tests whereby we want to avoid checking the virtual torrent used for the test

param
enabled

public voidsetPosition(int newPosition)

public voidsetScrapeResult(org.gudy.azureus2.plugins.download.DownloadScrapeResult result)

public voidsetSeedingRank(int rank)

public voidsetStateQueued()

public voidsetStateWaiting()

public voidsetTorrentFileName(java.lang.String string)

public voidsetTorrentSaveDir(java.lang.String sPath)
changes the save directory. Only call this if you know what you are doing!!!!

param
sPath

public voidsetTorrentSaveDir(java.lang.String parent_dir, java.lang.String dl_name)
changes the save directory. Only call this if you know what you are doing!!!!

param
sPath

public voidsetTrackerScrapeResponse(TRTrackerScraperResponse response)

public voidstartDownload()

public voidstopIt(int stateAfterStopping, boolean remove_torrent, boolean remove_data)
Stop the download manager, and do any file/torrent removals.

param
_stateAfterStopping
param
remove_torrent remove the .torrent file after stopping
param
remove_data remove the data file after stopping