Methods Summary |
---|
public RPReply | _process(RPRequest request)
String method = request.getMethod();
Object[] params = request.getParams();
if ( method.equals( "getDownloads")){
Download[] downloads = delegate.getDownloads();
// unfortunately downloads with broken torrents can exist and have no associated
// Torrent. Easiest fix here is to filter them out.
RPDownload[] res = new RPDownload[downloads.length];
for (int i=0;i<res.length;i++){
res[i] = RPDownload.create( downloads[i]);
}
return( new RPReply( res ));
}else if ( method.equals( "getDownloads[boolean]")){
Download[] downloads = delegate.getDownloads(((Boolean)request.getParams()[0]).booleanValue());
RPDownload[] res = new RPDownload[downloads.length];
for (int i=0;i<res.length;i++){
res[i] = RPDownload.create( downloads[i]);
}
return( new RPReply( res ));
}else if ( method.equals( "addDownload[Torrent]" )){
try{
RPTorrent torrent = (RPTorrent)request.getParams()[0];
Download res = delegate.addDownload((Torrent)torrent._setLocal());
return( new RPReply( RPDownload.create(res)));
}catch( DownloadException e ){
throw( new RPException("DownloadManager::addDownload failed", e ));
}
}else if ( method.equals( "addDownload[Torrent,String,String]" )){
try{
RPTorrent torrent = (RPTorrent)request.getParams()[0];
File f1 = params[1]==null?null:new File((String)params[1]);
File f2 = params[2]==null?null:new File((String)params[2]);
Download res = delegate.addDownload((Torrent)torrent._setLocal(), f1, f2 );
return( new RPReply( RPDownload.create(res)));
}catch( DownloadException e ){
throw( new RPException("DownloadManager::addDownload failed", e ));
}
}else if ( method.equals( "addDownload[URL]" )){
try{
delegate.addDownload((URL)request.getParams()[0]);
}catch( DownloadException e ){
throw( new RPException("DownloadManager::addDownload failed", e ));
}
return( new RPReply( null ));
}else if ( method.equals( "pauseDownloads")){
delegate.pauseDownloads();
return( null );
}else if ( method.equals( "resumeDownloads")){
delegate.resumeDownloads();
return( null );
}else if ( method.equals( "stopAllDownloads")){
delegate.stopAllDownloads();
return( null );
}else if ( method.equals( "startAllDownloads")){
delegate.startAllDownloads();
return( null );
}
throw( new RPException( "Unknown method: " + method ));
|
protected void | _setDelegate(java.lang.Object _delegate)
delegate = (DownloadManager)_delegate;
|
public java.lang.Object | _setLocal()
return( _fixupLocal());
|
public Download | addDownload(Torrent torrent)
try{
RPDownload res = (RPDownload)_dispatcher.dispatch( new RPRequest( this, "addDownload[Torrent]", new Object[]{torrent})).getResponse();
res._setRemote( _dispatcher );
return( res );
}catch( RPException e ){
if ( e.getCause() instanceof DownloadException ){
throw((DownloadException)e.getCause());
}
throw( e );
}
|
public Download | addDownload(Torrent torrent, java.io.File torrent_location, java.io.File data_location)
try{
RPDownload res = (RPDownload)_dispatcher.dispatch(
new RPRequest( this, "addDownload[Torrent,String,String]",
new Object[]{
torrent,
torrent_location==null?null:torrent_location.toString(),
data_location==null?null:data_location.toString(),
})).getResponse();
res._setRemote( _dispatcher );
return( res );
}catch( RPException e ){
if ( e.getCause() instanceof DownloadException ){
throw((DownloadException)e.getCause());
}
throw( e );
}
|
public void | addDownload(java.io.File torrent_file)
notSupported();
|
public void | addDownload(java.net.URL url, java.net.URL referer)
notSupported();
|
public void | addDownload(java.net.URL url)
_dispatcher.dispatch( new RPRequest( this, "addDownload[URL]", new Object[]{url} )).getResponse();
|
public void | addDownload(java.net.URL url, boolean auto_download)
notSupported();
|
public Download | addDownloadStopped(Torrent torrent, java.io.File torrent_location, java.io.File data_location)
notSupported();
return( null );
|
public void | addDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)
notSupported();
|
public void | addListener(DownloadManagerListener l)
notSupported();
|
public void | addListener(DownloadManagerListener l, boolean notify)
notSupported();
|
public Download | addNonPersistentDownload(Torrent torrent, java.io.File torrent_location, java.io.File data_location)
notSupported();
return( null );
|
public boolean | canPauseDownloads()
notSupported();
return false;
|
public boolean | canResumeDownloads()
notSupported();
return false;
|
public static org.gudy.azureus2.pluginsimpl.remote.download.RPDownloadManager | create(DownloadManager _delegate)
RPDownloadManager res =(RPDownloadManager)_lookupLocal( _delegate );
if ( res == null ){
res = new RPDownloadManager( _delegate );
}
return( res );
|
public Download | getDownload(Torrent torrent)
notSupported();
return( null );
|
public Download | getDownload(byte[] hash)
notSupported();
return( null );
|
public Download[] | getDownloads()
RPDownload[] res = (RPDownload[])_dispatcher.dispatch( new RPRequest( this, "getDownloads", null )).getResponse();
for (int i=0;i<res.length;i++){
res[i]._setRemote( _dispatcher );
}
return( res );
|
public Download[] | getDownloads(boolean bSort)
RPDownload[] res = (RPDownload[])_dispatcher.dispatch( new RPRequest( this, "getDownloads[boolean]", new Object[]{ new Boolean(bSort)} )).getResponse();
for (int i=0;i<res.length;i++){
res[i]._setRemote( _dispatcher );
}
return( res );
|
public DownloadEventNotifier | getGlobalDownloadEventNotifier()
notSupported();
return null;
|
public DownloadManagerStats | getStats()
notSupported();
return( null );
|
public boolean | isSeedingOnly()
notSupported();
return( false );
|
public void | pauseDownloads()
_dispatcher.dispatch( new RPRequest( this, "pauseDownloads", null )).getResponse();
|
public void | removeDownloadWillBeAddedListener(DownloadWillBeAddedListener listener)
notSupported();
|
public void | removeListener(DownloadManagerListener l)
notSupported();
|
public void | removeListener(DownloadManagerListener l, boolean notify)
notSupported();
|
public void | resumeDownloads()
_dispatcher.dispatch( new RPRequest( this, "resumeDownloads", null )).getResponse();
|
public void | startAllDownloads()
_dispatcher.dispatch( new RPRequest( this, "startAllDownloads", null )).getResponse();
|
public void | stopAllDownloads()
_dispatcher.dispatch( new RPRequest( this, "stopAllDownloads", null )).getResponse();
|