Interface GlobalManager

    • 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.
      • 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​(GlobalMangerProgressListener callback)
        Puts GlobalManager in a stopped state.
        Used when closing down the client.
      • 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,
                              boolean only_if_active)
        Pause one DownloadManager
        Parameters:
        dm - DownloadManager to pause
        Returns:
        False if DownloadManager was invalid, stopped, or pause failed
      • stopPausedDownload

        boolean stopPausedDownload​(DownloadManager dm)
        Don't use me, use dm.stopPausedDownload()
        Parameters:
        dm -
        Returns:
      • 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
      • getSwarmMergingInfo

        java.lang.String getSwarmMergingInfo​(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:
      • 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 and triggers it
        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

        java.lang.Object[] 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 -
      • fireGlobalManagerEvent

        void fireGlobalManagerEvent​(int type,
                                    DownloadManager param)
      • addListener

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

        void setMainlineDHTProvider​(MainlineDHTProvider provider)
        Calling this method doesn't prepare the client 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
      • 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()
      • isStopping

        boolean isStopping()