Package org.gudy.azureus2.plugins.download

Examples of org.gudy.azureus2.plugins.download.Download


  public class RefreshListener implements TableCellRefreshListener {
    private int iLastState;
    private int loop = 0;

    public void refresh(TableCell cell) {
      Download dm = (Download)cell.getDataSource();
      long value;
      int iState;
      if (dm == null) {
        iState = -1;
        value = 0;
      } else {
        iState = dm.getState();
        value = dm.getStats().getDownloadAverage();
      }
     
      boolean bChangeColor = (++loop % 10) == 0;

      if (cell.setSortValue(value) || !cell.isValid() || (iState != iLastState)) {
View Full Code Here


    }
   
    public static void setForceSeed(final String name){
        DownloadManager dm;
        dm = View.getPluginInterface().getDownloadManager();
        Download download[] = dm.getDownloads();
        for(int i = 0; i < download.length ; i++){
            if(download[i].getName().equalsIgnoreCase(name)){
                try{
                    if(download[i].getState() == Download.ST_STOPPED){
                        download[i].setForceStart(true);
View Full Code Here

   
   
    public static void removeLastSeed(final String name){
        DownloadManager dm;
        dm = View.getPluginInterface().getDownloadManager();
        Download download[] = dm.getDownloads();
        for(int i = 0; i < download.length ; i++){
            if(download[i].getName().equalsIgnoreCase(name)){
                try{
                    if(download[i].isForceStart()){
                        download[i].setForceStart(false);
View Full Code Here

               
                throw( new IOException( "Failed to deserialise torrent file: " + Debug.getNestedExceptionMessage(e)));
              }
             
              try{
                Download download = addTorrent( torrent, add_stopped );
               
                response.setContentType( "text/xml; charset=UTF-8" );
               
                response.getOutputStream().write( "<h1>200: OK</h1>".getBytes());
               
View Full Code Here

  {
    synchronized( add_torrent_lock ){
     
      org.gudy.azureus2.plugins.download.DownloadManager dm = plugin_interface.getDownloadManager();
     
      Download download = dm.getDownload( torrent );
     
      if ( download == null ){
       
        if ( add_stopped ){
         
View Full Code Here

        e.printStackTrace();
       
        throw( new IOException( "torrent download failed: " + Debug.getNestedExceptionMessage( e )));
      }
     
      Download download = addTorrent( torrent, add_stopped );

      JSONObject torrent_details = new JSONObject();
     
      torrent_details.put( "id", new Long( getID( download )));
      torrent_details.put( "name", escapeXML( download.getName()));
      torrent_details.put( "hashString", ByteFormatter.encodeString( torrent.getHash()));
     
      result.put( "torrent-added", torrent_details );
     
    }else if ( method.equals( "torrent-start" )){

      checkUpdatePermissions();
     
      Object  ids = args.get( "ids" );

      List<Download>  downloads = getDownloads( ids );

      for ( Download download: downloads ){
       
        try{
          int  state = download.getState();
         
          if ( state != Download.ST_DOWNLOADING && state != Download.ST_SEEDING ){
         
            download.restart();
          }
        }catch( Throwable e ){
        }
      }
    }else if ( method.equals( "torrent-stop" )){

      checkUpdatePermissions();
     
      Object  ids = args.get( "ids" );

      List<Download>  downloads = getDownloads( ids );

      for ( Download download: downloads ){
       
        try{
          int  state = download.getState();
         
          if ( state != Download.ST_STOPPED ){
         
            download.stop();
          }
        }catch( Throwable e ){
        }
      }
    }else if ( method.equals( "torrent-verify" )){

      checkUpdatePermissions();
     
      Object  ids = args.get( "ids" );

      List<Download>  downloads = getDownloads( ids );

      for ( Download download: downloads ){
       
        try{
          int  state = download.getState();
         
          if ( state != Download.ST_STOPPED ){
         
            download.stop();
          }
         
          download.recheckData();
         
        }catch( Throwable e ){
        }
      }
    }else if ( method.equals( "torrent-remove" )){

      checkUpdatePermissions();
     
      Object  ids = args.get( "ids" );

      boolean  delete_data = getBoolean( args.get( "delete-local-data" ));
     
      List<Download>  downloads = getDownloads( ids );

      for ( Download download: downloads ){
       
        try{
          int  state = download.getState();
         
          if ( state != Download.ST_STOPPED ){
         
            download.stop();
          }
         
          if ( delete_data ){
           
            download.remove( true, true );
           
          }else{
           
            download.remove()
          }
         
          synchronized( recently_removed ){
         
            recently_removed.add( getID( download ));
          }
        }catch( Throwable e ){
        }
      }
    }else if ( method.equals( "torrent-set" )){
     
      Object  ids = args.get( "ids" );
     
      if ( ids != null && ids instanceof String && ((String)ids).equals( "recently-active" )){
       
        synchronized( recently_removed ){
         
          if ( recently_removed.size() > 0 ){
           
            List<Long> removed = new ArrayList<Long>( recently_removed );
           
            recently_removed.clear();
           
            result.put( "removed", removed );
          }
        }
      }
     
      List<Download>  downloads = getDownloads( ids );
       
      JSONArray files_unwanted   = (JSONArray)args.get( "files-unwanted" );
      JSONArray files_wanted     = (JSONArray)args.get( "files-wanted" );
      JSONArray priority_high    = (JSONArray)args.get( "priority-high" );
      JSONArray priority_normal  = (JSONArray)args.get( "priority-normal" );
      JSONArray priority_low    = (JSONArray)args.get( "priority-low" );
     
      Long  speed_limit_down  = (Long)args.get( "speedLimitDownload" );
      Long  speed_limit_up    = (Long)args.get( "speedLimitUpload" );

      Long  l_uploaded_ever    = (Long)args.get( "uploadedEver" );
      Long  l_downloaded_ever   = (Long)args.get( "downloadedEver" );

      long  uploaded_ever   = l_uploaded_ever==null?-1:l_uploaded_ever.longValue();
      long  downloaded_ever = l_downloaded_ever==null?-1:l_downloaded_ever.longValue();
         
      for ( Download download: downloads ){
       
        Torrent t = download.getTorrent();
       
        if ( t == null ){
         
          continue;
        }
       
        if ( speed_limit_down != null ){
         
          download.setDownloadRateLimitBytesPerSecond( speed_limit_down.intValue());
        }
       
        if ( speed_limit_up != null ){
         
          download.setUploadRateLimitBytesPerSecond( speed_limit_up.intValue());
        }     
       
        DownloadManager  core_download = PluginCoreUtils.unwrap( download );
                 
        DiskManagerFileInfo[] files = core_download.getDiskManagerFileInfo();
         
        if ( files_unwanted != null ){
         
          for ( int i=0;i<files_unwanted.size();i++){
           
            int  index = ((Long)files_unwanted.get( i )).intValue();
           
            if ( index >= 0 && index <= files.length ){
             
              files[index].setSkipped( true );
            }
          }
        }
       
        if ( files_wanted != null ){
         
          for ( int i=0;i<files_wanted.size();i++){
           
            int  index = ((Long)files_wanted.get( i )).intValue();
           
            if ( index >= 0 && index <= files.length ){
             
              files[index].setSkipped( false );
            }
          }
        }
       
        if ( priority_high != null ){
         
          for ( int i=0;i<priority_high.size();i++){
           
            int  index = ((Long)priority_high.get( i )).intValue();
           
            if ( index >= 0 && index <= files.length ){
             
              files[index].setPriority( 1 );
            }
          }
        }
       
        if ( priority_normal != null ){
         
          for ( int i=0;i<priority_normal.size();i++){
           
            int  index = ((Long)priority_normal.get( i )).intValue();
           
            if ( index >= 0 && index <= files.length ){
             
              files[index].setPriority( 0 );
            }
          }
        }
       
        if ( priority_low != null ){
         
          for ( int i=0;i<priority_low.size();i++){
           
            int  index = ((Long)priority_low.get( i )).intValue();
           
            if ( index >= 0 && index <= files.length ){
             
              files[index].setPriority( 0 );
            }
          }
        }
       
        if ( uploaded_ever != -1 || downloaded_ever != -1 ){
         
            // new method in 4511 B31
         
          try{
            download.getStats().resetUploadedDownloaded( uploaded_ever, downloaded_ever );
           
          }catch( Throwable e ){
          }
        }
      }
    }else if ( method.equals( "torrent-get" )){
         
      List<String>  fields = (List<String>)args.get( "fields" );
     
      if ( fields == null ){
       
        fields = new ArrayList();
      }
     
      Object  ids = args.get( "ids" );
     
      if ( ids != null && ids instanceof String && ((String)ids).equals( "recently-active" )){
       
        synchronized( recently_removed ){
         
          if ( recently_removed.size() > 0 ){
           
            List<Long> removed = new ArrayList<Long>( recently_removed );
           
            recently_removed.clear();
           
            result.put( "removed", removed );
          }
        }
      }
     
      List<Download>  downloads = getDownloads( ids );
     
      JSONArray  torrents = new JSONArray();
     
      result.put( "torrents", torrents );
     
      for ( Download download: downloads ){
       
        Torrent t = download.getTorrent();
       
        if ( t == null ){
         
          continue;
        }
       
        DownloadManager  core_download = PluginCoreUtils.unwrap( download );
       
        PEPeerManager pm = core_download.getPeerManager();
       
        DownloadStats  stats = download.getStats();
       
        JSONObject torrent = new JSONObject();
       
        torrents.add( torrent );
       
        int  peers_from_us   = 0;
        int  peers_to_us    = 0;
       
        if ( pm != null ){
         
          List<PEPeer> peers = pm.getPeers();
         
          for ( PEPeer peer: peers ){
           
            PEPeerStats pstats = peer.getStats();
           
            if ( pstats.getDataReceiveRate() > 0 ){
             
              peers_to_us++;
            }
           
            if ( pstats.getDataSendRate() > 0 ){
             
              peers_from_us++;
            }
          }
        }
       
        for ( String field: fields ){
         
          Object  value = null;
         
          if ( field.equals( "addedDate" )){
            value = new Long(core_download.getDownloadState().getLongParameter(DownloadManagerState.PARAM_DOWNLOAD_ADDED_TIME)/1000);
          }else if ( field.equals( "announceURL" )){ 
            value = t.getAnnounceURL().toExternalForm();
          }else if ( field.equals( "comment" )){ 
            value = t.getComment();
          }else if ( field.equals( "creator" )){ 
            value = t.getCreatedBy();
          }else if ( field.equals( "dateCreated" )){ 
            value = new Long( t.getCreationDate());
          }else if ( field.equals( "downloadedEver" )){
            value = new Long( stats.getDownloaded() + stats.getDiscarded() + stats.getHashFails());
          }else if ( field.equals( "error" )){
            String str = download.getErrorStateDetails();
           
              // o = none, 1=tracker warn,2=tracker error,2=other
            if ( str != null && str.length() > 0 ){
              value = new Long(3);
            }else{
              value = ZERO;
              TRTrackerAnnouncer tracker_client = core_download.getTrackerClient();
             
              if ( tracker_client != null ){
                TRTrackerAnnouncerResponse x = tracker_client.getBestAnnouncer().getLastResponse();
                if ( x != null ){
                  if ( x.getStatus() == TRTrackerAnnouncerResponse.ST_REPORTED_ERROR ){
                    value = new Long(2);
                  }
                }
              }else{
                DownloadScrapeResult x = download.getLastScrapeResult();
                if ( x != null ){
                  if ( x.getResponseType() == DownloadScrapeResult.RT_ERROR ){
                    String status = x.getStatus();
                   
                    if ( status != null && status.length() > 0 ){
                   
                      value = new Long(2);
                    }
                  }
                }
              }
            }
          }else if ( field.equals( "errorString" )){ 
            String str = download.getErrorStateDetails();
           
            if ( str != null && str.length() > 0 ){
              value = str;
            }else{
              value = "";
              TRTrackerAnnouncer tracker_client = core_download.getTrackerClient();
             
              if ( tracker_client != null ){
                TRTrackerAnnouncerResponse x = tracker_client.getBestAnnouncer().getLastResponse();
                if ( x != null ){
                  if ( x.getStatus() == TRTrackerAnnouncerResponse.ST_REPORTED_ERROR ){
                    value = x.getStatusString();
                  }
                }
              }else{
                DownloadScrapeResult x = download.getLastScrapeResult();
                if ( x != null ){
                  if ( x.getResponseType() == DownloadScrapeResult.RT_ERROR ){
                    value = x.getStatus();
                  }
                }
              }
            }
          }else if ( field.equals( "eta" )){
              // infinite -> 215784000
            long eta_secs = stats.getETASecs();
           
            eta_secs = Math.min( eta_secs, 215784000 );
           
            value = new Long( eta_secs );
          }else if ( field.equals( "hashString" )){ 
            value = ByteFormatter.encodeString( t.getHash());
          }else if ( field.equals( "haveUnchecked" )){ 
            value = ZERO;
          }else if ( field.equals( "haveValid" )){
            value = new Long( stats.getDownloaded());
          }else if ( field.equals( "id" )){   
            value = new Long( getID( download ));
          }else if ( field.equals( "trackerSeeds" )){
            DownloadScrapeResult scrape = download.getLastScrapeResult();
            value = new Long( scrape==null?0:scrape.getSeedCount());
          }else if ( field.equals( "trackerLeechers" )){
            DownloadScrapeResult scrape = download.getLastScrapeResult();
            value = new Long( scrape==null?0:scrape.getNonSeedCount());
          }else if ( field.equals( "leechers" )){ 
            if ( pm == null ){
              value = new Long(0);
            }else{
              value = new Long( pm.getNbPeers());
            }
          }else if ( field.equals( "leftUntilDone" )){ 
            value = new Long( stats.getRemaining());
          }else if ( field.equals( "name" )){ 
            value = download.getName();
          }else if ( field.equals( "peersConnected" )){ 
            if ( pm == null ){
              value = new Long(0);
            }else{
              value = new Long( pm.getNbPeers() + pm.getNbSeeds());
            }
          }else if ( field.equals( "peersGettingFromUs" )){ 
            value = new Long( peers_from_us );
          }else if ( field.equals( "peersSendingToUs" )){
            value = new Long( peers_to_us );
          }else if ( field.equals( "isPrivate" )){
            value = t.isPrivate()?TRUE:FALSE;
          }else if ( field.equals( "rateDownload" )){ 
            value = new Long( stats.getDownloadAverage());
          }else if ( field.equals( "rateUpload" )){
            value = new Long( stats.getUploadAverage());
          }else if ( field.equals( "speedLimitDownload" )){ 
            value = new Long( download.getDownloadRateLimitBytesPerSecond());
          }else if ( field.equals( "speedLimitUpload" )){
            value = new Long( download.getUploadRateLimitBytesPerSecond());
          }else if ( field.equals( "seeders" )){
            if ( pm == null ){
              value = new Long(-1);
            }else{
              value = new Long( pm.getNbSeeds());
            }
          }else if ( field.equals( "sizeWhenDone" )){ 
            value = new Long( t.getSize())// TODO: excluded DND
          }else if ( field.equals( "status" )){ 
              // 1 - waiting to verify
              // 2 - verifying
              // 4 - downloading
              // 5 - queued (incomplete)
              // 8 - seeding
              // 9 - queued (complete)
              // 16 - paused
           
            int  status_int = 7;
           
            if ( download.isPaused()){
             
              status_int = 16;
                           
            }else{
              int state = download.getState();
             
              if ( state == Download.ST_DOWNLOADING ){
               
                status_int = 4;
               
              }else if ( state == Download.ST_SEEDING ){
               
                status_int = 8;
               
              }else if ( state == Download.ST_QUEUED ){

                if ( download.isComplete()){
                 
                  status_int = 9;
                 
                }else{
                 
                  status_int = 5;
                }
              }else if ( state == Download.ST_STOPPED || state == Download.ST_STOPPING ){
               
                status_int = 16;
               
              }else if ( state == Download.ST_ERROR ){
               
                status_int = 0;
               
              }else{
               
                if ( core_download.getState() == DownloadManager.STATE_CHECKING ){
               
                  status_int = 2;
                 
                }else{
                 
                  status_int = 1;
                }
              }
            }
            value = new Long(status_int);
          }else if ( field.equals( "swarmSpeed" )){ 
            value = new Long( core_download.getStats().getTotalAveragePerPeer());
          }else if ( field.equals( "totalSize" )){
            value = new Long( t.getSize());
          }else if ( field.equals( "pieceCount" )){
            value = new Long( t.getPieceCount());
          }else if ( field.equals( "pieceSize" )){
            value = new Long( t.getPieceSize());
          }else if ( field.equals( "metadataPercentComplete" )){
            value = new Long( 100 );
          }else if ( field.equals( "uploadedEver" )){ 
            value = new Long( stats.getUploaded());
          }else if ( field.equals( "recheckProgress" )){
           
            double x = 0;
           
            if ( core_download.getState() == DownloadManager.STATE_CHECKING ){
             
              DiskManager dm = core_download.getDiskManager();
             
              if ( dm != null ){
               
                x = ((double)stats.getCompleted())/1000;
              }
            }
           
            value = new Double( x );
          }else if ( field.equals( "uploadRatio" )){
            value = new Double( ((double)stats.getShareRatio())/1000);
          }else if ( field.equals( "seedRatioLimit" )){
            value = new Double( COConfigurationManager.getFloatParameter( "Stop Ratio" ));
          }else if ( field.equals( "seedRatioMode" )){
            // 0=global,1=local,2=unlimited
            value = new Long(1);
          }else if ( field.equals( "downloadDir" )){
            value = download.getSavePath();
          }else if ( field.equals( "files" )){
           
            List<JSONObject> file_list = new ArrayList<JSONObject>();
           
            DiskManagerFileInfo[] files = core_download.getDiskManagerFileInfo();
View Full Code Here

  return (float)tmp / factor;
  }

public static void killConnectedPeers(){
  DownloadManager dm = Plugin.getPluginInterface().getDownloadManager();
  Download downloads[] = dm.getDownloads();
  if(downloads == null || downloads.length == 0) return;
  for(int i = 0; i < downloads.length ; i++){

    try{
    Peer[] peers = downloads[i].getPeerManager().getPeers();
View Full Code Here

                      try{
                        installer.install(
                          sps.toArray( new InstallablePlugin[ sps.size()]),
                          false,
                          properties,
                          new PluginInstallationListener() {
   
                            public void
                            completed()
                            {
                            }
View Full Code Here

              final String  config_key = "recommended.processed." + rp_id;
             
              if ( !plugin_config.getPluginBooleanParameter( config_key, false )){
               
                try{
                  final PluginInstaller installer = plugin_interface.getPluginManager().getPluginInstaller();
                 
                  StandardPlugin[]  sps = installer.getStandardPlugins();
                 
                  for (int j=0;j<sps.length;j++){
                   
                    final StandardPlugin  sp = sps[j];
                   
                    if ( sp.getId().equals( rp_id )){
                   
                      found_one = true;
                     
                      checker.getCheckInstance().addListener(
                        new UpdateCheckInstanceListener()
                        {
                          public void
                          cancelled(
                            UpdateCheckInstance    instance )
                          {                         
                          }
                         
                          public void
                          complete(
                            UpdateCheckInstance    instance )
                          {
                            if ( instance.getUpdates().length == 0 ){
                             
                              installRecommendedPlugin( installer, sp );
                             
                              plugin_config.setPluginParameter( config_key, true );
                            }
                          }
                        });
                     
                      break;
                    }
                  }
                 
                }catch( Throwable e ){
                 
                }
              }
             
              if ( found_one ){
               
                break;
              }
            }
           
            if ( !found_one ){
             
              Set<String>  auto_install = vc.getAutoInstallPluginIDs();
             
              final List<String>  to_do = new ArrayList<String>();
             
              for ( String pid: auto_install ){
               
                if ( plugin_manager.getPluginInterfaceByID( pid, false ) == null ){
                 
                  to_do.add( pid );
                }
              }
             
              if ( to_do.size() > 0 ){
               
                new AEThread2( "pup:autoinst" )
                {
                  public void
                  run()
                  {   
                    try{
                      Thread.sleep( 120*1000 );
                     
                    }catch( Throwable e ){
                     
                      Debug.out( e );
                     
                      return;
                    }
                   
                    UpdateManager update_manager = plugin_interface.getUpdateManager();
                   
                    final List<UpdateCheckInstance>  l_instances = new ArrayList<UpdateCheckInstance>();
                   
                    update_manager.addListener(
                      new UpdateManagerListener()
                      {
                        public void
                        checkInstanceCreated(
                          UpdateCheckInstance  instance )
                        {
                          synchronized( l_instances ){
                           
                            l_instances.add( instance );
                          }
                        }
                      });
                   
                    UpdateCheckInstance[] instances = update_manager.getCheckInstances();
                   
                    l_instances.addAll( Arrays.asList( instances ));
                   
                    long start = SystemTime.getMonotonousTime();
                   
                    while( true ){
                     
                      if ( SystemTime.getMonotonousTime() - start >= 5*60*1000 ){
                       
                        break;
                      }
                     
                      try{
                        Thread.sleep(5000);
                       
                      }catch( Throwable e ){
                       
                        Debug.out( e );
                       
                        return;
                      }
                     
                      if ( l_instances.size() > 0 ){
                     
                        boolean  all_done = true;
                       
                        for ( UpdateCheckInstance instance: l_instances ){
                         
                          if ( !instance.isCompleteOrCancelled()){
                           
                            all_done = false;
                           
                            break;
                          }
                        }
                       
                        if ( all_done ){
                         
                          break;
                        }
                      }
                    }
                   
                    if ( update_manager.getInstallers().length > 0 ){
                     
                      return;
                    }
                   
                    PluginInstaller installer = plugin_interface.getPluginManager().getPluginInstaller();
                   
                    List<InstallablePlugin>  sps = new ArrayList<InstallablePlugin>();
                   
                    for ( String pid: to_do ){
                     
                      try{
                        StandardPlugin sp = installer.getStandardPlugin( pid );
                       
                        if ( sp != null ){
                         
                          log.log( "Auto-installing " + pid );
                         
                          sps.add( sp );
                         
                        }else{
                         
                          log.log( "Standard plugin '" + pid + "' missing" );
                        }
                      }catch( Throwable e ){
                       
                        log.log( "Standard plugin '" + pid + "' missing", e );
                      }
                    } 
                    
                    if ( sps.size() > 0 ){
                     
                      Map<Integer, Object> properties = new HashMap<Integer, Object>();
                 
                      properties.put( UpdateCheckInstance.PT_UI_STYLE, UpdateCheckInstance.PT_UI_STYLE_NONE );
                       
                      properties.put(UpdateCheckInstance.PT_UI_DISABLE_ON_SUCCESS_SLIDEY, true);
 
                      try{
                        installer.install(
                          sps.toArray( new InstallablePlugin[ sps.size()]),
                          false,
                          properties,
                          new PluginInstallationListener() {
   
View Full Code Here

                 
                  StandardPlugin[]  sps = installer.getStandardPlugins();
                 
                  for (int j=0;j<sps.length;j++){
                   
                    final StandardPlugin  sp = sps[j];
                   
                    if ( sp.getId().equals( rp_id )){
                   
                      found_one = true;
                     
                      checker.getCheckInstance().addListener(
                        new UpdateCheckInstanceListener()
                        {
                          public void
                          cancelled(
                            UpdateCheckInstance    instance )
                          {                         
                          }
                         
                          public void
                          complete(
                            UpdateCheckInstance    instance )
                          {
                            if ( instance.getUpdates().length == 0 ){
                             
                              installRecommendedPlugin( installer, sp );
                             
                              plugin_config.setPluginParameter( config_key, true );
                            }
                          }
                        });
                     
                      break;
                    }
                  }
                 
                }catch( Throwable e ){
                 
                }
              }
             
              if ( found_one ){
               
                break;
              }
            }
           
            if ( !found_one ){
             
              Set<String>  auto_install = vc.getAutoInstallPluginIDs();
             
              final List<String>  to_do = new ArrayList<String>();
             
              for ( String pid: auto_install ){
               
                if ( plugin_manager.getPluginInterfaceByID( pid, false ) == null ){
                 
                  to_do.add( pid );
                }
              }
             
              if ( to_do.size() > 0 ){
               
                new AEThread2( "pup:autoinst" )
                {
                  public void
                  run()
                  {   
                    try{
                      Thread.sleep( 120*1000 );
                     
                    }catch( Throwable e ){
                     
                      Debug.out( e );
                     
                      return;
                    }
                   
                    UpdateManager update_manager = plugin_interface.getUpdateManager();
                   
                    final List<UpdateCheckInstance>  l_instances = new ArrayList<UpdateCheckInstance>();
                   
                    update_manager.addListener(
                      new UpdateManagerListener()
                      {
                        public void
                        checkInstanceCreated(
                          UpdateCheckInstance  instance )
                        {
                          synchronized( l_instances ){
                           
                            l_instances.add( instance );
                          }
                        }
                      });
                   
                    UpdateCheckInstance[] instances = update_manager.getCheckInstances();
                   
                    l_instances.addAll( Arrays.asList( instances ));
                   
                    long start = SystemTime.getMonotonousTime();
                   
                    while( true ){
                     
                      if ( SystemTime.getMonotonousTime() - start >= 5*60*1000 ){
                       
                        break;
                      }
                     
                      try{
                        Thread.sleep(5000);
                       
                      }catch( Throwable e ){
                       
                        Debug.out( e );
                       
                        return;
                      }
                     
                      if ( l_instances.size() > 0 ){
                     
                        boolean  all_done = true;
                       
                        for ( UpdateCheckInstance instance: l_instances ){
                         
                          if ( !instance.isCompleteOrCancelled()){
                           
                            all_done = false;
                           
                            break;
                          }
                        }
                       
                        if ( all_done ){
                         
                          break;
                        }
                      }
                    }
                   
                    if ( update_manager.getInstallers().length > 0 ){
                     
                      return;
                    }
                   
                    PluginInstaller installer = plugin_interface.getPluginManager().getPluginInstaller();
                   
                    List<InstallablePlugin>  sps = new ArrayList<InstallablePlugin>();
                   
                    for ( String pid: to_do ){
                     
                      try{
                        StandardPlugin sp = installer.getStandardPlugin( pid );
                       
                        if ( sp != null ){
                         
                          log.log( "Auto-installing " + pid );
                         
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.download.Download

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.