Class DownloadEventNotifierImpl
- java.lang.Object
-
- com.biglybt.pifimpl.local.download.DownloadEventNotifierImpl
-
- All Implemented Interfaces:
DownloadEventNotifier
public class DownloadEventNotifierImpl extends java.lang.Object implements DownloadEventNotifier
This is an implementation of DownloadEventNotifier to be simplify life for plugins if they want to register event listeners across all downloads managed by the client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
DownloadEventNotifierImpl.BaseDownloadListener
class
DownloadEventNotifierImpl.DownloadActivationNotifier
class
DownloadEventNotifierImpl.DownloadAttributeNotifier
class
DownloadEventNotifierImpl.DownloadCompletionNotifier
class
DownloadEventNotifierImpl.DownloadNotifier
class
DownloadEventNotifierImpl.DownloadPeerNotifier
class
DownloadEventNotifierImpl.DownloadTrackerNotifier
class
DownloadEventNotifierImpl.DownloadWillBeRemovedNotifier
-
Field Summary
Fields Modifier and Type Field Description private DownloadManager
dm
private DownloadEventNotifierImpl.DownloadActivationNotifier
download_activation_notifier
private DownloadEventNotifierImpl.DownloadCompletionNotifier
download_completion_notifier
private DownloadEventNotifierImpl.DownloadNotifier
download_notifier
private DownloadEventNotifierImpl.DownloadPeerNotifier
download_peer_notifier
private DownloadEventNotifierImpl.DownloadTrackerNotifier
download_tracker_notifier
private DownloadEventNotifierImpl.DownloadTrackerNotifier
download_tracker_notifier_instant
private DownloadEventNotifierImpl.DownloadWillBeRemovedNotifier
download_will_be_removed_notifier
private java.util.HashMap
read_attribute_listeners
private java.util.HashMap
write_attribute_listeners
-
Constructor Summary
Constructors Constructor Description DownloadEventNotifierImpl(DownloadManager dm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addActivationListener(DownloadActivationListener l)
Adds a listener that will be invoked when a request is made to activate a torrent.void
addAttributeListener(DownloadAttributeListener listener, TorrentAttribute ta, int event_type)
Adds a listener that will be informed of when attributes on a download have been read / modified.void
addCompletionListener(DownloadCompletionListener l)
Adds a listener that will be informed when a download moves into a completed state.void
addDownloadWillBeRemovedListener(DownloadWillBeRemovedListener l)
Adds a listener that will be informed when a download is about to be removed.void
addListener(DownloadListener l)
Adds a listener that will be informed of changes to a download's state.void
addPeerListener(DownloadPeerListener l)
Adds a listener that will be informed of when peer managers have been added / removed for a download.void
addTrackerListener(DownloadTrackerListener l)
Adds a listener that will be informed when the latest announce/scrape results change.void
addTrackerListener(DownloadTrackerListener l, boolean immediateTrigger)
Adds a listener that will be informed when the latest announce/scrape results change.private java.util.Map
getAttributeListenerMap(int event_type)
void
removeActivationListener(DownloadActivationListener l)
Removes a listener object added via theDownloadEventNotifier.addActivationListener(DownloadActivationListener)
method.void
removeAttributeListener(DownloadAttributeListener listener, TorrentAttribute ta, int event_type)
Removes a listener object added via themethod.
void
removeCompletionListener(DownloadCompletionListener l)
Removes a listener object removed via theDownloadEventNotifier.addCompletionListener(DownloadCompletionListener)
method.void
removeDownloadWillBeRemovedListener(DownloadWillBeRemovedListener l)
Removes a listener object added via theDownloadEventNotifier.addDownloadWillBeRemovedListener(DownloadWillBeRemovedListener)
method.void
removeListener(DownloadListener l)
Removes a listener object added via theDownloadEventNotifier.addListener(DownloadListener)
method.void
removePeerListener(DownloadPeerListener l)
Removes a listener object added via theDownloadEventNotifier.addPeerListener(DownloadPeerListener)
method.void
removeTrackerListener(DownloadTrackerListener l)
Removes a listener object added via theDownloadEventNotifier.addTrackerListener(DownloadTrackerListener)
orDownloadEventNotifier.addTrackerListener(DownloadTrackerListener, boolean)
method.
-
-
-
Field Detail
-
download_activation_notifier
private DownloadEventNotifierImpl.DownloadActivationNotifier download_activation_notifier
-
download_notifier
private DownloadEventNotifierImpl.DownloadNotifier download_notifier
-
download_peer_notifier
private DownloadEventNotifierImpl.DownloadPeerNotifier download_peer_notifier
-
download_tracker_notifier
private DownloadEventNotifierImpl.DownloadTrackerNotifier download_tracker_notifier
-
download_tracker_notifier_instant
private DownloadEventNotifierImpl.DownloadTrackerNotifier download_tracker_notifier_instant
-
download_will_be_removed_notifier
private DownloadEventNotifierImpl.DownloadWillBeRemovedNotifier download_will_be_removed_notifier
-
download_completion_notifier
private DownloadEventNotifierImpl.DownloadCompletionNotifier download_completion_notifier
-
dm
private DownloadManager dm
-
read_attribute_listeners
private java.util.HashMap read_attribute_listeners
-
write_attribute_listeners
private java.util.HashMap write_attribute_listeners
-
-
Constructor Detail
-
DownloadEventNotifierImpl
public DownloadEventNotifierImpl(DownloadManager dm)
-
-
Method Detail
-
addActivationListener
public void addActivationListener(DownloadActivationListener l)
Description copied from interface:DownloadEventNotifier
Adds a listener that will be invoked when a request is made to activate a torrent.- Specified by:
addActivationListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to add.
-
addCompletionListener
public void addCompletionListener(DownloadCompletionListener l)
Description copied from interface:DownloadEventNotifier
Adds a listener that will be informed when a download moves into a completed state.- Specified by:
addCompletionListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to add.
-
addDownloadWillBeRemovedListener
public void addDownloadWillBeRemovedListener(DownloadWillBeRemovedListener l)
Description copied from interface:DownloadEventNotifier
Adds a listener that will be informed when a download is about to be removed. This gives the implementor the opportunity to veto the removal.- Specified by:
addDownloadWillBeRemovedListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to add.
-
addListener
public void addListener(DownloadListener l)
Description copied from interface:DownloadEventNotifier
Adds a listener that will be informed of changes to a download's state.- Specified by:
addListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to add.
-
addPeerListener
public void addPeerListener(DownloadPeerListener l)
Description copied from interface:DownloadEventNotifier
Adds a listener that will be informed of when peer managers have been added / removed for a download.- Specified by:
addPeerListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to add.
-
addTrackerListener
public void addTrackerListener(DownloadTrackerListener l)
Description copied from interface:DownloadEventNotifier
Adds a listener that will be informed when the latest announce/scrape results change.Listener events will be immediately triggered after the listener has been added.
- Specified by:
addTrackerListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to add.
-
addTrackerListener
public void addTrackerListener(DownloadTrackerListener l, boolean immediateTrigger)
Description copied from interface:DownloadEventNotifier
Adds a listener that will be informed when the latest announce/scrape results change.- Specified by:
addTrackerListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to add.immediateTrigger
- Whether to immediately trigger listener's events.
-
removeActivationListener
public void removeActivationListener(DownloadActivationListener l)
Description copied from interface:DownloadEventNotifier
Removes a listener object added via theDownloadEventNotifier.addActivationListener(DownloadActivationListener)
method.- Specified by:
removeActivationListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to remove.
-
removeCompletionListener
public void removeCompletionListener(DownloadCompletionListener l)
Description copied from interface:DownloadEventNotifier
Removes a listener object removed via theDownloadEventNotifier.addCompletionListener(DownloadCompletionListener)
method.- Specified by:
removeCompletionListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to remove.
-
removeDownloadWillBeRemovedListener
public void removeDownloadWillBeRemovedListener(DownloadWillBeRemovedListener l)
Description copied from interface:DownloadEventNotifier
Removes a listener object added via theDownloadEventNotifier.addDownloadWillBeRemovedListener(DownloadWillBeRemovedListener)
method.- Specified by:
removeDownloadWillBeRemovedListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to remove.
-
removeListener
public void removeListener(DownloadListener l)
Description copied from interface:DownloadEventNotifier
Removes a listener object added via theDownloadEventNotifier.addListener(DownloadListener)
method.- Specified by:
removeListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to remove.
-
removePeerListener
public void removePeerListener(DownloadPeerListener l)
Description copied from interface:DownloadEventNotifier
Removes a listener object added via theDownloadEventNotifier.addPeerListener(DownloadPeerListener)
method.- Specified by:
removePeerListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to remove.
-
removeTrackerListener
public void removeTrackerListener(DownloadTrackerListener l)
Description copied from interface:DownloadEventNotifier
Removes a listener object added via theDownloadEventNotifier.addTrackerListener(DownloadTrackerListener)
orDownloadEventNotifier.addTrackerListener(DownloadTrackerListener, boolean)
method.- Specified by:
removeTrackerListener
in interfaceDownloadEventNotifier
- Parameters:
l
- The listener to remove.
-
addAttributeListener
public void addAttributeListener(DownloadAttributeListener listener, TorrentAttribute ta, int event_type)
Description copied from interface:DownloadEventNotifier
Adds a listener that will be informed of when attributes on a download have been read / modified.- Specified by:
addAttributeListener
in interfaceDownloadEventNotifier
- Parameters:
listener
- The listener to add.ta
- The torrent attribute to be notified about.event_type
- The type of event to be notified of, as defined onDownloadAttributeListener
.
-
removeAttributeListener
public void removeAttributeListener(DownloadAttributeListener listener, TorrentAttribute ta, int event_type)
Description copied from interface:DownloadEventNotifier
Removes a listener object added via themethod.
- Specified by:
removeAttributeListener
in interfaceDownloadEventNotifier
- Parameters:
listener
- The listener to remove.ta
- The torrent attribute which it registered with.event_type
- The type of event which it registered with.
-
getAttributeListenerMap
private java.util.Map getAttributeListenerMap(int event_type)
-
-