FileDocCategorySizeDatePackage
TRTrackerAnnouncerResponseImpl.javaAPI DocAzureus 3.0.3.44340Mon Feb 26 09:01:14 GMT 2007org.gudy.azureus2.core3.tracker.client.impl

TRTrackerAnnouncerResponseImpl

public class TRTrackerAnnouncerResponseImpl extends Object implements TRTrackerAnnouncerResponse

Fields Summary
private URL
url
private org.gudy.azureus2.core3.util.HashWrapper
hash
private int
status
private long
time_to_wait
private String
failure_reason
private int
scrape_complete
private int
scrape_incomplete
protected TRTrackerAnnouncerResponsePeer[]
peers
protected Map
extensions
Constructors Summary
public TRTrackerAnnouncerResponseImpl(URL _url, org.gudy.azureus2.core3.util.HashWrapper _hash, int _status, long _time_to_wait)

	
	
	
					
			
					
				  
	
		url				= _url;
		hash			= _hash;
		status			= _status;	
		time_to_wait	= _time_to_wait;
	
public TRTrackerAnnouncerResponseImpl(URL _url, org.gudy.azureus2.core3.util.HashWrapper _hash, int _status, long _time_to_wait, String _failure_reason)

		url				= _url;
		hash			= _hash;
		status			= _status;	
		time_to_wait	= _time_to_wait;
		failure_reason	= _failure_reason;
	
public TRTrackerAnnouncerResponseImpl(URL _url, org.gudy.azureus2.core3.util.HashWrapper _hash, int _status, long _time_to_wait, TRTrackerAnnouncerResponsePeer[] _peers)

		url				= _url;
		hash			= _hash;
		status			= _status;	
		time_to_wait	= _time_to_wait;
		peers			= _peers;
	
Methods Summary
public java.lang.StringgetAdditionalInfo()

		return( failure_reason );
	
public java.util.MapgetExtensions()

		return( extensions );
	
public org.gudy.azureus2.core3.util.HashWrappergetHash()

		return( hash );
	
public TRTrackerAnnouncerResponsePeer[]getPeers()

		return( peers );
	
public intgetScrapeCompleteCount()

		return( scrape_complete );
	
public intgetScrapeIncompleteCount()

		return( scrape_incomplete );
	
public intgetStatus()

		return( status );
	
public java.lang.StringgetStatusString()

		String	str = "";
		
		if ( status == ST_OFFLINE ){
		
			str = "Offline";
			
		}else if  (status == ST_ONLINE ){
			
			str = "OK";
		}else{
			
			str = "Failed";
		}
		
		if ( failure_reason != null && failure_reason.length() > 0 ){
			
			str += " - " + failure_reason;
		}
		
		return( str );
	
public java.lang.StringgetString()

		String	str = "url=" + url + ", status=" + getStatus();
		
		if ( getStatus() != ST_ONLINE ){
			
			str +=", error=" + getAdditionalInfo();
		}
		
		str += ", time_to_wait=" + time_to_wait;
		
		str += ", scrape_comp=" + scrape_complete + ", scrape_incomp=" + scrape_incomplete;
		
		return( str );
	
public longgetTimeToWait()

		return( time_to_wait );
	
public java.net.URLgetURL()

		return( url );
	
public voidprint()

		System.out.println( "TRTrackerResponse::print");
		System.out.println( "\tstatus = " + getStatus());
		System.out.println( "\tfail msg = " + getAdditionalInfo());
		System.out.println( "\tpeers:" );
		
		if ( peers != null ){
					
			for (int i=0;i<peers.length;i++){
				
				TRTrackerAnnouncerResponsePeer	peer = peers[i];
				
				System.out.println( "\t\t" + peer.getAddress() + ":" + peer.getPort());
			}
		}
	
public voidsetExtensions(java.util.Map _extensions)

		extensions = _extensions;
	
public voidsetFailurReason(java.lang.String reason)

		failure_reason = reason;
	
public voidsetPeers(TRTrackerAnnouncerResponsePeer[] _peers)

		peers	= _peers;
	
public voidsetScrapeResult(int _complete, int _incomplete)

		scrape_complete		= _complete;
		scrape_incomplete	= _incomplete;