Exemplo n.º 1
0
 public static String getMediaServerContentURL(DownloadManager dm) {
   try {
     return PlayUtils.getMediaServerContentURL(DownloadManagerImpl.getDownloadStatic(dm));
   } catch (DownloadException e) {
   }
   return null;
 }
Exemplo n.º 2
0
  public static org.gudy.azureus2.plugins.disk.DiskManagerFileInfo wrap(DiskManagerFileInfo info)
      throws DownloadException {
    if (info == null) {

      return (null);
    }

    return (new DiskManagerFileInfoImpl(
        DownloadManagerImpl.getDownloadStatic(info.getDownloadManager()), info));
  }
Exemplo n.º 3
0
  /**
   * May return NULL if download not found (e.g. has been removed)
   *
   * @param dm
   * @return may be null
   */
  public static Download wrap(org.gudy.azureus2.core3.download.DownloadManager dm) {
    try {
      return (DownloadManagerImpl.getDownloadStatic(dm));

    } catch (Throwable e) {

      // Debug.printStackTrace( e );

      return (null);
    }
  }
 public DownloadManager getDownloadManager() {
   return (DownloadManagerImpl.getSingleton(initialiser.getAzureusCore()));
 }
Exemplo n.º 5
0
  public static Object convert(Object datasource, boolean toCore) {
    if (datasource instanceof Object[]) {
      Object[] array = (Object[]) datasource;
      Object[] newArray = new Object[array.length];
      for (int i = 0; i < array.length; i++) {
        Object o = array[i];
        newArray[i] = convert(o, toCore);
      }
      return newArray;
    }

    try {
      if (toCore) {
        if (datasource instanceof org.gudy.azureus2.core3.download.DownloadManager) {
          return datasource;
        }
        if (datasource instanceof DownloadImpl) {
          return ((DownloadImpl) datasource).getDownload();
        }

        if (datasource instanceof org.gudy.azureus2.core3.disk.DiskManager) {
          return datasource;
        }
        if (datasource instanceof DiskManagerImpl) {
          return ((DiskManagerImpl) datasource).getDiskmanager();
        }

        if (datasource instanceof PEPeerManager) {
          return datasource;
        }
        if (datasource instanceof PeerManagerImpl) {
          return ((PeerManagerImpl) datasource).getDelegate();
        }

        if (datasource instanceof PEPeer) {
          return datasource;
        }
        if (datasource instanceof PeerImpl) {
          return ((PeerImpl) datasource).getPEPeer();
        }

        if (datasource instanceof org.gudy.azureus2.core3.disk.DiskManagerFileInfo) {
          return datasource;
        }
        if (datasource
            instanceof org.gudy.azureus2.pluginsimpl.local.disk.DiskManagerFileInfoImpl) {
          return ((org.gudy.azureus2.pluginsimpl.local.disk.DiskManagerFileInfoImpl) datasource)
              .getCore();
        }

        if (datasource instanceof TRHostTorrent) {
          return datasource;
        }
        if (datasource instanceof TrackerTorrentImpl) {
          ((TrackerTorrentImpl) datasource).getHostTorrent();
        }
      } else { // to PI
        if (datasource instanceof org.gudy.azureus2.core3.download.DownloadManager) {
          return wrap((org.gudy.azureus2.core3.download.DownloadManager) datasource);
        }
        if (datasource instanceof DownloadImpl) {
          return datasource;
        }

        if (datasource instanceof org.gudy.azureus2.core3.disk.DiskManager) {
          return wrap((org.gudy.azureus2.core3.disk.DiskManager) datasource);
        }
        if (datasource instanceof DiskManagerImpl) {
          return datasource;
        }

        if (datasource instanceof PEPeerManager) {
          return wrap((PEPeerManager) datasource);
        }
        if (datasource instanceof PeerManagerImpl) {
          return datasource;
        }

        if (datasource instanceof PEPeer) {
          return PeerManagerImpl.getPeerForPEPeer((PEPeer) datasource);
        }
        if (datasource instanceof Peer) {
          return datasource;
        }

        if (datasource instanceof org.gudy.azureus2.core3.disk.DiskManagerFileInfo) {
          DiskManagerFileInfo fileInfo =
              (org.gudy.azureus2.core3.disk.DiskManagerFileInfo) datasource;
          if (fileInfo != null) {
            try {
              return new org.gudy.azureus2.pluginsimpl.local.disk.DiskManagerFileInfoImpl(
                  DownloadManagerImpl.getDownloadStatic(fileInfo.getDownloadManager()), fileInfo);
            } catch (DownloadException e) {
              /* Ignore */
            }
          }
        }
        if (datasource
            instanceof org.gudy.azureus2.pluginsimpl.local.disk.DiskManagerFileInfoImpl) {
          return datasource;
        }

        if (datasource instanceof TRHostTorrent) {
          TRHostTorrent item = (TRHostTorrent) datasource;
          return new TrackerTorrentImpl(item);
        }
        if (datasource instanceof TrackerTorrentImpl) {
          return datasource;
        }
      }
    } catch (Throwable t) {
      Debug.out(t);
    }

    return datasource;
  }