Package org.gudy.azureus2.plugins.utils.resourcedownloader

Examples of org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderFactory


                try{
                  TorrentUtils.setTLSDescription( "Subscription: " + subs.getName());

                  URL url = new URL(dl);
                                   
                  ResourceDownloaderFactory rdf = StaticUtilities.getResourceDownloaderFactory();
                 
                  ResourceDownloader url_rd = rdf.create( url );
                     
                  String referer = use_ref?subs.getReferer():null;
                 
                  UrlUtils.setBrowserHeaders( url_rd, referer );
                 
                  Engine engine = subs.getEngine();
                 
                  if ( engine instanceof WebEngine ){
                   
                    WebEngine we = (WebEngine)engine;
                   
                    if ( we.isNeedsAuth()){
                     
                      String cookies = we.getCookies();
                     
                      if ( cookies != null && cookies.length() > 0 ){
                       
                        url_rd.setProperty( "URL_Cookie", cookies );
                      }
                    }
                  }
                 
                  ResourceDownloader mr_rd = rdf.getMetaRefreshDownloader( url_rd );
   
                  InputStream is = mr_rd.download();
   
                  Torrent torrent = new TorrentImpl( TOTorrentFactory.deserialiseFromBEncodedInputStream( is ));
                           
View Full Code Here


              "&az_rand=" + Math.abs( new Random().nextLong());
   
    log( "Engine " + engine.getName() + ": auto-update check via " + update_url );
   
    try{
      ResourceDownloaderFactory rdf = StaticUtilities.getResourceDownloaderFactory();
     
      ResourceDownloader url_rd = rdf.create( new URL( update_url ));
     
      ResourceDownloader rd = rdf.getMetaRefreshDownloader( url_rd );
     
      InputStream is = rd.download();
     
      try{
        Map<String,Object> map = BDecoder.decode( new BufferedInputStream( is ));
View Full Code Here

      return( null );
    }
   
    String  url_str = ConstantsVuze.getDefaultContentNetwork().getTorrentDownloadService( Base32.encode( hash ), null );
   
    ResourceDownloaderFactory rdf = ResourceDownloaderFactoryImpl.getSingleton();
   
    try{
      ResourceDownloader rd = rdf.create( new URL( url_str ));
   
      InputStream  is = rd.download();
     
      try{   
        TOTorrent  torrent = TOTorrentFactory.deserialiseFromBEncodedInputStream( is );
View Full Code Here

    new AEThread2("getWhatsNew", true) {

      public void run() {

        String s;
        ResourceDownloaderFactory rdf = ResourceDownloaderFactoryImpl.getSingleton();
        try {
          ResourceDownloader rd = rdf.create(new URL(url));
          InputStream is = rd.download();
          int length = is.available();
          byte data[] = new byte[length];
          is.read(data);
          is.close();
View Full Code Here

              
        String[] mirrors = versionGetter.getMirrors();
       
        ResourceDownloader swtDownloader = null;
       
          ResourceDownloaderFactory factory = ResourceDownloaderFactoryImpl.getSingleton();
          List downloaders =  new ArrayList();
          for(int i = 0 ; i < mirrors.length ; i++) {
            try {
              downloaders.add(factory.getSuffixBasedDownloader(factory.create(new URL(mirrors[i]))));
            } catch(MalformedURLException e) {
              //Do nothing
              if (Logger.isEnabled())
                Logger.log(new LogEvent(LOGID, LogEvent.LT_WARNING,
                    "Cannot use URL " + mirrors[i] + " (not valid)"));
            }
          }
          ResourceDownloader[] resourceDownloaders =
            (ResourceDownloader[])
            downloaders.toArray(new ResourceDownloader[downloaders.size()]);
         
          swtDownloader = factory.getRandomDownloader(resourceDownloaders);
       
          // get the size so its cached up
       
        try{
          swtDownloader.getSize();
View Full Code Here

    boolean  record_failure = true;
   
    try{     
      TorrentUtils.setTLSDescription( "UPnP Device" + ( friendly_name==null?"":( ": " + friendly_name )));
     
      ResourceDownloaderFactory rdf = adapter.getResourceDownloaderFactory();
       
      int  retries;
     
      synchronized( failed_urls ){

        long[] fails = failed_urls.get( url_str );
       
        if ( fails == null ){
         
          retries = 3;
         
        }else{
         
          long  consec_fails   = fails[0];
          long  last_fail    = fails[1];
         
          long  max_period  = 10*60*1000;
          long  period     = 60*1000;
         
          for (int i=0;i<consec_fails;i++){
           
            period <<= 1;
           
            if ( period >= max_period ){
             
              period = max_period;
             
              break;
            }
          }
         
          if ( SystemTime.getMonotonousTime() - last_fail < period ){
           
            record_failure = false;
           
            throw( new UPnPException( "Download failed too recently, ignoring" ));
          }
         
          retries = 1;
        }
      }
     
      ResourceDownloader rd = rdf.getRetryDownloader( rdf.create( url, true ), retries );
       
      rd.addListener( this );
       
      InputStream  data = rd.download();
           
View Full Code Here

private String URLReaderRescan(final String addressIP) {
  color_status = "red";
        try {
           
          URL url_addressIP = new URL("http://" + addressIP);
                ResourceDownloaderFactory rdf = ResourceDownloaderFactoryImpl.getSingleton();
                 
                  ResourceDownloader downloader = rdf.create(
                          url_addressIP,
                          config_getter.getPluginStringParameter( "AzTrackerFind_url_user"),
                          config_getter.getPluginStringParameter( "AzTrackerFind_url_password"));
                 // downloader = rdf.getSuffixBasedDownloader( downloader);
                  downloader = rdf.getTimeoutDownloader(downloader, config_getter.getPluginIntParameter("timeout_value")*1000 );
                boolean completed = false;
                 downloader.addListener(new ResourceDownloaderAdapter() {
               
                public boolean completed(ResourceDownloader downloader, InputStream data) {
                  //On completion, process the InputStream to store temp files
View Full Code Here

    public void generic_getter(final String url, final String dir_to_save, final String filename, final PluginInterface pluginInterface, final String user, final String password){
       
        try{
       
            ResourceDownloaderFactory rdf;
            URL url_get = new URL (url);
            rdf = pluginInterface.getUtilities().getResourceDownloaderFactory();
           
           
            //normal resource downloader
            ResourceDownloader rd_t = rdf.create(url_get, user, password);
           
            rd_t = rdf.getRetryDownloader(rd_t, 3);
            rd_t = rdf.getTimeoutDownloader(rd_t,30000);
            rd_t = rdf.getSuffixBasedDownloader(rd_t);
           
            
         
         
          //Listener for rd_t (normal downloader)
View Full Code Here

          if(file_check.isFile()){
              System.out.println("Duplicate Torrent " + filename + ".torrent .. not saved");
              return;
          }
            URL url_to_get = new URL(url);
            ResourceDownloaderFactory rdf = pluginInterface.getUtilities().getResourceDownloaderFactory();
            ResourceDownloader rd_t = rdf.create(url_to_get);
            //rd_t = rdf.getRetryDownloader(rd_t, 3);
            rd_t = rdf.getTimeoutDownloader(rd_t,120000);
            rd_t = rdf.getMetaRefreshDownloader(rd_t);
            rd_t.addListener(new ResourceDownloaderListener()
            {

                public void reportPercentComplete(ResourceDownloader downloader, int percentage) {
                   
View Full Code Here

private String URLReaderRescan(final String addressIP) {
  color_status = "red";
        try {
           
          URL url_addressIP = new URL("http://" + addressIP);
                ResourceDownloaderFactory rdf = ResourceDownloaderFactoryImpl.getSingleton();
                 
                  ResourceDownloader downloader = rdf.create(url_addressIP,url_user, url_password);
                 // downloader = rdf.getSuffixBasedDownloader( downloader);
                  downloader = rdf.getTimeoutDownloader(downloader, VERSION_TIMEOUT_MILLIS );
                boolean completed = false;
                 downloader.addListener(new ResourceDownloaderAdapter() {
               
                public boolean completed(ResourceDownloader downloader, InputStream data) {
                  //On completion, process the InputStream to store temp files
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderFactory

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.