Class TrackerImpl
- java.lang.Object
-
- com.biglybt.pifimpl.local.tracker.TrackerWCHelper
-
- com.biglybt.pifimpl.local.tracker.TrackerImpl
-
- All Implemented Interfaces:
TRHostAuthenticationListener
,TRHostListener2
,Tracker
,TrackerWebContext
public class TrackerImpl extends TrackerWCHelper implements Tracker, TRHostListener2, TRHostAuthenticationListener
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<TrackerAuthenticationListener>
auth_listeners
private static AEMonitor
class_mon
private TRHost
host
private java.util.List
listeners
private static TrackerImpl
singleton
-
Fields inherited from class com.biglybt.pifimpl.local.tracker.TrackerWCHelper
this_mon
-
Fields inherited from interface com.biglybt.pif.tracker.Tracker
PR_HTTP, PR_HTTPS, PR_NON_BLOCKING
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TrackerImpl(TRHost _host)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAuthenticationListener(TrackerAuthenticationListener l)
void
addListener(TrackerListener listener)
boolean
authenticate(java.lang.String headers, java.net.URL resource, java.lang.String user, java.lang.String password)
byte[]
authenticate(java.net.URL resource, java.lang.String user)
TrackerWebContext
createWebContext(int port, int protocol)
TrackerWebContext
createWebContext(java.lang.String name, int port, int protocol)
Create a new web context for the given port and protocolTrackerWebContext
createWebContext(java.lang.String name, int port, int protocol, java.net.InetAddress bind_ip)
Creates a new context bound to the supplied ipTrackerWebContext
createWebContext(java.lang.String name, int port, int protocol, java.net.InetAddress bind_ip, java.util.Map<java.lang.String,java.lang.Object> properties)
void
destroy()
java.net.InetAddress
getBindIP()
java.lang.String
getName()
static Tracker
getSingleton()
TrackerTorrent
getTorrent(Torrent torrent)
TrackerTorrent[]
getTorrents()
java.net.URL[]
getURLs()
returns the context URLS (can be two for the tracker as http + https)TrackerTorrent
host(Torrent _torrent, boolean _persistent)
TrackerTorrent
host(Torrent _torrent, boolean _persistent, boolean _passive)
TrackerTorrent
publish(Torrent _torrent)
void
removeAuthenticationListener(TrackerAuthenticationListener l)
void
removeListener(TrackerListener listener)
void
setEnableKeepAlive(boolean enable)
void
torrentAdded(TRHostTorrent t)
void
torrentChanged(TRHostTorrent t)
void
torrentRemoved(TRHostTorrent t)
-
Methods inherited from class com.biglybt.pifimpl.local.tracker.TrackerWCHelper
addPageGenerator, getPageGenerators, handleExternalRequest, removePageGenerator, setTracker
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.biglybt.pif.tracker.web.TrackerWebContext
addPageGenerator, getPageGenerators, removePageGenerator
-
Methods inherited from interface com.biglybt.core.tracker.host.TRHostListener2
handleExternalRequest
-
-
-
-
Field Detail
-
singleton
private static TrackerImpl singleton
-
class_mon
private static AEMonitor class_mon
-
listeners
private java.util.List listeners
-
host
private TRHost host
-
auth_listeners
private java.util.List<TrackerAuthenticationListener> auth_listeners
-
-
Constructor Detail
-
TrackerImpl
protected TrackerImpl(TRHost _host)
-
-
Method Detail
-
getSingleton
public static Tracker getSingleton()
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceTrackerWebContext
-
setEnableKeepAlive
public void setEnableKeepAlive(boolean enable)
- Specified by:
setEnableKeepAlive
in interfaceTrackerWebContext
-
getURLs
public java.net.URL[] getURLs()
Description copied from interface:TrackerWebContext
returns the context URLS (can be two for the tracker as http + https)- Specified by:
getURLs
in interfaceTrackerWebContext
- Returns:
-
getBindIP
public java.net.InetAddress getBindIP()
- Specified by:
getBindIP
in interfaceTrackerWebContext
-
host
public TrackerTorrent host(Torrent _torrent, boolean _persistent) throws TrackerException
- Specified by:
host
in interfaceTracker
- Throws:
TrackerException
-
host
public TrackerTorrent host(Torrent _torrent, boolean _persistent, boolean _passive) throws TrackerException
- Specified by:
host
in interfaceTracker
- Throws:
TrackerException
-
publish
public TrackerTorrent publish(Torrent _torrent) throws TrackerException
- Specified by:
publish
in interfaceTracker
- Throws:
TrackerException
-
getTorrents
public TrackerTorrent[] getTorrents()
- Specified by:
getTorrents
in interfaceTracker
-
getTorrent
public TrackerTorrent getTorrent(Torrent torrent)
- Specified by:
getTorrent
in interfaceTracker
-
createWebContext
public TrackerWebContext createWebContext(int port, int protocol) throws TrackerException
- Specified by:
createWebContext
in interfaceTracker
- Returns:
- Throws:
TrackerException
-
createWebContext
public TrackerWebContext createWebContext(java.lang.String name, int port, int protocol) throws TrackerException
Description copied from interface:Tracker
Create a new web context for the given port and protocol- Specified by:
createWebContext
in interfaceTracker
- Parameters:
name
- name of the context - will be used as basic realm for auth- Returns:
- Throws:
TrackerException
-
createWebContext
public TrackerWebContext createWebContext(java.lang.String name, int port, int protocol, java.net.InetAddress bind_ip) throws TrackerException
Description copied from interface:Tracker
Creates a new context bound to the supplied ip- Specified by:
createWebContext
in interfaceTracker
- Returns:
- Throws:
TrackerException
-
createWebContext
public TrackerWebContext createWebContext(java.lang.String name, int port, int protocol, java.net.InetAddress bind_ip, java.util.Map<java.lang.String,java.lang.Object> properties) throws TrackerException
- Specified by:
createWebContext
in interfaceTracker
- Throws:
TrackerException
-
torrentAdded
public void torrentAdded(TRHostTorrent t)
-
torrentChanged
public void torrentChanged(TRHostTorrent t)
-
torrentRemoved
public void torrentRemoved(TRHostTorrent t)
-
addListener
public void addListener(TrackerListener listener)
- Specified by:
addListener
in interfaceTracker
-
removeListener
public void removeListener(TrackerListener listener)
- Specified by:
removeListener
in interfaceTracker
-
authenticate
public boolean authenticate(java.lang.String headers, java.net.URL resource, java.lang.String user, java.lang.String password)
- Specified by:
authenticate
in interfaceTRHostAuthenticationListener
-
authenticate
public byte[] authenticate(java.net.URL resource, java.lang.String user)
- Specified by:
authenticate
in interfaceTRHostAuthenticationListener
-
addAuthenticationListener
public void addAuthenticationListener(TrackerAuthenticationListener l)
- Specified by:
addAuthenticationListener
in interfaceTrackerWebContext
-
removeAuthenticationListener
public void removeAuthenticationListener(TrackerAuthenticationListener l)
- Specified by:
removeAuthenticationListener
in interfaceTrackerWebContext
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceTrackerWebContext
- Overrides:
destroy
in classTrackerWCHelper
-
-