TrackerWebContextImplpublic class TrackerWebContextImpl extends TrackerWCHelper implements TRTrackerServerListener
Fields Summary |
---|
protected TRTrackerServer | server | protected List | auth_listeners |
Constructors Summary |
---|
public TrackerWebContextImpl(TrackerImpl _tracker, String name, int port, int protocol, InetAddress bind_ip)
setTracker( _tracker );
try{
if ( protocol == Tracker.PR_HTTP ){
server = TRTrackerServerFactory.create( name, TRTrackerServerFactory.PR_TCP, port, bind_ip, false, false );
}else{
server = TRTrackerServerFactory.createSSL( name, TRTrackerServerFactory.PR_TCP, port, bind_ip, false, false );
}
server.addListener( this );
}catch( TRTrackerServerException e ){
throw( new TrackerException("TRTrackerServerFactory failed", e ));
}
|
Methods Summary |
---|
public void | addAuthenticationListener(TrackerAuthenticationListener l)
try{
this_mon.enter();
auth_listeners.add(l);
if ( auth_listeners.size() == 1 ){
server.addAuthenticationListener( this );
}
}finally{
this_mon.exit();
}
| 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 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 boolean | denied(byte[] hash, boolean explicit)
return( false );
| public void | destroy()
super.destroy();
auth_listeners.clear();
server.removeAuthenticationListener( this );
server.close();
| public java.lang.String | getHostName()
return( server.getHost());
| public java.lang.String | getName()
return( server.getName());
| public int | getPort()
return( server.getPort());
| public int | getProtocol()
return( server.isSSL()?Tracker.PR_HTTPS:Tracker.PR_HTTP );
| public java.net.URL[] | getURLs()
try{
URL url = new URL((server.isSSL()?"https":"http") + "://" + server.getHost() + ":" + server.getPort() + "/" );
// quick fix for badly specified host whereby a valid URL is constructed but the port lost. For example, if#
// someone has entered http://1.2.3.4 as the host
if ( url.getPort() != server.getPort()){
Debug.out( "Invalid URL '" + url + "' - check tracker configuration" );
url = new URL( "http://i.am.invalid:" + server.getPort() + "/" );
}
return( new URL[]{ url });
}catch( MalformedURLException e ){
Debug.printStackTrace( e );
return( null );
}
| public boolean | permitted(java.lang.String originator, byte[] hash, boolean explicit)
return( false );
| public void | removeAuthenticationListener(TrackerAuthenticationListener l)
try{
this_mon.enter();
auth_listeners.remove(l);
if ( auth_listeners.size() == 0 ){
server.removeAuthenticationListener( this );
}
}finally{
this_mon.exit();
}
|
|