org.gudy.azureus2.core3.global
Interface GlobalManager

All Superinterfaces:
AzureusCoreComponent, TaggableResolver
All Known Implementing Classes:
GlobalManagerImpl

public interface GlobalManager
extends AzureusCoreComponent, TaggableResolver

The GlobalManager contains a list of all the downloads (DownloadManager objects) that Azureus controls.


Method Summary
 DownloadManager addDownloadManager(java.lang.String fileName, byte[] optionalHash, java.lang.String savePath, int initialState, boolean persistent)
          Create and add a Download Manager to the global list
 DownloadManager addDownloadManager(java.lang.String fileName, byte[] optionalHash, java.lang.String savePath, int initialState, boolean persistent, boolean for_seeding, DownloadManagerInitialisationAdapter adapter)
          Create and add a Download Manager to the global list
 DownloadManager addDownloadManager(java.lang.String fileName, byte[] optionalHash, java.lang.String savePath, java.lang.String saveFile, int initialState, boolean persistent, boolean for_seeding, DownloadManagerInitialisationAdapter adapter)
          Create and add a Download Manager to the global list
 DownloadManager addDownloadManager(java.lang.String file_name, java.lang.String save_path)
          Create and add a Download Manager to the global list
 void addDownloadManagerInitialisationAdapter(DownloadManagerInitialisationAdapter adapter)
          Any adapters added will get a chance to see/set the initial state of downloads as they are added
 void addDownloadWillBeRemovedListener(GlobalManagerDownloadWillBeRemovedListener l)
          Add a listener triggered when Download is about to be removed
 void addEventListener(GlobalManagerEventListener listener)
           
 void addListener(GlobalManagerListener l)
          Add a Global Manager listener
 void addListener(GlobalManagerListener listener, boolean trigger)
           
 void canDownloadManagerBeRemoved(DownloadManager dm, boolean remove_torrent, boolean remove_data)
          Determines whether a DownloadManager can be removed
 boolean canPauseDownloads()
          Indicates whether or not there are any downloads that can be paused.
 boolean canResumeDownloads()
          Indicates whether or not there are any paused downloads to resume.
 void clearNonPersistentDownloadState(byte[] hash)
           
 boolean contains(DownloadManager manager)
           
 int downloadManagerCount(boolean bCompleted)
          Retrieve the number of download managers the global manager is managing.
 java.util.Map exportDownloadStateToMap(DownloadManager dm)
           
 void fireGlobalManagerEvent(int type, DownloadManager param)
           
 void fixUpDownloadManagerPositions()
          Verifies the positions of the DownloadManagers, filling in gaps and shifting duplicate IDs down if necessary.
 java.lang.Object getDownloadHistoryManager()
           
 DownloadManager getDownloadManager(HashWrapper hash)
          Retrieve the DownloadManager associated with a hash
 DownloadManager getDownloadManager(TOTorrent torrent)
          Retrieve the DownloadManager associated with a TOTorrent object
 java.util.List<DownloadManager> getDownloadManagers()
          Retrieve a list of DownloadManagers that GlobalManager is handling
 int getIndexOf(DownloadManager dm)
          Deprecated. Should not be used, as indexes may be different than when getDownloadManagers() was called.
 MainlineDHTProvider getMainlineDHTProvider()
           
 int getNATStatus()
          See plugin ConnectionManager.NAT_ constants for return values
 int getPauseDownloadPeriodRemaining()
          seconds remaining, 0 if not active
 GlobalManagerStats getStats()
          Retrieve the Global Manager Statistics class
 TRTrackerScraper getTrackerScraper()
          Retrieve the Tracker Scraper management class
 DownloadManager importDownloadStateFromMap(java.util.Map map)
           
 boolean isMoveableDown(DownloadManager dm)
          Retrieve whether a DownloadManager can move down in the GlobalManager list
 boolean isMoveableUp(DownloadManager dm)
          Retrieve whether a DownloadManager can move up in the GlobalManager list
 boolean isPaused(DownloadManager dm)
          Retrieve whether a DownloadManager is in a paused state
 boolean isPotentiallySeedingOnly()
          As for isSeedingOnly but includes queued seeds
 boolean isSeedingOnly()
          Determines whether we are only seeding, and not currently downloading anything.
 java.lang.String isSwarmMerging(DownloadManager dm)
           
 void loadExistingTorrentsNow(boolean async)
           
 void moveDown(DownloadManager dm)
          Move one DownloadManager down in the GlobalManager's list
 void moveEnd(DownloadManager[] dm)
          Move a list of DownloadManagers to the end of the GlobalManager list
 void moveTo(DownloadManager manager, int newPosition)
          Move a Downloadmanager to a new position.
 void moveTop(DownloadManager[] dm)
          Move a list of DownloadManagers to the top of the GlobalManager list
 void moveUp(DownloadManager dm)
          Move one DownloadManager up in the GlobalManager's list
 boolean pauseDownload(DownloadManager dm)
          Pause one DownloadManager
 void pauseDownloads()
          Pauses (stops) all running downloads/seedings.
 void pauseDownloadsForPeriod(int seconds)
          pause any non-paused downloads and auto-resume all downloads after n seconds
 void removeDownloadManager(DownloadManager dm)
          Removes a DownloadManager from the global list, providing it can be removed (see #canDownloadManagerBeRemoved(DownloadManager))
 void removeDownloadManager(DownloadManager manager, boolean remove_torrent, boolean remove_data)
           
 void removeDownloadManagerInitialisationAdapter(DownloadManagerInitialisationAdapter adapter)
           
 void removeDownloadWillBeRemovedListener(GlobalManagerDownloadWillBeRemovedListener l)
          Remove a listener triggered when Download is about to be removed
 void removeEventListener(GlobalManagerEventListener listener)
           
 void removeListener(GlobalManagerListener l)
          Removes a Global Manager listener
 void resumeDownload(DownloadManager dm)
          Resume a previously paused DownloadManager
 void resumeDownloads()
          Resumes (starts) all downloads paused by the previous pauseDownloads call.
 boolean resumeDownloads(boolean is_auto_resume)
          Attempt to automatically resume downloads - request may be denied if manual override in effect
 boolean resumingDownload(DownloadManager dm)
          This reports that a download is being resumed in order to remove it from the paused set Don't use this to actually resume a download, use resumeDownload !
 void saveState()
           
 void setMainlineDHTProvider(MainlineDHTProvider provider)
          Calling this method doesn't prepare Azureus to be DHT-ready, it is only used to store, or remove, a DHT provider - so that it can be globally accessible.
 void startAllDownloads()
          Starts all downloads
 void statsRequest(java.util.Map request, java.util.Map reply)
           
 void stopAllDownloads()
          Stops all downloads without removing them
 void stopGlobalManager()
          Puts GlobalManager in a stopped state.
Used when closing down Azureus.
 
Methods inherited from interface com.aelitis.azureus.core.tag.TaggableResolver
getDisplayName, getResolvedTaggables, getResolverTaggableType, requestAttention, resolveTaggable
 

Method Detail

addDownloadManager

DownloadManager addDownloadManager(java.lang.String file_name,
                                   java.lang.String save_path)
Create and add a Download Manager to the global list

Parameters:
file_name - location and name of torrent file
save_path - path to write the data to
Returns:
The Downloadmanger based on the supplied information.
May return an existing DownloadManager if torrent was already in GlobalManager.

addDownloadManager

DownloadManager addDownloadManager(java.lang.String fileName,
                                   byte[] optionalHash,
                                   java.lang.String savePath,
                                   int initialState,
                                   boolean persistent)
Create and add a Download Manager to the global list

Parameters:
fileName - location and name of torrent file
savePath - path to write the data to
initialState - Initial state of download. See DownloadManager.STATE_*
persistent - Whether the download should be treated as persistent download
Returns:
The Downloadmanger based on the supplied information.
May return an existing DownloadManager if torrent was already in GlobalManager.

addDownloadManager

DownloadManager addDownloadManager(java.lang.String fileName,
                                   byte[] optionalHash,
                                   java.lang.String savePath,
                                   java.lang.String saveFile,
                                   int initialState,
                                   boolean persistent,
                                   boolean for_seeding,
                                   DownloadManagerInitialisationAdapter adapter)
Create and add a Download Manager to the global list

Parameters:
fileName - location and name of torrent file
savePath - path to write the data to
safeFile - subdirectory or filename to write the data to
initialState - Initial state of download. See DownloadManager.STATE_*
persistent - Whether the download should be treated as persistent download
for_seeding - Whether the manager should assume the torrent is already complete and ready for seeding.
Returns:
The Downloadmanger based on the supplied information.
May return an existing DownloadManager if torrent was already in GlobalManager.

addDownloadManager

DownloadManager addDownloadManager(java.lang.String fileName,
                                   byte[] optionalHash,
                                   java.lang.String savePath,
                                   int initialState,
                                   boolean persistent,
                                   boolean for_seeding,
                                   DownloadManagerInitialisationAdapter adapter)
Create and add a Download Manager to the global list

Parameters:
fileName - location and name of torrent file
savePath - path to write the data to
initialState - Initial state of download. See DownloadManager.STATE_*
persistent - Whether the download should be treated as persistent download
for_seeding - Whether the manager should assume the torrent is already complete and ready for seeding.
Returns:
The Downloadmanger based on the supplied information.
May return an existing DownloadManager if torrent was already in GlobalManager.

removeDownloadManager

void removeDownloadManager(DownloadManager dm)
                           throws GlobalManagerDownloadRemovalVetoException
Removes a DownloadManager from the global list, providing it can be removed (see #canDownloadManagerBeRemoved(DownloadManager))

The DownloadManager will not be stopped if it is running. Scraping, however, will be turned off.

Parameters:
dm - DownloadManager to remove
Throws:
GlobalManagerDownloadRemovalVetoException

canDownloadManagerBeRemoved

void canDownloadManagerBeRemoved(DownloadManager dm,
                                 boolean remove_torrent,
                                 boolean remove_data)
                                 throws GlobalManagerDownloadRemovalVetoException
Determines whether a DownloadManager can be removed

Parameters:
dm - DownloadManager to check
Throws:
GlobalManagerDownloadRemovalVetoException

getDownloadManagers

java.util.List<DownloadManager> getDownloadManagers()
Retrieve a list of DownloadManagers that GlobalManager is handling

Returns:
a list of DownloadManagers

getDownloadManager

DownloadManager getDownloadManager(TOTorrent torrent)
Retrieve the DownloadManager associated with a TOTorrent object

Parameters:
torrent - Torrent to search for
Returns:
The DownloadManager associted with the TOTOrrent, or null if none found

getDownloadManager

DownloadManager getDownloadManager(HashWrapper hash)
Retrieve the DownloadManager associated with a hash

Parameters:
hash - Hash to search for
Returns:
The DownloadManager associted with the hash, or null if none found

getTrackerScraper

TRTrackerScraper getTrackerScraper()
Retrieve the Tracker Scraper management class

Returns:
Tracker Scraper management class

getStats

GlobalManagerStats getStats()
Retrieve the Global Manager Statistics class

Returns:
the Global Manager Statistics class

stopGlobalManager

void stopGlobalManager()
Puts GlobalManager in a stopped state.
Used when closing down Azureus.


stopAllDownloads

void stopAllDownloads()
Stops all downloads without removing them


startAllDownloads

void startAllDownloads()
Starts all downloads


pauseDownloads

void pauseDownloads()
Pauses (stops) all running downloads/seedings.


pauseDownloadsForPeriod

void pauseDownloadsForPeriod(int seconds)
pause any non-paused downloads and auto-resume all downloads after n seconds

Parameters:
seconds -

getPauseDownloadPeriodRemaining

int getPauseDownloadPeriodRemaining()
seconds remaining, 0 if not active

Returns:

canPauseDownloads

boolean canPauseDownloads()
Indicates whether or not there are any downloads that can be paused.

Returns:
true if there is at least one download to pause, false if none

resumeDownloads

void resumeDownloads()
Resumes (starts) all downloads paused by the previous pauseDownloads call.


resumeDownloads

boolean resumeDownloads(boolean is_auto_resume)
Attempt to automatically resume downloads - request may be denied if manual override in effect

Parameters:
is_auto_resume -
Returns:
whether operation was accepted

canResumeDownloads

boolean canResumeDownloads()
Indicates whether or not there are any paused downloads to resume.

Returns:
true if there is at least one download to resume, false if none.

resumingDownload

boolean resumingDownload(DownloadManager dm)
This reports that a download is being resumed in order to remove it from the paused set Don't use this to actually resume a download, use resumeDownload !

Parameters:
dm -
Returns:

pauseDownload

boolean pauseDownload(DownloadManager dm)
Pause one DownloadManager

Parameters:
dm - DownloadManager to pause
Returns:
False if DownloadManager was invalid, stopped, or pause failed

resumeDownload

void resumeDownload(DownloadManager dm)
Resume a previously paused DownloadManager

Parameters:
dm - DownloadManager to resume

clearNonPersistentDownloadState

void clearNonPersistentDownloadState(byte[] hash)

isPaused

boolean isPaused(DownloadManager dm)
Retrieve whether a DownloadManager is in a paused state

Parameters:
dm - DownloadManager to query
Returns:
the pause state

isSwarmMerging

java.lang.String isSwarmMerging(DownloadManager dm)

isSeedingOnly

boolean isSeedingOnly()
Determines whether we are only seeding, and not currently downloading anything.

Returns:
Seeding Only State

isPotentiallySeedingOnly

boolean isPotentiallySeedingOnly()
As for isSeedingOnly but includes queued seeds

Returns:

getIndexOf

int getIndexOf(DownloadManager dm)
Deprecated. Should not be used, as indexes may be different than when getDownloadManagers() was called.

Retrieve the index of a DownloadManager within the GlobalManager list retrieved via getDownloadManagers().

This is NOT the DownloadManager's position

Parameters:
dm - DownloadManger to find the index of
Returns:
index, -1 if not in list

downloadManagerCount

int downloadManagerCount(boolean bCompleted)
Retrieve the number of download managers the global manager is managing.

Parameters:
bCompleted - True: Return count of completed downloads
False: Return count of incomplete downloads
Returns:
count

isMoveableDown

boolean isMoveableDown(DownloadManager dm)
Retrieve whether a DownloadManager can move down in the GlobalManager list

Parameters:
dm - DownloadManager to check
Returns:
True - Can move down

isMoveableUp

boolean isMoveableUp(DownloadManager dm)
Retrieve whether a DownloadManager can move up in the GlobalManager list

Parameters:
dm - DownloadManager to check
Returns:
True - Can move up

moveTop

void moveTop(DownloadManager[] dm)
Move a list of DownloadManagers to the top of the GlobalManager list

Parameters:
dm - array list of DownloadManager objects to move

moveUp

void moveUp(DownloadManager dm)
Move one DownloadManager up in the GlobalManager's list

Parameters:
dm - DownloadManager to move up

moveDown

void moveDown(DownloadManager dm)
Move one DownloadManager down in the GlobalManager's list

Parameters:
dm - DownloadManager to move down

moveEnd

void moveEnd(DownloadManager[] dm)
Move a list of DownloadManagers to the end of the GlobalManager list

Parameters:
dm - array list of DownloadManager objects to move

moveTo

void moveTo(DownloadManager manager,
            int newPosition)
Move a Downloadmanager to a new position.

Parameters:
manager - DownloadManager to move
newPosition - position to place

fixUpDownloadManagerPositions

void fixUpDownloadManagerPositions()
Verifies the positions of the DownloadManagers, filling in gaps and shifting duplicate IDs down if necessary.

This does not need to be called after MoveXXX, addDownloadManager, or removeDownloadManager functions.


addListener

void addListener(GlobalManagerListener l)
Add a Global Manager listener

Parameters:
l - Listener to add

removeListener

void removeListener(GlobalManagerListener l)
Removes a Global Manager listener

Parameters:
l - Listener to remove

addDownloadWillBeRemovedListener

void addDownloadWillBeRemovedListener(GlobalManagerDownloadWillBeRemovedListener l)
Add a listener triggered when Download is about to be removed

Parameters:
l - Listener to add

removeDownloadWillBeRemovedListener

void removeDownloadWillBeRemovedListener(GlobalManagerDownloadWillBeRemovedListener l)
Remove a listener triggered when Download is about to be removed

Parameters:
l - Listener to remove

getNATStatus

int getNATStatus()
See plugin ConnectionManager.NAT_ constants for return values

Returns:
ConnectionManager.NAT_*

addDownloadManagerInitialisationAdapter

void addDownloadManagerInitialisationAdapter(DownloadManagerInitialisationAdapter adapter)
Any adapters added will get a chance to see/set the initial state of downloads as they are added

Parameters:
adapter -

removeDownloadManagerInitialisationAdapter

void removeDownloadManagerInitialisationAdapter(DownloadManagerInitialisationAdapter adapter)

addEventListener

void addEventListener(GlobalManagerEventListener listener)

removeEventListener

void removeEventListener(GlobalManagerEventListener listener)

fireGlobalManagerEvent

void fireGlobalManagerEvent(int type,
                            DownloadManager param)

loadExistingTorrentsNow

void loadExistingTorrentsNow(boolean async)
Parameters:
listener -

addListener

void addListener(GlobalManagerListener listener,
                 boolean trigger)
Parameters:
listener -
trigger -

removeDownloadManager

void removeDownloadManager(DownloadManager manager,
                           boolean remove_torrent,
                           boolean remove_data)
                           throws GlobalManagerDownloadRemovalVetoException
Parameters:
manager -
remove_torrent -
remove_data -
Throws:
GlobalManagerDownloadRemovalVetoException
Since:
3.0.1.7

setMainlineDHTProvider

void setMainlineDHTProvider(MainlineDHTProvider provider)
Calling this method doesn't prepare Azureus to be DHT-ready, it is only used to store, or remove, a DHT provider - so that it can be globally accessible. See the DHT manager classes in the plugin API for a better way to register a provider.

Since:
3.0.4.3

getMainlineDHTProvider

MainlineDHTProvider getMainlineDHTProvider()
Since:
3.0.4.3

statsRequest

void statsRequest(java.util.Map request,
                  java.util.Map reply)

contains

boolean contains(DownloadManager manager)
Parameters:
manager -
Returns:
Since:
4.0.0.5

saveState

void saveState()

exportDownloadStateToMap

java.util.Map exportDownloadStateToMap(DownloadManager dm)

importDownloadStateFromMap

DownloadManager importDownloadStateFromMap(java.util.Map map)

getDownloadHistoryManager

java.lang.Object getDownloadHistoryManager()