FileDocCategorySizeDatePackage
RPDownload.javaAPI DocAzureus 3.0.3.416920Mon Jul 30 10:17:20 BST 2007org.gudy.azureus2.pluginsimpl.remote.download

RPDownload

public class RPDownload extends RPObject implements Download
author
parg

Fields Summary
protected transient Download
delegate
public RPTorrent
torrent
public RPDownloadStats
stats
public RPDownloadAnnounceResult
announce_result
public RPDownloadScrapeResult
scrape_result
public int
position
public boolean
force_start
Constructors Summary
protected RPDownload(Download _delegate)

		super( _delegate );
			
			// torrent can be null if broken
		
		if ( delegate.getTorrent() != null ){
			
			torrent = (RPTorrent)_lookupLocal( delegate.getTorrent());
		
			if ( torrent == null ){
				
				torrent = RPTorrent.create( delegate.getTorrent());
			}
		}
		
		stats = (RPDownloadStats)_lookupLocal( delegate.getStats());
		
		if ( stats == null ){
			
			stats = RPDownloadStats.create( delegate.getStats());
		}
		
		announce_result = (RPDownloadAnnounceResult)_lookupLocal( delegate.getLastAnnounceResult());
		
		if ( announce_result == null ){
			
			announce_result = RPDownloadAnnounceResult.create( delegate.getLastAnnounceResult());
		}
		
		scrape_result = (RPDownloadScrapeResult)_lookupLocal( delegate.getLastScrapeResult());
		
		if ( scrape_result == null ){
			
			scrape_result = RPDownloadScrapeResult.create( delegate.getLastScrapeResult());
		}
	
Methods Summary
public RPReply_process(RPRequest request)

		String	method = request.getMethod();
		
		if ( method.equals( "initialize")){
			
			try{
				delegate.initialize();
				
			}catch( DownloadException e ){
				
				return( new RPReply(e));
			}
			
			return( null );
			
		}else if ( method.equals( "start")){
			
			try{
				delegate.start();
				
			}catch( DownloadException e ){
				
				return( new RPReply(e));
			}
			
			return( null );
			
		}else if ( method.equals( "restart")){
			
			try{
				delegate.restart();
				
			}catch( DownloadException e ){
				
				return( new RPReply(e));
			}
			
			return( null );
			
		}else if ( method.equals( "stop")){
			
			try{
				delegate.stop();
				
			}catch( DownloadException e ){
				
				return( new RPReply(e));
			}
			
			return( null );
			
		}else if ( method.equals( "remove")){
			
			try{
				delegate.remove();
				
			}catch( Throwable e ){
				
				return( new RPReply(e));
			}
			
			return( null );
			
		}else if ( method.equals( "setForceStart[boolean]")){
			
			boolean	b = ((Boolean)request.getParams()[0]).booleanValue();
			
			delegate.setForceStart( b );
			
			return( null );
			
		}else if ( method.equals( "setPosition[int]")){
			
			int	p = ((Integer)request.getParams()[0]).intValue();
			
			delegate.setPosition( p );
			
			return( null );
			
		}else if ( method.equals( "moveUp")){
						
			delegate.moveUp();
			
			return( null );
			
		}else if ( method.equals( "moveDown")){
			
			delegate.moveDown();
			
			return( null );
	
		}else if ( method.equals( "moveTo[int]")){
			
			int	p = ((Integer)request.getParams()[0]).intValue();
			
			delegate.setPosition( p );
			
			return( null );
			
		}else if ( method.equals( "setPriority[int]")){
			
			delegate.setPriority(((Integer)request.getParams()[0]).intValue());
			
			return( null );
			
		}else if ( method.equals( "requestTrackerAnnounce")){
			
			delegate.requestTrackerAnnounce();
			
			return( null );
		
		}else if ( method.equals( "getDiskManagerFileInfo")){
			
			DiskManagerFileInfo[] info = delegate.getDiskManagerFileInfo();
					
			RPDiskManagerFileInfo[] rp_info = new RPDiskManagerFileInfo[info.length];
			
			for (int i=0;i<rp_info.length;i++){
				
				rp_info[i] = RPDiskManagerFileInfo.create( info[i] );
			}
			
			return( new RPReply( rp_info ));
		}
		
		throw( new RPException( "Unknown method: " + method ));
	
protected void_setDelegate(java.lang.Object _delegate)

		delegate = (Download)_delegate;
		
		position	= delegate.getPosition();
		force_start	= delegate.isForceStart();
	
public java.lang.Object_setLocal()

		Object res = _fixupLocal();
		
		if ( torrent != null ){
			
			torrent._setLocal();
		}
		
		stats._setLocal();
		
		announce_result._setLocal();
		
		scrape_result._setLocal();
		
		return( res );
	
public void_setRemote(RPRequestDispatcher dispatcher)

		super._setRemote( dispatcher );
		
		if ( torrent != null ){
			
			torrent._setRemote( dispatcher );
		}
		
		stats._setRemote( dispatcher );
		
		announce_result._setRemote( dispatcher );
		
		scrape_result._setRemote( dispatcher );
	
