Package org.gudy.azureus2.core3.util

Examples of org.gudy.azureus2.core3.util.SHA1


    // UL/DL Status Sections
    if (AzureusCoreFactory.isCoreRunning()) {
      AzureusCore core = AzureusCoreFactory.getSingleton();
      GlobalManager gm = core.getGlobalManager();
      GlobalManagerStats stats = gm.getStats();

      int dl_limit = NetworkManager.getMaxDownloadRateBPS() / 1024;
      long rec_data = stats.getDataReceiveRate();
      long rec_prot = stats.getProtocolReceiveRate();
     
      if (last_dl_limit != dl_limit || last_rec_data != rec_data || last_rec_prot != rec_prot) {
        last_dl_limit = dl_limit;
        last_rec_data = rec_data;
        last_rec_prot = rec_prot;

        statusDown.setText((dl_limit == 0 ? "" : "[" + dl_limit + "K] ")
            + DisplayFormatters.formatDataProtByteCountToKiBEtcPerSec(rec_data, rec_prot));
      }
     
      boolean auto_up = TransferSpeedValidator.isAutoSpeedActive(gm)
          && TransferSpeedValidator.isAutoUploadAvailable(core);

      int ul_limit_norm = NetworkManager.getMaxUploadRateBPSNormal() / 1024;

      String seeding_only;
      if (NetworkManager.isSeedingOnlyUploadRate()) {
        int ul_limit_seed = NetworkManager.getMaxUploadRateBPSSeedingOnly() / 1024;
        if (ul_limit_seed == 0) {
          seeding_only = "+" + Constants.INFINITY_STRING + "K";
        } else {
          int diff = ul_limit_seed - ul_limit_norm;
          seeding_only = (diff >= 0 ? "+" : "") + diff + "K";
        }
      } else {
        seeding_only = "";
      }

      int sent_data = stats.getDataSendRate();
      if (imgRec != null && !imgRec.isDisposed()) {
        updateGraph(statusDown, imgRec, rec_data, max_rec);
        updateGraph(statusUp, imgSent, sent_data, max_sent);
      }


      statusUp.setText((ul_limit_norm == 0 ? "" : "[" + ul_limit_norm + "K"
          + seeding_only + "]")
          + (auto_up ? "* " : " ")
          + DisplayFormatters.formatDataProtByteCountToKiBEtcPerSec(
              sent_data, stats.getProtocolSendRate()));
    }
  }
View Full Code Here


 
        crypto_available  = true;
       
      }catch( Throwable e ){
       
        Logger.log(new LogAlert(LogAlert.UNREPEATABLE,
            "Unable to initialise cryptographic framework for magnet-based "
                + "torrent downloads, please re-install Java", e));
      }
    }
   
View Full Code Here

          try{
            SESecurityManager.createSelfSignedCertificate( alias, dn, strength );
           
            close(true );
           
            Logger.log(new LogAlert(LogAlert.UNREPEATABLE,
                LogAlert.AT_INFORMATION, MessageText
                    .getString("security.certcreate.createok")
                    + "\n" + alias + ":" + strength + "\n"
                    + dn + "\n" + SystemTime.getCurrentTime()));
           
          }catch( Throwable f ){
           
            Logger.log(new LogAlert(LogAlert.UNREPEATABLE, MessageText
                .getString("security.certcreate.createfail")
                + "\n" + SystemTime.getCurrentTime(), f));
          }
        }
      });
View Full Code Here

      try{
        ((ShareResource)shares[i]).delete();
       
      }catch( Throwable e ){
       
        Logger.log(new LogAlert(shares[i], false,
            "{globalmanager.download.remove.veto}", e));
      }
    }
  }
View Full Code Here

 
  protected void requestRecheck()
  {
    if (Logger.isEnabled()){
      Logger.log(new LogEvent(LOGID, "UpdateMonitor: recheck requested" ));
    }
   
    performCheck( false, true, true, null );
  }
View Full Code Here

    if ( isRecheck ){
     
      if ( last_recheck_time > now || now - last_recheck_time < 23*60*60*1000 ){
       
        if (Logger.isEnabled())
          Logger.log(new LogEvent(LOGID,
              "skipping recheck as consecutive recheck too soon"));

        return;
      }
     
      last_recheck_time = now;
     
    }else{
     
      last_recheck_time  = 0;
    }
   
    if (SystemProperties.isJavaWebStartInstance()) {

      // just in case we get here somehome!
      if (Logger.isEnabled())
        Logger.log(new LogEvent(LOGID,
            "skipping update check as java web start"));

      return;
    }

