|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Download
Management of a Torrent's activity.
Note: All listener based methods are now located in DownloadEventNotifier
.
A download's lifecycle: torrent gets added state -> QUEUED slot becomes available, queued torrent is picked, "restart" executed state -> WAITING state moves through PREPARING to READY state -> PREPARING state -> READY execute "start" method state -> SEEDING -or- DOWNLOADING if torrent is DOWNLOADING, and completes, state changes to SEEDING Path 1 | Path 2 -------------------------+------------------------------------------------ execute "stop" method | startstop rules are met, execute "stopandQueue" state -> STOPPING | state -> STOPPING state -> STOPPED | state -> STOPPED | state -> QUEUED execute "remove" method -> deletes the download a "stop" method call can be made when the download is in all states except STOPPED
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.gudy.azureus2.plugins.download.DownloadStub |
---|
DownloadStub.DownloadStubEx, DownloadStub.DownloadStubFile |
Field Summary | |
---|---|
static long |
FLAG_ALLOW_PERMITTED_PEER_SOURCE_CHANGES
Flag value - normally the permitted peer sources for a download are fixed and can't be changed this flag allows the permitted peer source set to be increased/decreased (but not beyond the enforced values required to honour a torrent's 'private' flag |
static long |
FLAG_DISABLE_AUTO_FILE_MOVE
Flag value - if set, it prevents any of the "move on completion" or "move on removal" rules taking place. |
static long |
FLAG_DISABLE_IP_FILTER
Used to disable IP filter rules for a download when ip-filtering is enabled |
static long |
FLAG_DO_NOT_DELETE_DATA_ON_REMOVE
Flag value - if set the data will not be delete when the download is "deleted" from the v3 interface. |
static long |
FLAG_ERROR_REPORTED
|
static long |
FLAG_FORCE_DIRECT_DELETE
Force direct delete of download data when delete requested, rather than recoverable delete, and no user prompt |
static long |
FLAG_INITIAL_NETWORKS_SET
|
static long |
FLAG_LIGHT_WEIGHT
|
static long |
FLAG_LOW_NOISE
Flag value - if set the user won't be bothered with popups/completion events during the download's life. |
static long |
FLAG_METADATA_DOWNLOAD
|
static long |
FLAG_MOVE_ON_COMPLETION_DONE
Flag value - if set, then it means this download has been considered for "move on completion", and it should not be considered again for it. |
static long |
FLAG_ONLY_EVER_SEEDED
Flags values |
static long |
FLAG_SCAN_INCOMPLETE_PIECES
|
static int |
PR_HIGH_PRIORITY
Use more of the upload bandwidth than low priority downloads don't change these as they are used by remote clients |
static int |
PR_LOW_PRIORITY
Use less of the upload bandwidth than high priority downloads |
static int |
ST_DOWNLOADING
downloading |
static int |
ST_ERROR
failed |
static String[] |
ST_NAMES
|
static int |
ST_PREPARING
getting files ready (allocating/checking) |
static int |
ST_QUEUED
stopped, but ready for auto-starting |
static int |
ST_READY
ready to be started if required |
static int |
ST_SEEDING
seeding |
static int |
ST_STOPPED
stopped, do not auto-start! |
static int |
ST_STOPPING
stopping |
static int |
ST_WAITING
waiting to be told to start preparing |
Method Summary | |
---|---|
void |
addRateLimiter(RateLimiter limiter,
boolean is_upload)
|
SaveLocationChange |
calculateDefaultDownloadLocation()
Returns a SaveLocationChange object describing the appropriate location
for the download (and torrent file) to exist in, based on the download's completion
state, the for-completion rules in place, and the SaveLocationManager
object in use. |
File[] |
calculateDefaultPaths(boolean for_moving)
Deprecated. Use calculateDefaultDownloadLocation() instead. |
boolean |
canBeRemoved()
Tests whether or not a download can be removed. |
boolean |
canMoveDataFiles()
Returns true if Azureus will allow the data files for the torrent to be moved. |
boolean |
canStubbify()
|
void |
changeLocation(SaveLocationChange slc)
Apply the changes in the given SaveLocationChange object - this includes
moving torrent and data file data. |
DownloadActivationEvent |
getActivationState()
Gives access to the current activation state. |
DownloadScrapeResult |
getAggregatedScrapeResult()
Returns an aggregated scrape result of all good results, or if none the same as getLastScrapeResult |
String |
getAttribute(TorrentAttribute attribute)
Gets an attribute of this download. |
boolean |
getBooleanAttribute(TorrentAttribute attribute)
Gets the value of the given attribute from the download. |
String |
getCategoryName()
Deprecated. Use TorrentAttribute.TA_CATEGORY (2.2.0.3) |
long |
getCreationTime()
returns the time this download was created in milliseconds |
DiskManager |
getDiskManager()
Return the disk manager, null if its not running |
int |
getDiskManagerFileCount()
Return the number of DiskManagerFile objects |
DiskManagerFileInfo[] |
getDiskManagerFileInfo()
Returns info about the torrent's files. |
DiskManagerFileInfo |
getDiskManagerFileInfo(int index)
Returns file info for the given index. |
List<DistributedDatabase> |
getDistributedDatabases()
|
byte[] |
getDownloadPeerId()
Get the local peerID advertised to the download swarm. |
int |
getDownloadRateLimitBytesPerSecond()
Get the max download rate allowed for this download. |
String |
getErrorStateDetails()
When the download state is ERROR this method returns the error details |
boolean |
getFlag(long flag)
Get the flag value |
long |
getFlags()
get all the flags as a bitmap |
int |
getIndex()
Index of download. |
int |
getIntAttribute(TorrentAttribute attribute)
Gets the value of the given attribute from the download. |
DownloadAnnounceResult |
getLastAnnounceResult()
Gives access to the last announce result received from the tracker for the download |
DownloadScrapeResult |
getLastScrapeResult()
Gives access to the last scrape result received from the tracker for the download |
String[] |
getListAttribute(TorrentAttribute attribute)
|
long |
getLongAttribute(TorrentAttribute attribute)
Gets the value of the given attribute from the download. |
Map |
getMapAttribute(TorrentAttribute attribute)
|
int |
getMaximumDownloadKBPerSecond()
Get the max download rate allowed for this download |
String |
getName()
Returns the name of the torrent. |
PeerManager |
getPeerManager()
return the current peer manager for the download. |
int |
getPosition()
Returns the current position in the queue Completed and Incompleted downloads have seperate position sets. |
DiskManagerFileInfo |
getPrimaryFile()
Returns the "Primary" file in the download. |
int |
getPriority()
Deprecated. >= 2.1.0.6 does nothing |
String |
getSavePath()
This returns the full save path for the download. |
int |
getSeedingRank()
The torrents with the highest rankings will be seeded first. |
int |
getState()
get state from above ST_ set |
DownloadStats |
getStats()
Gives access to the download's statistics |
int |
getSubState()
For the STOPPING state this method gives the state that is being transited too (STOPPED, QUEUED or ERROR) |
List<Tag> |
getTags()
|
Torrent |
getTorrent()
Each download has a corresponding torrent |
String |
getTorrentFileName()
Returns the full file path and name of the .torrent file |
int |
getUploadRateLimitBytesPerSecond()
Get the max upload rate allowed for this download. |
Object |
getUserData(Object key)
get user-defined key/value |
boolean |
hasAttribute(TorrentAttribute attribute)
Returns true if the download has an explicit value stored for
the given attribute. |
void |
initialize()
See lifecycle description above |
boolean |
isChecking()
When a download is completed it is rechecked (if the option is enabled). |
boolean |
isComplete()
Indicates if the download has completed or not, exluding any files marked as Do No Download |
boolean |
isComplete(boolean bIncludeDND)
Indicates if the download has completed or not |
boolean |
isForceStart()
Retrieves whether the download is force started |
boolean |
isInDefaultSaveDir()
Deprecated. Use DefaultSaveLocationManager.isInDefaultSaveDir(Download) instead. |
boolean |
isMessagingEnabled()
Is advanced AZ messaging enabled for this download. |
boolean |
isMoving()
Returns true if the download is currently in the process of having its datafiles moved |
boolean |
isPaused()
|
boolean |
isPersistent()
Downloads can be persistent (be remembered across Azureus sessions), or non-persistent. |
boolean |
isPriorityLocked()
Deprecated. >= 2.0.8.0 does nothing |
boolean |
isRemoved()
|
boolean |
isStartStopLocked()
When a download is "start-stop locked" it means that seeding rules shouldn't start or stop the download as it is under manual control |
void |
moveDataFiles(File new_parent_dir)
Move a download's data files to a new location. |
void |
moveDataFiles(File new_parent_dir,
String new_name)
Move a download's data files to a new location, and rename the download at the same time. |
void |
moveDown()
Moves the download down one position |
void |
moveTo(int position)
Moves a download and re-orders the others appropriately. |
void |
moveTorrentFile(File new_parent_dir)
Move a download's torrent file to a new location. |
void |
moveUp()
Moves the download position up one |
void |
pause()
Pause the download |
void |
recheckData()
Performs a complete recheck of the downloaded data Download must be in stopped, queued or error state Action is performed asynchronously and will progress the download through states PREPARING back to the relevant state |
void |
remove()
Removes a download. |
void |
remove(boolean delete_torrent,
boolean delete_data)
Same as "remove" but, if successful, deletes the torrent and/or data |
void |
removeRateLimiter(RateLimiter limiter,
boolean is_upload)
|
void |
renameDownload(String name)
Renames the file (for a single file torrent) or directory (for a multi file torrent) where the download is being saved to. |
void |
requestTrackerAnnounce()
request a tracker announce |
void |
requestTrackerAnnounce(boolean immediate)
request a tracker announce |
void |
requestTrackerScrape(boolean immediate)
request a tracker announce |
void |
restart()
See lifecycle description above |
void |
resume()
Resume the download if paused |
void |
setAnnounceResult(DownloadAnnounceResult result)
|
void |
setAttribute(TorrentAttribute attribute,
String value)
Sets an attribute of this download. |
void |
setBooleanAttribute(TorrentAttribute attribute,
boolean value)
Sets a boolean attribute on this download. |
void |
setCategory(String sName)
Deprecated. Use TorrentAttribute.TA_CATEGORY (2.2.0.3) |
void |
setDownloadRateLimitBytesPerSecond(int max_rate_bps)
Set the max download rate allowed for this download. |
void |
setFlag(long flag,
boolean set)
Set the flag value. |
void |
setForceStart(boolean forceStart)
Set the forcestart state of the download |
void |
setIntAttribute(TorrentAttribute attribute,
int value)
Sets an integer attribute on this download. |
void |
setListAttribute(TorrentAttribute attribute,
String[] value)
|
void |
setLongAttribute(TorrentAttribute attribute,
long value)
Sets a long attribute on this download. |
void |
setMapAttribute(TorrentAttribute attribute,
Map value)
|
void |
setMaximumDownloadKBPerSecond(int kb)
Sets the maximum download speed in bytes per second. |
void |
setMessagingEnabled(boolean enabled)
Enable or disable advanced AZ messaging for this download. |
void |
setPosition(int newPosition)
Sets the position in the queue Completed and Incompleted downloads have seperate position sets |
void |
setPriority(int priority)
Deprecated. >= 2.1.0.6 does nothing |
void |
setScrapeResult(DownloadScrapeResult result)
|
void |
setSeedingRank(int rank)
The torrents with the highest rankings will be seeded first. |
void |
setUploadRateLimitBytesPerSecond(int max_rate_bps)
Set the max upload rate allowed for this download. |
void |
setUserData(Object key,
Object data)
set user defined value. |
void |
start()
See lifecycle description above |
void |
startDownload(boolean force)
Simple method to start the download. |
void |
stop()
See lifecycle description above |
void |
stopAndQueue()
See lifecycle description above |
void |
stopDownload()
Simple method to stop the download. |
DownloadStub |
stubbify()
|
Methods inherited from interface org.gudy.azureus2.plugins.download.DownloadEventNotifier |
---|
addActivationListener, addAttributeListener, addCompletionListener, addDownloadWillBeRemovedListener, addListener, addPeerListener, addPropertyListener, addTrackerListener, addTrackerListener, removeActivationListener, removeAttributeListener, removeCompletionListener, removeDownloadWillBeRemovedListener, removeListener, removePeerListener, removePropertyListener, removeTrackerListener |
Methods inherited from interface org.gudy.azureus2.plugins.download.DownloadStub |
---|
destubbify, getStubFiles, getTorrentHash, getTorrentSize, isStub |
Field Detail |
---|
static final int ST_WAITING
static final int ST_PREPARING
static final int ST_READY
static final int ST_DOWNLOADING
static final int ST_SEEDING
static final int ST_STOPPING
static final int ST_STOPPED
static final int ST_ERROR
static final int ST_QUEUED
static final String[] ST_NAMES
static final int PR_HIGH_PRIORITY
static final int PR_LOW_PRIORITY
static final long FLAG_ONLY_EVER_SEEDED
static final long FLAG_SCAN_INCOMPLETE_PIECES
static final long FLAG_DISABLE_AUTO_FILE_MOVE
static final long FLAG_MOVE_ON_COMPLETION_DONE
static final long FLAG_LOW_NOISE
static final long FLAG_ALLOW_PERMITTED_PEER_SOURCE_CHANGES
static final long FLAG_DO_NOT_DELETE_DATA_ON_REMOVE
static final long FLAG_FORCE_DIRECT_DELETE
static final long FLAG_DISABLE_IP_FILTER
static final long FLAG_METADATA_DOWNLOAD
static final long FLAG_LIGHT_WEIGHT
static final long FLAG_ERROR_REPORTED
static final long FLAG_INITIAL_NETWORKS_SET
Method Detail |
---|
int getState()
int getSubState()
String getErrorStateDetails()
boolean getFlag(long flag)
flag
- FLAG value from above
void setFlag(long flag, boolean set)
flag
- FLAG value from aboveset
- true
to enable the flag, false
to disable it.long getFlags()
int getIndex()
getPosition()
Torrent getTorrent()
getTorrent
in interface DownloadStub
void initialize() throws DownloadException
DownloadException
void start() throws DownloadException
DownloadException
void stop() throws DownloadException
DownloadException
void stopAndQueue() throws DownloadException
DownloadException
void restart() throws DownloadException
DownloadException
void recheckData() throws DownloadException
DownloadException
boolean isStartStopLocked()
boolean isForceStart()
void setForceStart(boolean forceStart)
forceStart
- True - Download will start, despite any Start/Stop rules/limitsint getPriority()
void setPriority(int priority)
priority
- the required priority, see PR_ constants aboveboolean isPriorityLocked()
boolean isPaused()
void pause()
void resume()
String getName()
getName
in interface DownloadStub
String getTorrentFileName()
String getAttribute(TorrentAttribute attribute)
attribute
-
void setAttribute(TorrentAttribute attribute, String value)
attribute
- Previously created attributevalue
- Value to store. null to remove attributeString[] getListAttribute(TorrentAttribute attribute)
void setListAttribute(TorrentAttribute attribute, String[] value)
attribute
- value
- void setMapAttribute(TorrentAttribute attribute, Map value)
attribute
- value
- must be bencodable - key is string, value is Map, List, Long or byte[]Map getMapAttribute(TorrentAttribute attribute)
int getIntAttribute(TorrentAttribute attribute)
0
will be returned.
void setIntAttribute(TorrentAttribute attribute, int value)
long getLongAttribute(TorrentAttribute attribute)
0
will be returned.
getLongAttribute
in interface DownloadStub
void setLongAttribute(TorrentAttribute attribute, long value)
setLongAttribute
in interface DownloadStub
boolean getBooleanAttribute(TorrentAttribute attribute)
false
will be returned.
void setBooleanAttribute(TorrentAttribute attribute, boolean value)
boolean hasAttribute(TorrentAttribute attribute)
true
if the download has an explicit value stored for
the given attribute.
String getCategoryName()
void setCategory(String sName)
sName
- Category nameList<Tag> getTags()
void remove() throws DownloadException, DownloadRemovalVetoException
remove
in interface DownloadStub
DownloadException
DownloadRemovalVetoException
void remove(boolean delete_torrent, boolean delete_data) throws DownloadException, DownloadRemovalVetoException
delete_torrent
- delete_data
-
DownloadException
DownloadRemovalVetoException
int getPosition()
long getCreationTime()
void setPosition(int newPosition)
void moveUp()
void moveDown()
void moveTo(int position)
position
- boolean canBeRemoved() throws DownloadRemovalVetoException
DownloadRemovalVetoException
void setAnnounceResult(DownloadAnnounceResult result)
void setScrapeResult(DownloadScrapeResult result)
DownloadAnnounceResult getLastAnnounceResult()
DownloadScrapeResult getLastScrapeResult()
DownloadScrapeResult getAggregatedScrapeResult()
DownloadActivationEvent getActivationState()
DownloadStats getStats()
boolean isPersistent()
void setMaximumDownloadKBPerSecond(int kb)
kb
- int getMaximumDownloadKBPerSecond()
int getUploadRateLimitBytesPerSecond()
void setUploadRateLimitBytesPerSecond(int max_rate_bps)
max_rate_bps
- limit in bytes per second, 0 for unlimited, -1 for upload disabledint getDownloadRateLimitBytesPerSecond()
void setDownloadRateLimitBytesPerSecond(int max_rate_bps)
max_rate_bps
- limit in bytes per second, 0 for unlimited, -1 for dowmload disabledvoid addRateLimiter(RateLimiter limiter, boolean is_upload)
limiter
- create via ConnectionManageris_upload
- false -> download limitvoid removeRateLimiter(RateLimiter limiter, boolean is_upload)
boolean isComplete()
boolean isComplete(boolean bIncludeDND)
bIncludeDND
- Whether to include DND files when determining
completion state
boolean isChecking()
boolean isMoving()
String getSavePath()
getSavePath
in interface DownloadStub
void moveDataFiles(File new_parent_dir) throws DownloadException
If a download is running, it will be automatically paused and resumed afterwards - be aware that this behaviour may generate stateChanged events being fired.
new_parent_dir
-
DownloadException
void moveDataFiles(File new_parent_dir, String new_name) throws DownloadException
If a download is running, it will be automatically paused and resumed afterwards - be aware that this behaviour may generate stateChanged events being fired.
DownloadException
#moveDataFiles(File)}
,
#renameDownload(String)}
void moveTorrentFile(File new_parent_dir) throws DownloadException
new_parent_dir
-
DownloadException
void renameDownload(String name) throws DownloadException
moveDataFiles(File)
).
This will not rename the displayed name for the torrent - if you wish to do that, you must do it via
the TorrentAttribute
class.
If a download is running, it will be automatically paused and resumed afterwards - be aware that this behaviour may generate stateChanged events being fired.
name
- New name for the download.
DownloadException
moveDataFiles(File)
PeerManager getPeerManager()
DiskManager getDiskManager()
DiskManagerFileInfo[] getDiskManagerFileInfo()
DiskManagerFileInfo getDiskManagerFileInfo(int index)
int getDiskManagerFileCount()
void requestTrackerAnnounce()
void requestTrackerAnnounce(boolean immediate)
void requestTrackerScrape(boolean immediate)
int getSeedingRank()
void setSeedingRank(int rank)
rank
- New Rankingbyte[] getDownloadPeerId()
boolean isMessagingEnabled()
void setMessagingEnabled(boolean enabled)
enabled
- true to enabled, false to disabledFile[] calculateDefaultPaths(boolean for_moving)
calculateDefaultDownloadLocation()
instead.
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.
for_moving
- Indicates whether you want this information for the purposes
of moving the download or not.
boolean isInDefaultSaveDir()
DefaultSaveLocationManager.isInDefaultSaveDir(Download)
instead.
boolean isRemoved()
boolean canMoveDataFiles()
SaveLocationChange calculateDefaultDownloadLocation()
SaveLocationChange
object describing the appropriate location
for the download (and torrent file) to exist in, based on the download's completion
state, the for-completion rules in place, and the SaveLocationManager
object in use.
void changeLocation(SaveLocationChange slc) throws DownloadException
SaveLocationChange
object - this includes
moving torrent and data file data.
slc
- The change to apply.
DownloadException
- If there is a problem moving the data.Object getUserData(Object key)
key
-
void setUserData(Object key, Object data)
key
- data
- void startDownload(boolean force)
force
- true to force the download to be started.void stopDownload()
boolean canStubbify()
DownloadStub stubbify() throws DownloadException, DownloadRemovalVetoException
DownloadException
DownloadRemovalVetoException
List<DistributedDatabase> getDistributedDatabases()
DiskManagerFileInfo getPrimaryFile()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |