Пример #1
0
 @Override
 protected void failed(final Throwable e) {
   LOG.error("Download failed for " + getEpisode(), e);
   if (e instanceof ExecutorStoppedException) {
     publisher.addNews(new RetreiveEvent(getEpisode(), EpisodeStateEnum.STOPPED, e, "download"));
   } else {
     publisher.addNews(
         new RetreiveEvent(getEpisode(), EpisodeStateEnum.DOWNLOAD_FAILED, e, "download"));
   }
 }
Пример #2
0
  private ProcessHolder download(final String outputTmpFileName) throws DownloadFailedException {
    final DownloadParamDTO downloadParam = buildDownloadParam(outputTmpFileName);

    final PluginDownloaderInterface downloader;
    if (PluginDownloaderInterface.class.isInstance(provider)) {
      downloader = (PluginDownloaderInterface) provider;
    } else {
      downloader = DownloadUtils.getDownloader(downloadParam, downloaders);
    }
    ProcessHolder downloadProcessHolder = downloader.download(downloadParam, downloaders);
    publisher.addNews(
        new RetreiveEvent(getEpisode(), EpisodeStateEnum.DOWNLOAD_STARTING, downloadProcessHolder));
    downloadProcessHolder.start();
    return downloadProcessHolder;
  }
Пример #3
0
 @Override
 protected void canceled() {
   LOG.info("Cancel of " + getEpisode() + " done");
   publisher.addNews(new RetreiveEvent(getEpisode(), EpisodeStateEnum.STOPPED));
 }
Пример #4
0
 @Override
 protected void ended() {
   LOG.info("Download of " + getEpisode() + " done");
   downloadedDAO.addDownloadedFiles(manual, getEpisode());
   publisher.addNews(new RetreiveEvent(getEpisode(), EpisodeStateEnum.DOWNLOADED));
 }