View Full Code Here

             
              pw.close();
             
              final String  info = sw.toString();
             
              Logger.log( new LogEvent(LOGID, "Network Info:\n" + info));

              Utils.execSWTThread(
                new Runnable()
                {
                  public void
                  run()
                  {
                    ClipboardCopy.copyToClipBoard( info );
                  }
                });
            }
          }.start();
        }
      });
   
  // stats
 
  Label generate_stats_info = new Label(gLogging, SWT.NULL);
  Messages.setLanguageText(generate_stats_info, CFG_PREFIX + "statsinfo");

  Button generate_stats_button = new Button(gLogging, SWT.PUSH);
  Messages.setLanguageText(generate_stats_button, CFG_PREFIX + "generatediagnostics");

 
  generate_stats_button.addListener(
      SWT.Selection,
      new Listener()
      {
        public void
        handleEvent(Event event)
        {
          java.util.Set  types = new HashSet();
         
          types.add( AzureusCoreStats.ST_ALL );
         
          Map  reply = AzureusCoreStats.getStats( types );
         
          Iterator  it = reply.entrySet().iterator();
         
          StringBuffer buffer = new StringBuffer(16000);
         
          while( it.hasNext()){
           
            Map.Entry  entry = (Map.Entry)it.next();
           
            buffer.append( entry.getKey() + " -> " + entry.getValue() + "\r\n" );
          }
         
          String  str = buffer.toString();
         
          ClipboardCopy.copyToClipBoard( str );

          Logger.log( new LogEvent(LOGID, "Stats Info:\n" + str));
        }
      });

        // diagnostics

   
  Label generate_info = new Label(gLogging, SWT.NULL);

  Messages.setLanguageText(generate_info, CFG_PREFIX + "generatediagnostics.info");

  Button generate_button = new Button(gLogging, SWT.PUSH);

  Messages.setLanguageText(generate_button, CFG_PREFIX + "generatediagnostics");

  generate_button.addListener(
      SWT.Selection,
      new Listener()
      {
        public void
        handleEvent(Event event)
        {
          StringWriter sw = new StringWriter();
         
          PrintWriter  pw = new PrintWriter( sw );
         
          AEDiagnostics.generateEvidence( pw );
         
          pw.close();
         
          String  evidence = sw.toString();
         
          ClipboardCopy.copyToClipBoard( evidence );

          Logger.log( new LogEvent(LOGID, "Evidence Generation:\n" + evidence));
        }
      });
 
  if ( false ){
    Button test_button = new Button(gLogging, SWT.PUSH);
View Full Code Here

              }
            }
          });
        } else {
          if (Logger.isEnabled())
            Logger.log(new LogEvent(LOGID, LogEvent.LT_WARNING,
                "UpdateMonitor: user dialog already "
                    + "in progress, updates skipped"));
        }

      }
    } else {
      if (Logger.isEnabled())
        Logger.log(new LogEvent(LOGID, "UpdateMonitor: check instance "
            + "resulted in no user-actionable updates"));

    }
  }
View Full Code Here

          }
        });
      }

    } catch (Throwable t) {
      Logger.log(new LogEvent(LOGID, "failed to init drag-n-drop", t));
    }
  }
