Package org.gudy.azureus2.core3.logging

Examples of org.gudy.azureus2.core3.logging.LogAlert


          AzureusCore          core,
          AzureusCoreComponent    comp )
          {
            if ( comp instanceof GlobalManager ){
             
              GlobalManager  gm  = (GlobalManager)comp;
             
              gm.addListener( PluginInitializer.this );
            }
          }
      });
   
    core_operation   = _core_operation;
View Full Code Here


  public static void invokeSlider(AzureusCore core, boolean isUpSpeed) {
    final String prefix = MessageText.getString(isUpSpeed
        ? "GeneralView.label.maxuploadspeed"
        : "GeneralView.label.maxdownloadspeed");

    GlobalManager gm = core.getGlobalManager();

    final String configAutoKey = TransferSpeedValidator.getActiveAutoUploadParameter(gm);
    boolean auto = COConfigurationManager.getBooleanParameter(configAutoKey);

    final String configKey = isUpSpeed
        ? TransferSpeedValidator.getActiveUploadParameter(gm)
        : "Max Download Speed KBs";
    int maxBandwidth = COConfigurationManager.getIntParameter(configKey);
    final boolean unlim = (maxBandwidth == 0);
    if (unlim && !isUpSpeed) {
      GlobalManagerStats stats = gm.getStats();
      int dataReceive = stats.getDataReceiveRate();
      if (dataReceive >= 1024) {
        maxBandwidth = dataReceive / 1024;
      }
    }
View Full Code Here

   */
  private static int adjustMaxBandWidth(int maxBandwidth,
      GlobalManager globalManager, boolean up_menu) {
    if(maxBandwidth == 0 && !up_menu )
    {
      GlobalManagerStats stats = globalManager.getStats();
      int dataReceive = stats.getDataReceiveRate();
      if (dataReceive < 1024) {
        maxBandwidth = 275;
      } else {
        maxBandwidth = dataReceive / 1024;           
      }
View Full Code Here

        ? TransferSpeedValidator.getActiveUploadParameter(gm)
        : "Max Download Speed KBs";
    int maxBandwidth = COConfigurationManager.getIntParameter(configKey);
    final boolean unlim = (maxBandwidth == 0);
    if (unlim && !isUpSpeed) {
      GlobalManagerStats stats = gm.getStats();
      int dataReceive = stats.getDataReceiveRate();
      if (dataReceive >= 1024) {
        maxBandwidth = dataReceive / 1024;
      }
    }
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

                dms[i].moveDataFiles(target);

              }
              catch (Throwable e) {

                Logger.log(new LogAlert(dms[i], LogAlert.REPEATABLE,
                    "Download data move operation failed", e));
              }
            }
          }
        }
      }
    });
    itemFileMoveData.setEnabled(fileMove);

    final MenuItem itemFileMoveTorrent = new MenuItem(menuFiles, SWT.PUSH);
    Messages.setLanguageText(itemFileMoveTorrent, "MyTorrentsView.menu.movetorrent");
    itemFileMoveTorrent.addListener(SWT.Selection, new DMTask(dms) {
      public void run(DownloadManager[] dms) {
        if (dms != null && dms.length > 0) {

          DirectoryDialog dd = new DirectoryDialog(composite.getShell());
          String filter_path = TorrentOpener.getFilterPathTorrent();
         
          // If we don't have a decent path, default to the path of the first
          // torrent.
          if (filter_path == null || filter_path.trim().length() == 0) {
            filter_path = new File(dms[0].getTorrentFileName()).getParent();
          }
         
          dd.setFilterPath(filter_path);

          dd.setText(MessageText.getString("MyTorrentsView.menu.movedata.dialog"));

          String path = dd.open();

          if (path != null) {

            File target = new File(path);

            TorrentOpener.setFilterPathTorrent(target.toString());

            for (int i = 0; i < dms.length; i++) {

              try {
                dms[i].moveTorrentFile(target);

              }
              catch (Throwable e) {

                Logger.log(new LogAlert(dms[i], LogAlert.REPEATABLE,
                    "Download torrent move operation failed", e));
              }
            }
          }
        }
      }
    });
    itemFileMoveTorrent.setEnabled(fileMove);
   
    final MenuItem itemCheckFilesExist = new MenuItem(menuFiles, SWT.PUSH);
    Messages.setLanguageText(itemCheckFilesExist, "MyTorrentsView.menu.checkfilesexist");
    itemCheckFilesExist.addListener(SWT.Selection, new DMTask(dms) {
      public void run(DownloadManager dm) {
        dm.filesExist( true );
      }
    });

    final MenuItem itemFileRescan = new MenuItem(menuFiles, SWT.CHECK);
    Messages.setLanguageText(itemFileRescan, "MyTorrentsView.menu.rescanfile");
    itemFileRescan.addListener(SWT.Selection, new DMTask(dms) {
      public void run(DownloadManager dm) {
        dm.getDownloadState().setFlag(DownloadManagerState.FLAG_SCAN_INCOMPLETE_PIECES,
            itemFileRescan.getSelection());
      }
    });
    itemFileRescan.setSelection(allScanSelected);
    itemFileRescan.setEnabled(fileRescan);

      // clear allocation
   
    MenuItem itemFileClearAlloc = new MenuItem(menuFiles, SWT.PUSH);
    Messages.setLanguageText(itemFileClearAlloc, "MyTorrentsView.menu.clear_alloc_data");
    itemFileClearAlloc.addListener(SWT.Selection, new DMTask(dms) {
      public void run(DownloadManager dm) {
        dm.setDataAlreadyAllocated( false );
      }
    });
   
    itemFileClearAlloc.setEnabled(allStopped);
   
      // clear resume
   
    MenuItem itemFileClearResume = new MenuItem(menuFiles, SWT.PUSH);
    Messages.setLanguageText(itemFileClearResume, "MyTorrentsView.menu.clear_resume_data");
    itemFileClearResume.addListener(SWT.Selection, new DMTask(dms) {
      public void run(DownloadManager dm) {
        dm.getDownloadState().clearResumeData();
      }
    });
    itemFileClearResume.setEnabled(allStopped);

    // Advanced - > Rename
    final MenuItem itemRename = new MenuItem(menuAdvanced, SWT.DROP_DOWN);
    Messages.setLanguageText(itemRename, "MyTorrentsView.menu.rename");
    itemRename.setEnabled(hasSelection);
    itemRename.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        for (DownloadManager dm : dms) {
          AdvRenameWindow window = new AdvRenameWindow();
          window.open(dm);
        }
      }
    });

    // === advanced > export ===
    // =========================

    if (userMode > 0) {
      final MenuItem itemExport = new MenuItem(menuAdvanced, SWT.CASCADE);
      Messages.setLanguageText(itemExport, "MyTorrentsView.menu.exportmenu"); //$NON-NLS-1$
      Utils.setMenuItemImage(itemExport, "export");
      itemExport.setEnabled(hasSelection);

      final Menu menuExport = new Menu(composite.getShell(), SWT.DROP_DOWN);
      itemExport.setMenu(menuExport);

      // Advanced > Export > Export XML
      final MenuItem itemExportXML = new MenuItem(menuExport, SWT.PUSH);
      Messages.setLanguageText(itemExportXML, "MyTorrentsView.menu.export");
      itemExportXML.addListener(SWT.Selection, new DMTask(dms) {
        public void run(DownloadManager[] dms) {
          DownloadManager dm = dms[0]; // First only.
          if (dm != null) new ExportTorrentWizard(itemExportXML.getDisplay(), dm);
        }
      });

      // Advanced > Export > Export Torrent
      final MenuItem itemExportTorrent = new MenuItem(menuExport, SWT.PUSH);
      Messages.setLanguageText(itemExportTorrent, "MyTorrentsView.menu.exporttorrent");
      itemExportTorrent.addListener(SWT.Selection, new DMTask(dms) {
        public void run(DownloadManager[] dms) {
          // FileDialog for single download
          // DirectoryDialog for multiple.
          File[] destinations = new File[dms.length];
          if (dms.length == 1) {
            FileDialog fd = new FileDialog(composite.getShell(), SWT.SAVE);
            fd.setFileName(dms[0].getTorrentFileName());
            String path = fd.open();
            if (path == null) {return;}
            destinations[0] = new File(path);
          }
          else {
            DirectoryDialog dd = new DirectoryDialog(composite.getShell(), SWT.SAVE);
            String path = dd.open();
            if (path == null) {return;}
            for (int i=0; i<dms.length; i++) {
              destinations[i] = new File(path, new File(dms[i].getTorrentFileName()).getName());
            }
          }
         
          int i=0;
          try {
            for (; i<dms.length; i++) {
              File target = destinations[i];
              if (target.exists()) {
                MessageBox mb = new MessageBox(composite.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
                mb.setText(MessageText.getString("exportTorrentWizard.process.outputfileexists.title"));
                mb.setMessage(MessageText.getString("exportTorrentWizard.process.outputfileexists.message") + "\n" + destinations[i].getName());

                int result = mb.open();
                if (result == SWT.NO) {return;}

                if (!target.delete()) {
                  throw (new Exception("Failed to delete file"));
                }
              } // end deal with clashing torrent

              // first copy the torrent - DON'T use "writeTorrent" as this amends the
              // "filename" field in the torrent
              TorrentUtils.copyToFile(dms[i].getDownloadState().getTorrent(), target);

              // now remove the non-standard entries
              TOTorrent dest = TOTorrentFactory.deserialiseFromBEncodedFile(target);
              dest.removeAdditionalProperties();
              dest.serialiseToBEncodedFile(target);
            } // end for
          } // end try
          catch (Throwable e) {
            Logger.log(new LogAlert(dms[i], LogAlert.UNREPEATABLE, "Torrent export failed", e));
          }
        } // end run()
      }); // end DMTask
     
      // Advanced > Export > WebSeed URL
View Full Code Here

  public void configSectionSave() {
    try{
      if (filter != null)
        filter.save();
    }catch( Exception e ){
      Logger.log(new LogAlert(LogAlert.UNREPEATABLE,
          "Save of filter file fails", e));
    }
  }
View Full Code Here

        try{
          torrent.remove();
         
        }catch( TRHostTorrentRemovalVetoException f ){
         
          Logger.log(new LogAlert(torrent, false,
              "{globalmanager.download.remove.veto}", f));
        }
      }
    });
  }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.logging.LogAlert

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.