public voidaddActivationListener(DownloadActivationListener l)

		notSupported();
	
public voidaddDownloadWillBeRemovedListener(DownloadWillBeRemovedListener l)

		notSupported();
	
public voidaddListener(DownloadListener l)

		notSupported();
	
public voidaddListener(DownloadPeerListener l)

		notSupported(l);
	
public voidaddPeerListener(DownloadPeerListener l)

		notSupported();
	
public voidaddPropertyListener(DownloadPropertyListener l)

		notSupported();
	
public voidaddTrackerListener(DownloadTrackerListener l)

		notSupported();
	
public voidaddTrackerListener(DownloadTrackerListener l, boolean immediateTrigger)

			notSupported();
		
public java.io.File[]calculateDefaultPaths(boolean for_moving)

			notSupported();
			return null;
		
public booleancanBeRemoved()

		notSupported();
		
		return( false );
	
public static org.gudy.azureus2.pluginsimpl.remote.download.RPDownloadcreate(Download _delegate)

		RPDownload	res =(RPDownload)_lookupLocal( _delegate );
		
		if ( res == null ){
			
			res = new RPDownload( _delegate );
		}
			
		return( res );
	
public DownloadActivationEventgetActivationState()

		notSupported();
		
		return( null );
	
public java.lang.StringgetAttribute(TorrentAttribute attribute)

	notSupported();
	return (null);  
  
public booleangetBooleanAttribute(TorrentAttribute ta)

notSupported(); return false;
public java.lang.StringgetCategoryName()

 		notSupported();
		return ("");
  
public longgetCreationTime()

		notSupported();
		
		return( 0 );
	
public org.gudy.azureus2.plugins.disk.DiskManagergetDiskManager()

		notSupported();
		
		return( null );
	
public org.gudy.azureus2.plugins.disk.DiskManagerFileInfo[]getDiskManagerFileInfo()

		RPDiskManagerFileInfo[] resp = (RPDiskManagerFileInfo[])_dispatcher.dispatch( 
				new RPRequest( 
						this, 
						"getDiskManagerFileInfo", 
						null)).getResponse();

		for (int i=0;i<resp.length;i++){
			
			resp[i]._setRemote( _dispatcher );
		}
		
		return( resp );
	
public byte[]getDownloadPeerId()

    return delegate.getDownloadPeerId();
  
public intgetDownloadRateLimitBytesPerSecond()

	   notSupported();
	    return 0;
  	
public java.lang.StringgetErrorStateDetails()

		notSupported();
		
		return( null );
	
public booleangetFlag(long flag)

		notSupported();
		
		return( false );
	
public intgetIndex()

		notSupported();
		
		return( 0 );
	
public intgetIntAttribute(TorrentAttribute ta)

notSupported(); return 0;
public DownloadAnnounceResultgetLastAnnounceResult()

		return( announce_result );
	
public DownloadScrapeResultgetLastScrapeResult()

		return( scrape_result );
	
public java.lang.String[]getListAttribute(TorrentAttribute attribute)

	notSupported();
	return (null);   	
  
public longgetLongAttribute(TorrentAttribute ta)

notSupported(); return 0L;
public java.util.MapgetMapAttribute(TorrentAttribute attribute)

	notSupported();
	return( null );
  
public intgetMaximumDownloadKBPerSecond()

  		notSupported();
  		
  		return(0);
  	
public java.lang.StringgetName()

		notSupported();
		return ("");
	
public org.gudy.azureus2.plugins.peers.PeerManagergetPeerManager()

		notSupported();
		
		return( null );
	
public intgetPosition()

	
		return( position );
	
public intgetPriority()

		//do nothing deprecated
	  return 0;
	
public java.lang.StringgetSavePath()

		notSupported();
		
		return( null );
	
public intgetSeedingRank()

		notSupported();
		
		return( 0 );
  
public intgetState()

		notSupported();
		
		return(0);
	
public DownloadStatsgetStats()

		return( stats );
	
public intgetSubState()

		notSupported();
		
		return(0);
	
public TorrentgetTorrent()

		return( torrent );
	
public java.lang.StringgetTorrentFileName()

 		notSupported();
		return ("");
 
public intgetUploadRateLimitBytesPerSecond()

    notSupported();
    return 0;
  
public booleanhasAttribute(TorrentAttribute ta)

notSupported(); return false;
public voidinitialize()

		try{
			_dispatcher.dispatch( new RPRequest( this, "initialize", null )).getResponse();
			
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}
	
public booleanisChecking()

 		notSupported();
 		
 		return( false );
 	
public booleanisComplete()

 		notSupported();
 		
 		return( false );
 	
public booleanisComplete(boolean b)

		notSupported();
 		
 		return( false );	
 	
public booleanisForceStart()

	
		return( force_start );
	
public booleanisInDefaultSaveDir()

notSupported(); return false;
public booleanisMessagingEnabled()

  return delegate.isMessagingEnabled();  
public booleanisPaused()

		notSupported();
		
		return( false );
	
public booleanisPersistent()

 		notSupported();
		return false;
  
