@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")); } }
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; }
@Override protected void canceled() { LOG.info("Cancel of " + getEpisode() + " done"); publisher.addNews(new RetreiveEvent(getEpisode(), EpisodeStateEnum.STOPPED)); }
@Override protected void ended() { LOG.info("Download of " + getEpisode() + " done"); downloadedDAO.addDownloadedFiles(manual, getEpisode()); publisher.addNews(new RetreiveEvent(getEpisode(), EpisodeStateEnum.DOWNLOADED)); }