View Full Code Here

            if (item != null)
              item.setExpanded(!item.getExpanded());
        }
      });
    } catch (Exception e) {
      Logger.log(new LogEvent(LOGID, "Error initializing ConfigView", e));
    }

    scResizeListener = new Listener() {
      public void handleEvent(Event event) {
        setupSC((ScrolledComposite)event.widget);
      }
    };


    // Add sections
    /** How to add a new section
     * 1) Create a new implementation of ConfigSectionSWT in a new file
     *    (Use the ConfigSectionTMP.java as a template if it's still around)
     * 2) import it into here
     * 3) add it to the internal sections list
     */
    pluginSections = ConfigSectionRepository.getInstance().getList();

    ConfigSection[] internalSections = {
                                         new ConfigSectionMode(),
                                         new ConfigSectionStartShutdown(),
                                         new ConfigSectionConnection(),
                                         new ConfigSectionConnectionProxy(),
                                         new ConfigSectionConnectionAdvanced(),
                                         new ConfigSectionConnectionEncryption(),
                                         new ConfigSectionTransfer(),
                                         new ConfigSectionTransferAutoSpeedSelect(),
                                         new ConfigSectionTransferAutoSpeed(),
                                         new ConfigSectionTransferAutoSpeedBeta(),
                                         new ConfigSectionTransferLAN(),
                                         new ConfigSectionFile(),
                                         new ConfigSectionFileMove(),
                                         new ConfigSectionFileTorrents(),
                                         new ConfigSectionFileTorrentsDecoding(),
                                         new ConfigSectionFilePerformance(),
                                         new ConfigSectionInterface(),
                                         new ConfigSectionInterfaceLanguage(),
                                         new ConfigSectionInterfaceStart(),
                                         new ConfigSectionInterfaceDisplay(),
                                         new ConfigSectionInterfaceTables(),
                                         new ConfigSectionInterfaceColor(),
                                         new ConfigSectionInterfaceAlerts(),
                                         new ConfigSectionInterfacePassword(),
                                         new ConfigSectionInterfaceLegacy(),
                                         new ConfigSectionIPFilter(),
                                         new ConfigSectionPlugins(this),
                                         new ConfigSectionStats(),
                                         new ConfigSectionTracker(),
                                         new ConfigSectionTrackerClient(),
                                         new ConfigSectionTrackerServer(),
                                         new ConfigSectionSecurity(),
                                         new ConfigSectionSharing(),
                                         new ConfigSectionLogging()
                                        };
   
    pluginSections.addAll(0, Arrays.asList(internalSections));

    for (int i = 0; i < pluginSections.size(); i++) {
  
      // slip the non-standard "plugins" initialisation inbetween the internal ones
      // and the plugin ones so plugin ones can be children of it
     
      boolean  plugin_section = i >= internalSections.length;
     
      ConfigSection section = pluginSections.get(i);
     
      if (section instanceof ConfigSectionSWT || section instanceof UISWTConfigSection ) {
        String name;
        try {
          name = section.configSectionGetName();
         } catch (Exception e) {
           Logger.log(new LogEvent(LOGID, "A ConfigSection plugin caused an "
              + "error while trying to call its "
              + "configSectionGetName function", e));
          name = "Bad Plugin";
        }

         String  section_key = name;
        
         if ( plugin_section ){
             // if resource exists without prefix then use it as plugins don't
             // need to start with the prefix
          
           if ( !MessageText.keyExists(section_key)){
            
             section_key = sSectionPrefix + name;
           }
          
         }else{
          
           section_key = sSectionPrefix + name;
         }
        
         String  section_name = MessageText.getString( section_key );
        
         try {
          TreeItem treeItem;
          String location = section.configSectionGetParentSection();
 
          if ( location.length() == 0 || location.equalsIgnoreCase(ConfigSection.SECTION_ROOT)){
            //int position = findInsertPointFor(section_name, tree);
            //if ( position == -1 ){
              treeItem = new TreeItem(tree, SWT.NULL);
            // }else{
            //    treeItem = new TreeItem(tree, SWT.NULL, position);
            //}
         }else{
            TreeItem treeItemFound = findTreeItem(tree, location);
            if (treeItemFound != null){
              if (location.equalsIgnoreCase(ConfigSection.SECTION_PLUGINS)) {
                // Force ordering by name here.
                int position = findInsertPointFor(section_name, treeItemFound);
                if (position == -1) {
                  treeItem = new TreeItem(treeItemFound, SWT.NULL);
                }
                else {
                  treeItem = new TreeItem(treeItemFound, SWT.NULL, position);
                }
              }
              else {
                treeItem = new TreeItem(treeItemFound, SWT.NULL);
              }
            }else{
              treeItem = new TreeItem(tree, SWT.NULL);
            }
          }
 
          ScrolledComposite sc = new ScrolledComposite(cConfigSection, SWT.H_SCROLL | SWT.V_SCROLL);
          sc.setExpandHorizontal(true);
          sc.setExpandVertical(true);
          sc.setLayoutData(new GridData(GridData.FILL_BOTH));
          sc.getVerticalBar().setIncrement(16);
          sc.addListener(SWT.Resize, scResizeListener);
         
          if(i == 0) {
            Composite c;
            if ( section instanceof ConfigSectionSWT ){
             
              c = ((ConfigSectionSWT)section).configSectionCreate(sc);
             
            }else{
  
                c = ((UISWTConfigSection)section).configSectionCreate(sc);
            }
            sectionsCreated.add(section);
            sc.setContent(c);
          }
         
          Messages.setLanguageText(treeItem, section_key);
          treeItem.setData("Panel", sc);
          treeItem.setData("ID", name);
          treeItem.setData("ConfigSectionSWT", section);
         
          sections.put(treeItem, section);
         
          // ConfigSectionPlugins is special because it has to handle the
          // PluginConfigModel config pages
          if (section instanceof ConfigSectionPlugins)
            ((ConfigSectionPlugins)section).initPluginSubSections();
        } catch (Exception e) {
          Logger.log(new LogEvent(LOGID, "ConfigSection plugin '" + name
              + "' caused an error", e));
        }
      }
    }
   
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.util.SHA1

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.