public booleanisPriorityLocked()

deprecated

	  	//	Do nothing, deprecated
		
		return( false );
	
public booleanisStartStopLocked()

		notSupported();
		
		return( false );
	
public voidmoveDataFiles(java.io.File new_parent_dir)

 		notSupported();
  	
public voidmoveDataFiles(java.io.File new_parent_dir, java.lang.String new_name)

 		notSupported();
 	
public voidmoveDown()

		_dispatcher.dispatch( new RPRequest( this, "moveDown", null)).getResponse();
	
public voidmoveTo(int position)

		_dispatcher.dispatch( new RPRequest( this, "moveTo[int]", new Object[]{new Integer(position )})).getResponse();	
	
public voidmoveTorrentFile(java.io.File new_parent_dir)

 		notSupported();
  	
public voidmoveUp()

		_dispatcher.dispatch( new RPRequest( this, "moveUp", null)).getResponse();
	
public voidpause()

		notSupported();
	
public voidrecheckData()

		notSupported();
	
public voidremove()

		try{
			_dispatcher.dispatch( new RPRequest( this, "remove", null )).getResponse();
			
		}catch( RPException e ){
			
			Throwable cause = e.getCause();
			
			if ( cause instanceof DownloadException ){
				
				throw((DownloadException)cause);
			}
			
			if ( cause instanceof DownloadRemovalVetoException ){
				
				throw((DownloadRemovalVetoException)cause);
			}
			
			throw( e );
		}
	
public voidremove(boolean delete_torrent, boolean delete_data)

		notSupported();
	
public voidremoveActivationListener(DownloadActivationListener l)

		notSupported();
	
public voidremoveDownloadWillBeRemovedListener(DownloadWillBeRemovedListener l)

		notSupported();
	
public voidremoveListener(DownloadListener l)

		notSupported();
	
public voidremoveListener(DownloadPeerListener l)

		notSupported(l);
	
public voidremovePeerListener(DownloadPeerListener l)

		notSupported();
	
public voidremovePropertyListener(DownloadPropertyListener l)

		notSupported();
	
public voidremoveTrackerListener(DownloadTrackerListener l)

		notSupported();
	
public voidrenameDownload(java.lang.String new_name)

			notSupported();
		
public voidrequestTrackerAnnounce()

		_dispatcher.dispatch( new RPRequest( this, "requestTrackerAnnounce", null)).getResponse();	
 	
public voidrequestTrackerAnnounce(boolean immediate)

		notSupported();
	
public voidrequestTrackerScrape(boolean immediate)

		notSupported();
	
public voidrestart()

		try{
			_dispatcher.dispatch( new RPRequest( this, "restart", null )).getResponse();
			
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}
	
public voidresume()

		notSupported();
	
public voidsetAnnounceResult(DownloadAnnounceResult result)

		notSupported();
	
public voidsetAttribute(TorrentAttribute attribute, java.lang.String value)

  	notSupported();
  
public voidsetBooleanAttribute(TorrentAttribute ta, boolean value)

notSupported();
public voidsetCategory(java.lang.String sName)

 		notSupported();
  
public voidsetDownloadRateLimitBytesPerSecond(int max_rate_bps)

		notSupported();
  	
public voidsetFlag(long flag, boolean set)

notSupported();
public voidsetForceStart(boolean _force_start)

		force_start	= _force_start;
		
		_dispatcher.dispatch( new RPRequest( this, "setForceStart[boolean]", new Object[]{new Boolean(force_start )})).getResponse();
	
public voidsetIntAttribute(TorrentAttribute ta, int value)

notSupported();
public voidsetListAttribute(TorrentAttribute ta, java.lang.String[] value)

notSupported();
public voidsetLongAttribute(TorrentAttribute ta, long value)

notSupported();
public voidsetMapAttribute(TorrentAttribute attribute, java.util.Map value)

	  notSupported();
  
public voidsetMaximumDownloadKBPerSecond(int kb)

		notSupported();
 	
public voidsetMessagingEnabled(boolean enabled)

    delegate.setMessagingEnabled( enabled );
  
public voidsetPosition(int new_position)

		_dispatcher.dispatch( new RPRequest( this, "setPosition[int]", new Object[]{new Integer(new_position )})).getResponse();
	
public voidsetPriority(int priority)

		//Do nothing, deprecated
	
public voidsetScrapeResult(DownloadScrapeResult result)

		notSupported();
	
public voidsetSeedingRank(int rank)

			// TODO Auto-generated method stub
			
		
public voidsetSessionAuthenticator(org.gudy.azureus2.plugins.download.session.SessionAuthenticator auth)

      notSupported();  //TODO ?
    
public voidsetUploadRateLimitBytesPerSecond(int max_rate_bps)

  notSupported();  
public voidstart()

		try{
			_dispatcher.dispatch( new RPRequest( this, "start", null )).getResponse();
			
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}
	
public voidstop()

		try{
			_dispatcher.dispatch( new RPRequest( this, "stop", null )).getResponse();
			
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}
	
public voidstopAndQueue()

		notSupported();