Package org.gudy.azureus2.core3.util

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


    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

  {
    super("publish", null, "Publishing");
  }

  protected boolean performCommand(ConsoleInput ci, DownloadManager dm, List args) {
    TOTorrent torrent = dm.getTorrent();
        if (torrent != null) {
          try {
          TRHost  host = ci.azureus_core.getTrackerHost();
         
          TRHostTorrent  existing = host.getHostTorrent( torrent );
View Full Code Here

            StringBuffer sb = new StringBuffer();
            Object[] selectedDataSources = tv.getSelectedDataSources(true);
            for (Object ds : selectedDataSources) {
              if (ds instanceof DownloadManager) {
                DownloadManager dm = (DownloadManager) ds;
                TOTorrent torrent = dm.getTorrent();
                if (torrent != null) {
                  try {
                    sb.append(torrent.getHashWrapper().toBase32String());
                    sb.append('\n');
                  } catch (TOTorrentException e) {
                  }
                }
              } else if (ds instanceof DiskManagerFileInfo) {
                DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
                DownloadManager dm = fileInfo.getDownloadManager();
                TOTorrent torrent = dm.getTorrent();
                if (torrent != null) {
                  try {
                    sb.append(torrent.getHashWrapper().toBase32String());
                    sb.append(';');
                    sb.append(fileInfo.getIndex());
                    sb.append('\n');
                    onlyDMs = false;
                  } catch (TOTorrentException e) {
View Full Code Here

    String  error_title;
    String  error_detail;
   
    try{
   
      TOTorrent  torrent;
     
      try{
       
        torrent = TOTorrentFactory.deserialiseFromBEncodedFile( input_file );
 
        try{
         
          torrent.serialiseToXMLFile( output_file );
         
          return( true );
               
        }catch( TOTorrentException e ){
       
View Full Code Here

  }

  private TorrentInfo addTorrent(String sFileName,
      final String sOriginatingLocation) {
    TorrentInfo info = null;
    TOTorrent torrent = null;
    File torrentFile;
    boolean bDeleteFileOnCancel = false;

    // Make a copy if user wants that.  We'll delete it when we cancel, if we
    // actually made a copy.
    try {
      if (sFileName.startsWith("file://localhost/")) {
        sFileName = UrlUtils.decode(sFileName.substring(16));
      }

      final File fOriginal = new File(sFileName);

      if (!fOriginal.isFile() || !fOriginal.exists()) {
        Utils.execSWTThread(new AERunnable() {
          public void runSupport() {
            if (shell == null)
              new MessageSlideShell(Display.getCurrent(), SWT.ICON_ERROR,
                  "OpenTorrentWindow.mb.openError", fOriginal.toString(), new String[] {
                    UrlUtils.decode(sOriginatingLocation),
                    "Not a File"
                  }, -1 );
            else {
              MessageBoxShell mb = new MessageBoxShell(SWT.OK,
                  "OpenTorrentWindow.mb.openError", new String[] {
                    sOriginatingLocation,
                    "Not a File"
                  });
              mb.open(null);
            }
          }
        });
        return null;
      }

      if (fOriginal.length() > 20*1024*1024) {
        Utils.execSWTThread(new AERunnable() {
          public void runSupport() {
            if (shell == null)
              new MessageSlideShell(Display.getCurrent(), SWT.ICON_ERROR,
                  "OpenTorrentWindow.mb.openError", fOriginal.toString(), new String[] {
                    UrlUtils.decode(sOriginatingLocation),
                    "Too large to be a torrent"
                  }, -1 );
            else {
              MessageBoxShell mb = new MessageBoxShell(SWT.OK,
                  "OpenTorrentWindow.mb.openError", new String[] {
                    sOriginatingLocation,
                    "Too large to be a torrent"
                  });
              mb.open(null);
            }
          }
        });
        return null;
      }

      torrentFile = TorrentUtils.copyTorrentFileToSaveDir(fOriginal, true);
      bDeleteFileOnCancel = !fOriginal.equals(torrentFile);
      // TODO if the files are still equal, and it isn't in the save
      //       dir, we should copy it to a temp file in case something
      //       re-writes it.  No need to copy a torrent coming from the
      //       downloader though..
    } catch (IOException e1) {
      // Use torrent in wherever it is and hope for the best
      // XXX Should error instead?
      torrentFile = new File(sFileName);
    }

    VuzeFileHandler vfh = VuzeFileHandler.getSingleton();
   
    VuzeFile vf = vfh.loadVuzeFile( torrentFile );
   
    if ( vf != null ){
     
        vfh.handleFiles( new VuzeFile[]{ vf }, VuzeFileComponent.COMP_TYPE_NONE );

        return null;
    }
   
    // Do a quick check to see if it's a torrent
    if (!TorrentUtil.isFileTorrent(torrentFile, shellForChildren,
        torrentFile.getName())) {
      if (bDeleteFileOnCancel) {
        torrentFile.delete();
      }
      return null;
    }

    // Load up the torrent, see it it's real
    try {
      torrent = TorrentUtils.readFromFile(torrentFile, false);
    } catch (final TOTorrentException e) {
     
      Utils.execSWTThread(new AERunnable() {
        public void runSupport() {
          if (shell == null)
            new MessageSlideShell(Display.getCurrent(), SWT.ICON_ERROR,
                "OpenTorrentWindow.mb.openError", Debug.getStackTrace(e),
                new String[] {
                  sOriginatingLocation,
                  e.getMessage()
                }, -1 );
          else {
            MessageBoxShell mb = new MessageBoxShell(SWT.OK,
                "OpenTorrentWindow.mb.openError", new String[] {
                  sOriginatingLocation,
                  e.getMessage()
                });
            mb.open(null);
          }
        }
      });

      if (bDeleteFileOnCancel)
        torrentFile.delete();

      return null;
    }

    String sExistingName = null;
    try {
      HashWrapper hash = torrent.getHashWrapper();
      if (hash != null) {
        for (int i = 0; i < torrentList.size(); i++) {
          try {
            TorrentInfo existing = (TorrentInfo) torrentList.get(i);
            if (existing.torrent.getHashWrapper().equals(hash)) {
View Full Code Here

  protected boolean performCommand(ConsoleInput ci, DownloadManager dm, List args) {
    TOTorrent torrent = dm.getTorrent();
        if (torrent != null) {
          try {
          TRHost  host = ci.azureus_core.getTrackerHost();
         
          TRHostTorrent  existing = host.getHostTorrent( torrent );
         
          if ( existing == null ){
           
            host.publishTorrent(torrent);
          }else{
            try{
              existing.remove();
             
            }catch( Throwable e ){
View Full Code Here

    TOTorrent torrent = dm.getTorrent();
        if (torrent != null) {
          try {
          TRHost  host = ci.azureus_core.getTrackerHost();
         
          TRHostTorrent  existing = host.getHostTorrent( torrent );
         
          if ( existing == null ){
           
            host.publishTorrent(torrent);
          }else{
            try{
              existing.remove();
             
            }catch( Throwable e ){
             
              e.printStackTrace();
            }
View Full Code Here

TOP

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

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.