Methods Summary |
---|
public void | addAuthenticationListener(TrackerAuthenticationListener l)
try{
this_mon.enter();
auth_listeners.add(l);
if ( auth_listeners.size() == 1 ){
host.addAuthenticationListener( this );
}
}finally{
this_mon.exit();
}
|
public void | addListener(TrackerListener listener)
try{
this_mon.enter();
listeners.add( listener );
TrackerTorrent[] torrents = getTorrents();
for (int i=0;i<torrents.length;i++){
listener.torrentAdded( torrents[i]);
}
}finally{
this_mon.exit();
}
|
public boolean | authenticate(java.net.URL resource, java.lang.String user, java.lang.String password)
for (int i=0;i<auth_listeners.size();i++){
try{
boolean res = ((TrackerAuthenticationListener)auth_listeners.get(i)).authenticate( resource, user, password );
if ( res ){
return(true );
}
}catch( Throwable e ){
Debug.printStackTrace( e );
}
}
return( false );
|
public byte[] | authenticate(java.net.URL resource, java.lang.String user)
for (int i=0;i<auth_listeners.size();i++){
try{
byte[] res = ((TrackerAuthenticationListener)auth_listeners.get(i)).authenticate( resource, user );
if ( res != null ){
return( res );
}
}catch( Throwable e ){
Debug.printStackTrace( e );
}
}
return( null );
|
public TrackerWebContext | createWebContext(int port, int protocol)
return( new TrackerWebContextImpl( this, null, port, protocol, null ));
|
public TrackerWebContext | createWebContext(java.lang.String name, int port, int protocol)
return( new TrackerWebContextImpl( this, name, port, protocol, null ));
|
public TrackerWebContext | createWebContext(java.lang.String name, int port, int protocol, java.net.InetAddress bind_ip)
return( new TrackerWebContextImpl( this, name, port, protocol, bind_ip ));
|
public void | destroy()
super.destroy();
auth_listeners.clear();
host.removeAuthenticationListener( this );
listeners.clear();
host.close();
|
public java.lang.String | getName()
return( host.getName());
|
public static Tracker | getSingleton()
try{
class_mon.enter();
if ( singleton == null ){
singleton = new TrackerImpl( TRHostFactory.getSingleton());
}
return( singleton );
}finally{
class_mon.exit();
}
|
public TrackerTorrent | getTorrent(Torrent torrent)
TRHostTorrent ht = host.getHostTorrent(((TorrentImpl)torrent).getTorrent());
if ( ht == null ){
return( null );
}
return( new TrackerTorrentImpl( ht ));
|
public TrackerTorrent[] | getTorrents()
TRHostTorrent[] hts = host.getTorrents();
TrackerTorrent[] res = new TrackerTorrent[hts.length];
for (int i=0;i<hts.length;i++){
res[i] = new TrackerTorrentImpl(hts[i]);
}
return( res );
|
public java.net.URL[] | getURLs()
URL[][] url_sets = TRTrackerUtils.getAnnounceURLs();
URL[] res = new URL[url_sets.length];
for (int i=0;i<res.length;i++){
res[i] = url_sets[i][0];
}
return( res );
|
public TrackerTorrent | host(Torrent _torrent, boolean _persistent)
return( host( _torrent, _persistent, false ));
|
public TrackerTorrent | host(Torrent _torrent, boolean _persistent, boolean _passive)
TorrentImpl torrent = (TorrentImpl)_torrent;
try{
return( new TrackerTorrentImpl( host.hostTorrent( torrent.getTorrent(), _persistent, _passive )));
}catch( Throwable e ){
throw( new TrackerException( "Tracker: host operation fails", e ));
}
|
public TrackerTorrent | publish(Torrent _torrent)
TorrentImpl torrent = (TorrentImpl)_torrent;
try{
return( new TrackerTorrentImpl( host.publishTorrent( torrent.getTorrent() )));
}catch( Throwable e ){
throw( new TrackerException( "Tracker: publish operation fails", e ));
}
|
public void | removeAuthenticationListener(TrackerAuthenticationListener l)
try{
this_mon.enter();
auth_listeners.remove(l);
if ( auth_listeners.size() == 0 ){
host.removeAuthenticationListener( this );
}
}finally{
this_mon.exit();
}
|
public void | removeListener(TrackerListener listener)
try{
this_mon.enter();
listeners.remove( listener );
}finally{
this_mon.exit();
}
|
public void | torrentAdded(TRHostTorrent t)
try{
this_mon.enter();
for (int i=0;i<listeners.size();i++){
((TrackerListener)listeners.get(i)).torrentAdded(new TrackerTorrentImpl(t));
}
}finally{
this_mon.exit();
}
|
public void | torrentChanged(TRHostTorrent t)
for (int i=0;i<listeners.size();i++){
((TrackerListener)listeners.get(i)).torrentChanged(new TrackerTorrentImpl(t));
}
|
public void | torrentRemoved(TRHostTorrent t)
try{
this_mon.enter();
for (int i=0;i<listeners.size();i++){
((TrackerListener)listeners.get(i)).torrentRemoved(new TrackerTorrentImpl(t));
}
}finally{
this_mon.exit();
}
|