FileDocCategorySizeDatePackage
RPShortCuts.javaAPI DocAzureus 3.0.3.45462Thu Feb 09 19:43:24 GMT 2006org.gudy.azureus2.pluginsimpl.remote.utils

RPShortCuts

public class RPShortCuts extends RPObject implements ShortCuts
author
parg

Fields Summary
protected transient ShortCuts
delegate
Constructors Summary
protected RPShortCuts(ShortCuts _delegate)

		super( _delegate );
	
Methods Summary
public RPReply_process(RPRequest request)

		String		method 	= request.getMethod();
		Object[]	params	= request.getParams();
		
		if ( method.equals( "getDownload[byte[]]")){
			
			try{
				return( new RPReply( RPDownload.create( delegate.getDownload((byte[])params[0]))));
				
			}catch( DownloadException e ){
				
				return( new RPReply(e));
			}
		}else if ( method.equals( "getDownloadStats[byte[]]")){
				
				try{
					return( new RPReply( RPDownloadStats.create( delegate.getDownloadStats((byte[])params[0]))));
					
				}catch( DownloadException e ){
					
					return( new RPReply(e));
				}
		}else if ( method.equals( "restartDownload[byte[]]")){
			
			try{
				delegate.restartDownload((byte[])params[0]);
				
			}catch( DownloadException e ){
				
				return( new RPReply(e));
			}
			
			return( null );
			
		}else if ( method.equals( "stopDownload[byte[]]")){
			
			try{
				delegate.stopDownload((byte[])params[0]);
				
			}catch( DownloadException e ){
				
				return( new RPReply(e));
			}
			
			return( null );
			
		}else if ( method.equals( "removeDownload[byte[]]")){
			
			try{
				delegate.removeDownload((byte[])params[0]);
				
			}catch( Throwable e ){
				
				return( new RPReply(e));
			}
			
			return( null );	
		}
		
		throw( new RPException( "Unknown method: " + method ));
	
protected void_setDelegate(java.lang.Object _delegate)

		delegate = (ShortCuts)_delegate;
	
public java.lang.Object_setLocal()

		Object res = _fixupLocal();
		
		return( res );
	
public void_setRemote(RPRequestDispatcher _dispatcher)

		super._setRemote( _dispatcher );
	
public static org.gudy.azureus2.pluginsimpl.remote.utils.RPShortCutscreate(ShortCuts _delegate)

		RPShortCuts	res =(RPShortCuts)_lookupLocal( _delegate );
		
		if ( res == null ){
			
			res = new RPShortCuts( _delegate );
		}
			
		return( res );
	
public DownloadgetDownload(byte[] hash)

		try{
			RPDownload	res = (RPDownload)_dispatcher.dispatch( new RPRequest( this, "getDownload[byte[]]", new Object[]{hash})).getResponse();
			
			res._setRemote( _dispatcher );
			
			return( res );
			
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}	
	
public DownloadStatsgetDownloadStats(byte[] hash)

		try{
			RPDownloadStats	res = (RPDownloadStats)_dispatcher.dispatch( new RPRequest( this, "getDownloadStats[byte[]]", new Object[]{hash})).getResponse();
			
			res._setRemote( _dispatcher );
			
			return( res );
			
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}	
	
public voidremoveDownload(byte[] hash)

		try{
			_dispatcher.dispatch( new RPRequest( this, "removeDownload[byte[]]", new Object[]{hash})).getResponse();
						
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}	
	
public voidrestartDownload(byte[] hash)

		try{
			_dispatcher.dispatch( new RPRequest( this, "restartDownload[byte[]]", new Object[]{hash})).getResponse();
						
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}	
	
public voidstopDownload(byte[] hash)

		try{
			_dispatcher.dispatch( new RPRequest( this, "stopDownload[byte[]]", new Object[]{hash})).getResponse();
						
		}catch( RPException e ){
			
			if ( e.getCause() instanceof DownloadException ){
				
				throw((DownloadException)e.getCause());
			}
			
			throw( e );
		}